[ios] Fix interaction of build/clobber.py & ios/build/tools/setup-gn.py
The script build/clobber.py tried to parse the build.ninja when clobbering a directory and use it as a template, however if the parsing failed, it generated a broken build.ninja file. The script ios/build/tools/setup-gn.py would create multiple empty build directory with just args.gn and a build.ninja file that would result in invoking `gn gen` as a first step. However, the build.ninja created by setup-gn.py could not be parsed by clobber.py since it did not include minimum required version of ninja command. Also, setup-gn.py did not recreate the file if they existed, even if they were incorrect. All this caused build/clobber.py to sometimes leave a build directory in an unbuildable state requiring the developer to run `gn gen` manually. To fix this, change setup-gn.py to always overwrite build.ninja file, to use a format that can be parsed by clobber.py and fix clobber.py to write a build.ninja file that is valid if parsing fails. Always overwrite the build.ninja file to ensure that `--check` is added to `gn gen` invocation (as locally running `gn gen` without `--check` even once would disable the local check of the deps and later be reported by Chrome iOS developers as a bug). Bug: 1102331 Change-Id: Iabe906ac5f676f1b837c6ebb03ee32d73c7b6cf9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2283143 Auto-Submit: Sylvain Defresne <sdefresne@chromium.org> Reviewed-by: Dirk Pranke <dpranke@google.com> Reviewed-by: Olivier Robin <olivierrobin@chromium.org> Commit-Queue: Sylvain Defresne <sdefresne@chromium.org> Cr-Commit-Position: refs/heads/master@{#786208} GitOrigin-RevId: 75bb49ad3432cb331ae13058d2029ac060ab3543
This commit is contained in:
Родитель
18e5f25087
Коммит
b185163dd5
12
clobber.py
12
clobber.py
|
@ -89,13 +89,15 @@ def delete_build_dir(build_dir):
|
|||
f.write(build_commands)
|
||||
else:
|
||||
# Couldn't parse the build.ninja file, write a default thing.
|
||||
f.write('''rule gn
|
||||
command = gn -q gen //out/%s/
|
||||
description = Regenerating ninja files
|
||||
f.write('''ninja_required_version = 1.7.2
|
||||
|
||||
rule gn
|
||||
command = gn -q gen //out/%s/
|
||||
description = Regenerating ninja files
|
||||
|
||||
build build.ninja: gn
|
||||
generator = 1
|
||||
depfile = build.ninja.d
|
||||
generator = 1
|
||||
depfile = build.ninja.d
|
||||
''' % (os.path.split(build_dir)[1]))
|
||||
|
||||
# Write a .d file for the build which references a nonexistant file. This
|
||||
|
|
Загрузка…
Ссылка в новой задаче