[infra] Always re-run GN in build.py

The workflow of using tools/gn.py followed-by tools/build.py is no
longer working as it used to (the latter will override whatever the
former configured).

Instead one should pick between:

  tools/gn.py & ninja
  tools/build.py

=> Both tools/gn.py and tools/build.py suport the same options.

This CL also makes tools/build.py stop using tools/generate_buildfiles.py (which
would get just overriden by the re-run of GN).

Change-Id: Ie698d7395e8c5862ae04a479c7c820c76ac5565d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154323
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: William Hesse <whesse@google.com>
This commit is contained in:
Martin Kustermann 2020-07-15 09:01:28 +00:00 committed by commit-bot@chromium.org
parent d559c8f635
commit 89fe12b12a
3 changed files with 8 additions and 128 deletions

View file

@ -1119,19 +1119,11 @@
"description": "This configuration is used by the vm kbc builders."
},
"steps": [
{
"name": "configure dart",
"script": "tools/gn.py",
"arguments": [
"--mode=${mode}",
"--arch=${arch}",
"--bytecode"
]
},
{
"name": "build dart",
"script": "tools/build.py",
"arguments": [
"--bytecode",
"runtime"
]
},
@ -1273,17 +1265,11 @@
"description": "This configuration is used for running FFI tests on qemu."
},
"steps": [
{
"name": "configure dart",
"script": "tools/gn.py",
"arguments": [
"--use-qemu"
]
},
{
"name": "build dart",
"script": "tools/build.py",
"arguments": [
"--use-qemu",
"dart_precompiled_runtime",
"runtime_kernel"
]
@ -1526,11 +1512,6 @@
"description": "This configuration is used by the VM/JIT builders with sanitizers."
},
"steps": [
{
"name": "configure dart",
"script": "tools/gn.py",
"arguments": []
},
{
"name": "build dart",
"script": "tools/build.py",
@ -1554,11 +1535,6 @@
"description": "This configuration is used by the VM/JIT builders with sanitizers."
},
"steps": [
{
"name": "configure dart",
"script": "tools/gn.py",
"arguments": []
},
{
"name": "build dart",
"script": "tools/build.py",
@ -1586,11 +1562,6 @@
"description": "This configuration is used by the VM/AOT builders with sanitizers."
},
"steps": [
{
"name": "configure dart",
"script": "tools/gn.py",
"arguments": []
},
{
"name": "build dart",
"script": "tools/build.py",
@ -1617,11 +1588,6 @@
"description": "This configuration is used by the VM/AOT builders with sanitizers."
},
"steps": [
{
"name": "configure dart",
"script": "tools/gn.py",
"arguments": []
},
{
"name": "build dart",
"script": "tools/build.py",
@ -1647,22 +1613,14 @@
"description": "This configuration builds the VM with GCC."
},
"steps": [
{
"name": "configure dart",
"script": "tools/gn.py",
"arguments": [
"--mode=all",
"--arch=all",
"--no-clang",
"--no-goma"
]
},
{
"name": "build dart",
"script": "tools/build.py",
"arguments": [
"--mode=all",
"--arch=all",
"--no-clang",
"--no-goma",
"runtime"
]
}
@ -3488,21 +3446,11 @@
"description": "This configuration runs tests for each supported ABI version."
},
"steps": [
{
"name": "configure dart",
"script": "tools/gn.py",
"arguments": [
"--mode=release",
"--arch=x64",
"--bytecode"
]
},
{
"name": "build dart",
"script": "tools/build.py",
"arguments": [
"--mode=release",
"--arch=x64",
"--bytecode",
"create_sdk_with_abi_versions"
]
},
@ -3523,30 +3471,11 @@
"description": "This configuration runs tests for the simarm_x64 architecture."
},
"steps": [
{
"name": "configure dart for simarm_x64",
"script": "tools/gn.py",
"arguments": [
"--mode=${mode}",
"--arch=simarm_x64",
"--bytecode"
]
},
{
"name": "configure dart for simarm",
"script": "tools/gn.py",
"arguments": [
"--mode=${mode}",
"--arch=simarm",
"--bytecode"
]
},
{
"name": "build dart for simarm_x64",
"script": "tools/build.py",
"arguments": [
"--mode=${mode}",
"--arch=simarm_x64",
"--bytecode",
"gen_snapshot"
]
},
@ -3554,8 +3483,8 @@
"name": "build dart for simarm",
"script": "tools/build.py",
"arguments": [
"--mode=${mode}",
"--arch=simarm",
"--bytecode",
"dart_precompiled_runtime",
"vm_platform"
]

View file

@ -115,48 +115,6 @@ def NotifyBuildDone(build_config, success, start):
# Ignore return code, if this command fails, it doesn't matter.
os.system(command)
def GenerateBuildfilesIfNeeded():
if os.path.exists(utils.GetBuildDir(HOST_OS)):
return True
command = [
'python',
os.path.join(DART_ROOT, 'tools', 'generate_buildfiles.py')
]
print("Running " + ' '.join(command))
process = subprocess.Popen(command)
process.wait()
if process.returncode != 0:
print("Tried to generate missing buildfiles, but failed. "
"Try running manually:\n\t$ " + ' '.join(command))
return False
return True
def RunGNIfNeeded(out_dir, target_os, mode, arch, sanitizer):
if os.path.isfile(os.path.join(out_dir, 'args.gn')):
return
gn_os = 'host' if target_os == HOST_OS else target_os
gn_command = [
'python',
os.path.join(DART_ROOT, 'tools', 'gn.py'),
'--sanitizer',
sanitizer,
'-m',
mode,
'-a',
arch,
'--os',
gn_os,
'-v',
]
process = subprocess.Popen(gn_command)
process.wait()
if process.returncode != 0:
print("Tried to run GN, but it failed. Try running it manually: \n\t$ "
+ ' '.join(gn_command))
def UseGoma(out_dir):
args_gn = os.path.join(out_dir, 'args.gn')
return 'use_goma = true' in open(args_gn, 'r').read()
@ -205,8 +163,6 @@ def BuildOneConfig(options, targets, target_os, mode, arch, sanitizer):
build_config = utils.GetBuildConf(mode, arch, target_os, sanitizer)
out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os, sanitizer)
using_goma = False
# TODO(kustermann): Remove this once we always run GN.
RunGNIfNeeded(out_dir, target_os, mode, arch, sanitizer)
command = ['ninja', '-C', out_dir]
if options.verbose:
command += ['-v']
@ -280,9 +236,6 @@ def Main():
parser.print_help()
return 1
if not GenerateBuildfilesIfNeeded():
return 1
# If binaries are built with sanitizers we should use those flags.
# If the binaries are not built with sanitizers the flag should have no
# effect.
@ -290,8 +243,7 @@ def Main():
env.update(SanitizerEnvironmentVariables())
# Always run GN before building.
# TODO(kustermann): Once recipe change landed we should enable this again.
# gn_py.RunGnOnConfiguredConfigurations(options)
gn_py.RunGnOnConfiguredConfigurations(options)
# Build all targets for each requested configuration.
configs = []

View file

@ -25,7 +25,6 @@ head -n $(expr $LINE - 1) "$FILE" >"$TEMP_HEADER"
# Run offsets_extractor for every architecture and append the results.
run() {
tools/gn.py --mode=$1 --arch=$2
tools/build.py --mode=$1 --arch=$2 offsets_extractor offsets_extractor_precompiled_runtime
echo "" >>"$TEMP_JIT"
out/$3/offsets_extractor >>"$TEMP_JIT"