-
Notifications
You must be signed in to change notification settings - Fork 21
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
Build automation tool. #64
base: master
Are you sure you want to change the base?
Build automation tool. #64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start!
FILES = 'files' | ||
COMMAND = 'command' | ||
|
||
def __init__(self, build_file=os.path.join(os.getcwd(), 'build.json')): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't really need a default value here, you can just provide this path from the main section.
Create the entire graph here, check for cyclic dependencies and stuff.
:type name: str | ||
""" | ||
|
||
for build_instruction in self.build_instructions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of O(n) search, you can create a Map<name, config>
import sys | ||
|
||
|
||
class Build(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Looks like this class represents a single build.json file, and so can be called "BuildConfig". The individual items inside that are called "BuildRule"s.
- If you create a map<full_rule_name, BuildRule>, I don't think you need a BuildConfig class.
""" | ||
|
||
class BuildSpecs(enum.Enum): | ||
BUILD = 'build.json' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unexpected. The rest of the items are attributes of the BuildRule structure, but this one is the file name, and so inconsistent.
:type files: list | ||
""" | ||
|
||
for file in files: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name "file" is not useful, since it isn't clear whether it is a file_name or file_handle or whatever else.
|
||
|
||
@contextlib.contextmanager | ||
def create_and_change_to_tmpdir(working_directory): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the caller need to provide working_directory? You can just calculate it here.
return build_instruction | ||
return None | ||
|
||
def _buildDependencies(self, dependencies): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assumption: A depends on B & C, and both B & C depend on D.
- Right now, you will build D twice. Can you avoid that?
- Can you build B & C in parallel? Use subprocess.Popen, but you shouldn't need to use any multithreading.
A rudimentary build tool that takes in a name as an argument and then builds the dependencies, ensures all files are present and executes the build command.