Add pre-upload checks into ninja targets Change-Id: Ieec9dac5a799e4b8a34d0d2c44b779aa6a6a6964 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/25080 Reviewed-by: Takuto Ikuta <tikuta@google.com> Commit-Queue: Matt Stark <msta@google.com>
diff --git a/build/gen.py b/build/gen.py index c7d03f7..569f710 100755 --- a/build/gen.py +++ b/build/gen.py
@@ -180,7 +180,7 @@ help='Enable the use of UndefinedBehaviorSanitizer') args_list.add('--no-last-commit-position', action='store_true', help='Do not generate last_commit_position.h.') - args_list.add('--out-path', type=str, + args_list.add('--out-path', type=os.path.abspath, default=os.path.join(REPO_ROOT, 'out'), help='The path to generate the build files in.') args_list.add('--no-strip', action='store_true', @@ -435,6 +435,28 @@ ] if options.starlark else []), ) + ninja.Phony( + 'check_all', + inputs=[ + ninja.RunBinary( + 'check_formatter', + inputs=[ninja.source_file('tools/run_formatter.sh')], + implicit_inputs=ninja.directory(ninja.source_file('src'), ['target']), + args='--diff', + ), + ninja.RunBinary( + 'check_reference', + inputs=[ninja.source_file('tools/update_reference.sh')], + implicit_inputs=[ + 'gn' + platform.exe_suffix, + ninja.source_file('docs/reference.md'), + ], + args='--diff', + env=f'NOBUILD=1 NINJA_OUT_DIR={os.path.relpath(build_dir, REPO_ROOT)}', + ), + ], + ) + with open(path, 'w') as f: f.write('\n'.join(ninja_header_lines)) f.write(ninja_template)
diff --git a/build/ninja_file.py b/build/ninja_file.py index 58e0e10..3f53289 100644 --- a/build/ninja_file.py +++ b/build/ninja_file.py
@@ -108,7 +108,7 @@ name='run_binary', ninja_file=self, command=self.chain( - f'{build_prefix}$in $args', python('tools/touch.py', '$out') + f'$env {build_prefix}$in $args', python('tools/touch.py', '$out') ), description='RUN BINARY $in', )