-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate out "GN builder" for the unified build script (#8381)
* Imported a general chip builder script, currently covering a few platforms/boards/apps as a start to have a single build entrypoint * Move build requirements into global script/requirements.txt so that they get picked up by the bootstrap script * Update script to assume and require bootstrapping * Code review comments * Support building the lock app for ESP32 It turns out that ESP32 lock app is ONLY for devkitc, so I added application matching logic to include board restrictions. Tested: lock app compiles and only for devkitc if esp32 platform is used. * Remove obsolete todo * Fix the duplicated accept for efr32 lock app * Add a dry run option for the build runner, showing what commands would be executed * Add gn builder as a generic build class, to make gn configuration uniform * Add support for a "test" to validate that the build generator executes commands as expected * Update the command comparison: output directory of the build script has also to be considered for testing * Fix some naming and use `get_target_outputs` * Address some code review comments * Rename chipbuild to build_examples * Fixup naming for the unit tests after build script renaming * Fix names * Restyle * Use difflib instead of diff binary for checking changes * Fix diffs (generator vs lines) and logging * Fix unit tests * Start converting python logic from build into pw_python_module * Tests pass * Restyle * Code review comments * Add comment for all_platform_commands.txt * Move expected txt data into inputs
- Loading branch information
Showing
6 changed files
with
71 additions
and
77 deletions.
There are no files selected for viewing
This file contains 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 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,38 @@ | ||
import logging | ||
import os | ||
|
||
from .builder import Builder | ||
|
||
|
||
class GnBuilder(Builder): | ||
|
||
def __init__(self, root, runner, output_dir): | ||
"""Creates a generic ninja builder. | ||
Args: | ||
root: the root where to run GN into | ||
runner: what to use to execute shell commands | ||
output_dir: where ninja files are to be generated | ||
""" | ||
super(GnBuilder, self).__init__(root, runner, output_dir) | ||
|
||
self.gn_build_args = None | ||
|
||
def generate(self): | ||
if not os.path.exists(self.output_dir): | ||
cmd = [ | ||
'gn', 'gen', '--check', '--fail-on-unused-args', | ||
'--root=%s' % self.root | ||
] | ||
|
||
if self.gn_build_args: | ||
cmd += ['--args=%s' % ' '.join(self.gn_build_args)] | ||
|
||
cmd += [self.output_dir] | ||
|
||
self._Execute(cmd, title='Generating ' + self.identifier) | ||
|
||
def build(self): | ||
self.generate() | ||
self._Execute(['ninja', '-C', self.output_dir], | ||
title='Building ' + self.identifier) |
This file contains 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 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 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 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