[build] Remove the last absolute paths from RBE builds.
Extend --check-clean (enabled on bots) to verify build commands don't include absolute paths. The non-RBE GCC and MSVC builds still have absolute paths. GCC doesn't have -ffile-compilation-dir so it uses -fdebug-prefix-map, which is not fixable. The MSVC build has absolute path in the toolchain wrappers, which might be fixable. TEST=ci Change-Id: I3b984aaab7aefa7ff527f0a039ca42281224a09d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506505 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
bd304d04bc
commit
7d6c973ed9
@@ -122,23 +122,6 @@ def find_inputs(uris, exec_root, package_config):
|
||||
return inputs
|
||||
|
||||
|
||||
# Rewrite absolute paths in an argument to be relative.
|
||||
def rewrite_absolute(arg, exec_root, working_directory):
|
||||
# The file:// schema does not work with relative paths as they are parsed as
|
||||
# the authority by the dart Uri class.
|
||||
arg = arg.replace('file:///' + exec_root, '../../')
|
||||
arg = arg.replace('file://' + exec_root, '../../')
|
||||
# Replace the absolute exec root by a relative path to the exec root.
|
||||
arg = arg.replace(exec_root, '../../')
|
||||
# Simplify paths going to the exec root and back into the out directory.
|
||||
# Carefully ensure the whole path isn't optimized away.
|
||||
if arg.endswith(f'../../{working_directory}/'):
|
||||
arg = arg.replace(f'../../{working_directory}/', '.')
|
||||
else:
|
||||
arg = arg.replace(f'../../{working_directory}/', '')
|
||||
return arg
|
||||
|
||||
|
||||
# Parse the command line execution to recognize well known programs during the
|
||||
# Dart SDK build, so the inputs and output files can be determined, and the
|
||||
# command can be offloaded to RBE.
|
||||
@@ -858,15 +841,7 @@ def main(argv):
|
||||
command.append('--labels=type=tool')
|
||||
command.append('--inputs=' + ','.join(paths))
|
||||
command.append('--output_files=' + ','.join(output_files))
|
||||
# Absolute paths must not be used with RBE, but since the build currently
|
||||
# heavily relies on them, work around this issue by rewriting the command
|
||||
# to instead use relative paths. The Dart SDK build rules needs to be fixed
|
||||
# rather than doing this, but this is an initial step towards that goal
|
||||
# which will land in subsequent follow up changes.
|
||||
command += argv[2:rewrapper_end] + [
|
||||
rewrite_absolute(arg, rewrapper.exec_root, working_directory)
|
||||
for arg in argv[rewrapper_end:]
|
||||
]
|
||||
command += argv[2:]
|
||||
|
||||
# Finally execute the command remotely.
|
||||
run_command(command, rewrapper.exec_strategy)
|
||||
|
||||
@@ -171,7 +171,8 @@ template("mac_toolchain") {
|
||||
# to the link step. Which means we can't specify per target
|
||||
# entitlement files - and instead rely on dart_codesign.py script to
|
||||
# match binaries to their entitlement files by name.
|
||||
signing_script = rebase_path("//runtime/tools/dart_codesign.py")
|
||||
signing_script =
|
||||
rebase_path("//runtime/tools/dart_codesign.py", root_build_dir)
|
||||
command += " && $signing_script --identity $codesigning_identity --binary $dylib"
|
||||
}
|
||||
|
||||
@@ -237,7 +238,8 @@ template("mac_toolchain") {
|
||||
# to the link step. Which means we can't specify per target
|
||||
# entitlement files - and instead rely on dart_codesign.py script to
|
||||
# match binaries to their entitlement files by name.
|
||||
signing_script = rebase_path("//runtime/tools/dart_codesign.py")
|
||||
signing_script =
|
||||
rebase_path("//runtime/tools/dart_codesign.py", root_build_dir)
|
||||
binaries_to_sign = [
|
||||
"--binary",
|
||||
outfile,
|
||||
|
||||
Reference in New Issue
Block a user