mirror of
https://github.com/dart-lang/sdk
synced 2024-09-28 22:52:51 +00:00
[infra] Support testing with RBE on Windows.
Place the windows toolchain in the build root so it can be sent to RBE. Use relative paths in debug symbols when building with Windows clang, which is needed for remotely building with RBE. Set the executable bit when invoking clang-cl remotely as it has not been set on Windows RBE clients. Stop including .rst files during build commands as @options-from-file is not supported by rewrapper at this time. Forward RBE_cfg into the msvc build environment and rewrite the INCLUDE, LIB, and LIBPATH environment variables to use relative paths instead of absolute paths. Don't download reclient on windows-arm64 where there is no cipd package and the windows-arm64 python lies and says it's x64 because they actually packaged a x64 python. Tune the Windows -j performance to match the historic bot performance as most casual Windows machines won't handle -j 1000 well. Bug: b/296994239 Change-Id: I2bd1b4478fca796f0a326c062a5f478f16c2c6ef Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343440 Reviewed-by: William Hesse <whesse@google.com> Commit-Queue: Jonas Termansen <sortie@google.com>
This commit is contained in:
parent
3ef08e1ecd
commit
a19d3f3375
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -39,6 +39,9 @@ CMakeLists.txt
|
|||
.clang_complete
|
||||
cmake-build-debug
|
||||
|
||||
# Windows toolchain.
|
||||
win_toolchain
|
||||
|
||||
# VS project files
|
||||
.vs
|
||||
|
||||
|
|
7
DEPS
7
DEPS
|
@ -81,7 +81,8 @@ vars = {
|
|||
# https://chrome-infra-packages.appspot.com/p/gn/gn
|
||||
"gn_version": "git_revision:a2e2717ea670249a34b0de4b3e54f268d320bdfa",
|
||||
|
||||
"reclient_version": "git_revision:f3883c2237b0eb9cc9524cb571b5ab8378f257e4",
|
||||
"reclient_version": "git_revision:c7349324c93c6e0d85bc1e00b5d7526771006ea0",
|
||||
"download_reclient": True,
|
||||
|
||||
# Update from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core
|
||||
"fuchsia_sdk_version": "version:18.20240208.2.1",
|
||||
|
@ -617,7 +618,9 @@ Var("dart_root") + "/third_party/pkg/tar":
|
|||
}
|
||||
],
|
||||
# Download reclient only on the platforms where it has packages available.
|
||||
'condition': '((host_os == "linux" or host_os == "mac" ) and host_cpu == "x64") or (host_os == "mac" and host_cpu == "arm64")',
|
||||
# Unfortunately windows-arm64 gclient uses x64 python which lies in
|
||||
# host_cpu, so we have to use a variable to not download reclient there.
|
||||
'condition': 'download_reclient and (((host_os == "linux" or host_os == "mac" or host_os == "win") and host_cpu == "x64") or (host_os == "mac" and host_cpu == "arm64"))',
|
||||
'dep_type': 'cipd',
|
||||
},
|
||||
|
||||
|
|
|
@ -256,6 +256,11 @@ if (is_win) {
|
|||
"//build/config/win:unicode",
|
||||
"//build/config/win:winver",
|
||||
]
|
||||
if (is_clang) {
|
||||
_native_compiler_configs += [
|
||||
"//build/config/win:relative_paths",
|
||||
]
|
||||
}
|
||||
}
|
||||
if (is_posix) {
|
||||
_native_compiler_configs += [
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/win/visual_studio_version.gni")
|
||||
import("//build/toolchain/rbe.gni")
|
||||
|
||||
# Compiler setup for the Windows SDK. Applied to all targets.
|
||||
config("sdk") {
|
||||
|
@ -180,3 +181,43 @@ config("lean_and_mean") {
|
|||
config("nominmax") {
|
||||
defines = [ "NOMINMAX" ]
|
||||
}
|
||||
|
||||
# Relative paths --------------------------------------------------------------
|
||||
|
||||
config("relative_paths") {
|
||||
# Make builds independent of absolute file path. The file names
|
||||
# embedded in debugging information will be expressed as relative to
|
||||
# the build directory, e.g. "../.." for an "out/subdir" under //.
|
||||
# This is consistent with the file names in __FILE__ expansions
|
||||
# (e.g. in assertion messages), which the compiler doesn't provide a
|
||||
# way to remap. That way source file names in logging and
|
||||
# symbolization can all be treated the same way. This won't go well
|
||||
# if root_build_dir is not a subdirectory //, but there isn't a better
|
||||
# option to keep all source file name references uniformly relative to
|
||||
# a single root.
|
||||
if (use_rbe) {
|
||||
absolute_path = "/b/f/w/"
|
||||
} else {
|
||||
absolute_path = rebase_path("//")
|
||||
}
|
||||
relative_path = ""
|
||||
cflags = [
|
||||
# This makes sure that debug information uses relative paths.
|
||||
"-fdebug-prefix-map=$absolute_path=$relative_path",
|
||||
|
||||
# Remove absolute paths from the debug information.
|
||||
"-fdebug-compilation-dir=",
|
||||
"-fcoverage-compilation-dir=",
|
||||
|
||||
# This makes sure that include directories in the toolchain are
|
||||
# represented as relative to the build directory (because that's how
|
||||
# we invoke the compiler), rather than absolute. This can affect
|
||||
# __FILE__ expansions (e.g. assertions in system headers). We
|
||||
# normally run a compiler that's someplace within the source tree
|
||||
# (//buildtools/...), so its absolute installation path will have a
|
||||
# prefix matching absolute_path and hence be mapped to relative_path
|
||||
# in the debugging information, so this should actually be
|
||||
# superfluous for purposes of the debugging information.
|
||||
"-no-canonical-prefixes",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
os=$(uname -s | tr '[A-Z]' '[a-z'])
|
||||
arch=$(uname -m | tr '[A-Z]' '[a-z'] | sed -E 's/^x86_64$/x64/')
|
||||
rm -f "$1"
|
||||
cp "../../buildtools/$os-$arch/clang/bin/llvm" "$1"
|
||||
chmod +x "$1"
|
||||
INCLUDE=${INCLUDE//\\/\/}
|
||||
"$@"
|
||||
|
|
6
build/rbe/win-intel.cfg
Normal file
6
build/rbe/win-intel.cfg
Normal file
|
@ -0,0 +1,6 @@
|
|||
service=remotebuildexecution.googleapis.com:443
|
||||
instance=projects/flutter-rbe-prod/instances/default
|
||||
use_application_default_credentials=true
|
||||
enable_deps_cache=true
|
||||
server_address=pipe://reproxy.ipc
|
||||
log_format=reducedtext
|
|
@ -32,6 +32,7 @@ if (use_goma) {
|
|||
rewrapper_args + [ "--labels=type=compile,compiler=clang-cl,lang=cpp" ]
|
||||
if (rbe_os != host_os || rbe_cpu != host_cpu) {
|
||||
compiler_args += [
|
||||
"--env_var_allowlist=INCLUDE",
|
||||
"--inputs=build/rbe,buildtools/$rbe_os-$rbe_cpu/clang/bin/llvm",
|
||||
"--remote_wrapper=../../build/rbe/llvm.sh",
|
||||
]
|
||||
|
@ -85,7 +86,7 @@ template("msvc_toolchain") {
|
|||
# TODO(brettw) enable this when GN support in the binary has been rolled.
|
||||
#precompiled_header_type = "msvc"
|
||||
pdbname = "{{target_out_dir}}/{{target_output_name}}_c.pdb"
|
||||
command = "$ninja_path -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
|
||||
command = "$ninja_path -t msvc -e $env -- $cl /nologo /showIncludes /FC {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} /c {{source}} /Fo{{output}} /Fd$pdbname"
|
||||
depsformat = "msvc"
|
||||
description = "CC {{output}}"
|
||||
outputs = [
|
||||
|
@ -106,7 +107,7 @@ template("msvc_toolchain") {
|
|||
if (is_clang && invoker.current_cpu == "x86") {
|
||||
flags = "-m32"
|
||||
}
|
||||
command = "$ninja_path -t msvc -e $env -- $cl $flags /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
|
||||
command = "$ninja_path -t msvc -e $env -- $cl $flags /nologo /showIncludes /FC {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} /c {{source}} /Fo{{output}} /Fd$pdbname"
|
||||
depsformat = "msvc"
|
||||
description = "CXX {{output}}"
|
||||
outputs = [
|
||||
|
|
|
@ -39,6 +39,7 @@ def _ExtractImportantEnvironment(output_of_set):
|
|||
'luci_context', # needed by vpython
|
||||
'path',
|
||||
'pathext',
|
||||
'rbe_cfg', # Dart specific patch: RBE_cfg is needed by reclient.
|
||||
'systemroot',
|
||||
'temp',
|
||||
'tmp',
|
||||
|
@ -59,15 +60,25 @@ def _ExtractImportantEnvironment(output_of_set):
|
|||
# path. Add the path to this python here so that if it's not in the
|
||||
# path when ninja is run later, python will still be found.
|
||||
setting = os.path.dirname(sys.executable) + os.pathsep + setting
|
||||
if envvar in ['include', 'lib']:
|
||||
# Dart specific patch: Ensure the environment variables use relative
|
||||
# paths to the toolchain such that RBE commands can be cached
|
||||
# remotely due to no absolute paths. Rewrite libpath as well although
|
||||
# don't use it remotely at the moment.
|
||||
if envvar in ['include', 'lib', 'libpath']:
|
||||
exec_root_abs = os.path.dirname(os.path.dirname(os.getcwd()))
|
||||
exec_root_rel = os.path.join('..', '..')
|
||||
# Make sure that the include and lib paths point to directories that
|
||||
# exist. This ensures a (relatively) clear error message if the
|
||||
# required SDK is not installed.
|
||||
parts = []
|
||||
for part in setting.split(';'):
|
||||
part = part.replace(exec_root_abs, exec_root_rel)
|
||||
if not os.path.exists(part) and len(part) != 0:
|
||||
raise Exception(
|
||||
'Path "%s" from environment variable "%s" does not exist. '
|
||||
'Make sure the necessary SDK is installed.' % (part, envvar))
|
||||
parts.append(part)
|
||||
setting = ';'.join(parts)
|
||||
env[var.upper()] = setting
|
||||
break
|
||||
if sys.platform in ('win32', 'cygwin'):
|
||||
|
|
|
@ -517,12 +517,17 @@ def Update(force=False, no_download=False):
|
|||
subprocess.check_call([
|
||||
ciopfs, '-o', 'use_ino', toolchain_dir + '.ciopfs', toolchain_dir])
|
||||
|
||||
# Dart specific patch: Store the visual studio toolchain inside the exec
|
||||
# root directory such that it can be sent to RBE and invoked with a
|
||||
# relative path identical on all checkouts.
|
||||
toolchain_dir = os.path.join(os.getcwd(), 'sdk', 'win_toolchain')
|
||||
get_toolchain_args = [
|
||||
sys.executable,
|
||||
os.path.join(depot_tools_path,
|
||||
'win_toolchain',
|
||||
'get_toolchain_if_necessary.py'),
|
||||
'--output-json', json_data_file,
|
||||
'--toolchain-dir', toolchain_dir,
|
||||
] + _GetDesiredVsToolchainHashes()
|
||||
if force:
|
||||
get_toolchain_args.append('--force')
|
||||
|
|
|
@ -44,7 +44,7 @@ def BuildOptions():
|
|||
other_group.add_argument("-j",
|
||||
type=int,
|
||||
help='Ninja -j option for Goma/RBE builds.',
|
||||
default=1000)
|
||||
default=200 if sys.platform == 'win32' else 1000)
|
||||
other_group.add_argument("-l",
|
||||
type=int,
|
||||
help='Ninja -l option for Goma/RBE builds.',
|
||||
|
|
Loading…
Reference in a new issue