- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.3k
Add prebuild script to use additional build options #8095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
            brainelectronics
  wants to merge
  13
  commits into
  esp8266:master
from
brainelectronics:feature/allow-custom-build-options-file
  
      
      
   
      
    
  
     Closed
                    Changes from 2 commits
      Commits
    
    
            Show all changes
          
          
            13 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      c2784a8
              
                Add prebuild script to use additional build options
              
              
                brainelectronics 5c0f07f
              
                replace bash with python script
              
              
                brainelectronics 286cc4c
              
                add documentation for build_opt.h file to the faq readme
              
              
                brainelectronics 1489c98
              
                Merge branch 'master' into feature/allow-custom-build-options-file
              
              
                brainelectronics b49484d
              
                set build option file modification time as sketch modification time o…
              
              
                brainelectronics 34f85e7
              
                mentioning no automatic rebuild of core.s files on changes of build o…
              
              
                brainelectronics 4aa76d3
              
                fix collection of creation time only after creating build options file
              
              
                brainelectronics 97c3d8d
              
                fix correct creation of full sketch path
              
              
                brainelectronics d3aa9f9
              
                Merge branch 'master' into feature/allow-custom-build-options-file
              
              
                brainelectronics 6433625
              
                Merge branch 'master' into feature/allow-custom-build-options-file
              
              
                brainelectronics dec7ab8
              
                Minor cleanup FAQ section under-tildes
              
              
                earlephilhower d03a2ec
              
                modify build opt time only if required and file available
              
              
                brainelectronics 360a445
              
                Merge branch 'feature/allow-custom-build-options-file' of github.com:…
              
              
                brainelectronics File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env python3 | ||
| # -*- coding: utf-8 -*- | ||
| # | ||
| # prebuild.py — create build_opt.h file in build directory if it does not exist | ||
| # | ||
| # This script will create a folder called "sketch" in the build path if it does | ||
| # not yet exist and create an empty build options file inside if this does also | ||
| # not exist yet | ||
| # | ||
| # Written by brainelectronics, 2021. | ||
| # | ||
|  | ||
| import os | ||
| import sys | ||
|  | ||
|  | ||
| def create_sketch_dir(build_path): | ||
| sketch_build_path = os.path.join(build_path, "sketch") | ||
|  | ||
| if not os.path.exists(sketch_build_path): | ||
| os.makedirs(sketch_build_path) | ||
|  | ||
|  | ||
| def create_build_options_file(source_path, build_path): | ||
| file_source_path = os.path.join(source_path, "build_opt.h") | ||
| file_build_path = os.path.join(build_path, "sketch", "build_opt.h") | ||
|  | ||
| if not os.path.exists(file_source_path): | ||
| open(file_build_path, 'a').close() | ||
|  | ||
|  | ||
| def main(): | ||
| if len(sys.argv) == 3: | ||
| build_path = sys.argv[1] | ||
| source_path = sys.argv[2] | ||
|  | ||
| create_sketch_dir(build_path) | ||
| create_build_options_file(source_path, build_path) | ||
|  | ||
|  | ||
| if __name__ == '__main__': | ||
| sys.exit(main()) | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.