Commit eefc5925 authored by Robert Sesek's avatar Robert Sesek Committed by Chromium LUCI CQ

mac: Use symbolic links to the SDK when using system Xcode and Goma.

Goma RBE only supports paths that are relative to the build directory,
and the system Xcode typically resides outside of that, so all
compilation requests fail. The solution is to put a symbolic link to
the SDK in the build directory and reference that instead.

In addition, any files in the SDK referenced as inputs to a GN action
need to be listed as an output of some other GN action, as they are now
considered to be build outputs by way of the symlink in the build
directory. This creates a new //build/config/mac:sdk_inputs target for
those actions to depend on, which lists those files as outputs via
a dummy build rule.

Bug: 1157103
Change-Id: I5f7a1926fc2714c10a8786e100371d3eb9888a05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2582409Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835636}
parent 971f8eb6
...@@ -104,3 +104,29 @@ config("strip_all") { ...@@ -104,3 +104,29 @@ config("strip_all") {
ldflags = [ "-Wcrl,strip,-x,-S" ] ldflags = [ "-Wcrl,strip,-x,-S" ]
} }
} }
# When building with Goma, all inputs must be relative to the build directory.
# If using the system Xcode, which typically resides outside the build root, a
# symlink to the SDK is created in the build directory, and the path to that
# link is stored in $mac_sdk_path. If an action references a file in the SDK as
# an input, GN will complain that no target generates the file because it is
# below the $root_build_dir. The below action lists as outputs the files in the
# SDK that are referenced as inputs to actions, so that GN thinks a target has
# generated them. The list is centralized here, as multiple targets need to
# reference the same files, and an output can only be generated once.
#
# The symbolic link for $mac_sdk_path is set up by
# //build/config/mac/sdk_info.py in //build/config/mac/mac_sdk.gni.
if (use_system_xcode && use_goma) {
action("sdk_inputs") {
script = "//build/noop.py"
outputs = [
"$mac_sdk_path/usr/include/mach/exc.defs",
"$mac_sdk_path/usr/include/mach/mach_exc.defs",
"$mac_sdk_path/usr/include/mach/notify.defs",
]
}
} else {
group("sdk_inputs") {
}
}
...@@ -77,10 +77,8 @@ if (!use_system_xcode) { ...@@ -77,10 +77,8 @@ if (!use_system_xcode) {
} }
# Goma RBE requires paths relative to source directory. When using system # Goma RBE requires paths relative to source directory. When using system
# Xcode, this is done by creating symbolic links in root_build_dir. It is # Xcode, this is done by creating symbolic links in root_build_dir.
# only supported when targetting iOS. The check uses `target_os` as this if (use_system_xcode && use_goma) {
# file is parsed for the host toolchain and `is_ios` checks `current_os`.
if (use_system_xcode && use_goma && target_os == "ios") {
sdk_info_args += [ sdk_info_args += [
"--get_sdk_info", "--get_sdk_info",
"--create_symlink_at", "--create_symlink_at",
...@@ -92,7 +90,7 @@ sdk_info_args += [ mac_sdk_name ] ...@@ -92,7 +90,7 @@ sdk_info_args += [ mac_sdk_name ]
_mac_sdk_result = exec_script(script_name, sdk_info_args, "scope") _mac_sdk_result = exec_script(script_name, sdk_info_args, "scope")
xcode_version = _mac_sdk_result.xcode_version xcode_version = _mac_sdk_result.xcode_version
xcode_build = _mac_sdk_result.xcode_build xcode_build = _mac_sdk_result.xcode_build
if (mac_sdk_path == "" && use_system_xcode && use_goma && target_os == "ios") { if (mac_sdk_path == "" && use_system_xcode && use_goma) {
mac_sdk_path = _mac_sdk_result.sdk_path mac_sdk_path = _mac_sdk_result.sdk_path
} }
......
...@@ -39,3 +39,5 @@ Local Modifications: ...@@ -39,3 +39,5 @@ Local Modifications:
- MultiprocessExec.MultiprocessExec is disabled when OS_POSIX and - MultiprocessExec.MultiprocessExec is disabled when OS_POSIX and
BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) are defined. crbug.com/1153544 BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) are defined. crbug.com/1153544
(third_party/crashpad/crashpad/test/multiprocess_exec_test.cc) (third_party/crashpad/crashpad/test/multiprocess_exec_test.cc)
- Add a dependency on //build/config/mac:sdk_inputs for MIG actions.
crbug.com/1157103
...@@ -77,6 +77,7 @@ if (crashpad_is_mac || crashpad_is_ios) { ...@@ -77,6 +77,7 @@ if (crashpad_is_mac || crashpad_is_ios) {
migcom_path, migcom_path,
] ]
} }
deps = [ "//build/config/mac:sdk_inputs" ]
} }
if (sysroot != "") { if (sysroot != "") {
if (crashpad_is_in_chromium) { if (crashpad_is_in_chromium) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment