forked from firka/flutter
Use GN instead of Ninja to generate compile commands and save ~1sec off of no-op builds. (flutter/engine#25737)
This commit is contained in:
@@ -33,7 +33,7 @@ DART_BIN="${SRC_DIR}/third_party/dart/tools/sdks/dart-sdk/bin"
|
||||
DART="${DART_BIN}/dart"
|
||||
PUB="${DART_BIN}/pub"
|
||||
|
||||
COMPILE_COMMANDS="$SRC_DIR/out/compile_commands.json"
|
||||
COMPILE_COMMANDS="$SRC_DIR/out/host_debug/compile_commands.json"
|
||||
if [ ! -f "$COMPILE_COMMANDS" ]; then
|
||||
(cd "$SRC_DIR"; ./flutter/tools/gn)
|
||||
fi
|
||||
|
||||
@@ -459,6 +459,7 @@ def main(argv):
|
||||
'%s/flutter/third_party/gn/gn%s' % (SRC_ROOT, exe),
|
||||
'gen',
|
||||
'--check',
|
||||
'--export-compile-commands',
|
||||
]
|
||||
|
||||
if args.ide != '':
|
||||
@@ -487,30 +488,6 @@ def main(argv):
|
||||
print("Failed to generate gn files: ", exc.returncode, exc.output)
|
||||
sys.exit(1)
|
||||
|
||||
if gn_call_result == 0:
|
||||
# Generate/Replace the compile commands database in out.
|
||||
compile_cmd_gen_cmd = [
|
||||
'ninja',
|
||||
'-C',
|
||||
out_dir,
|
||||
'-t',
|
||||
'compdb',
|
||||
'cc',
|
||||
'cxx',
|
||||
'objc',
|
||||
'objcxx',
|
||||
'asm',
|
||||
]
|
||||
|
||||
try:
|
||||
contents = subprocess.check_output(compile_cmd_gen_cmd, cwd=SRC_ROOT)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
print("Failed to run ninja: ", exc.returncode, exc.output)
|
||||
sys.exit(1)
|
||||
compile_commands = open('%s/out/compile_commands.json' % SRC_ROOT, 'w+')
|
||||
compile_commands.write(contents)
|
||||
compile_commands.close()
|
||||
|
||||
return gn_call_result
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user