Commit a06a6eb7 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

[ios] Always use symbolic links to system Xcode in build_root_dir

Goma RBE only supports paths that are relative to the source dir
while build not using Goma or using old Goma backend supports both
so always use symbolic link to system Xcode on iOS.

This fix the compilation for people using Goma as Goma RBE is now
the default backend and without this change, the build would fall
back to local compilation, drastically slowing the build.

Stop using the ios_enable_relative_sdk_path and ios_use_goma_rbe
gn variables as they are now always expected to be `true`. Keep
the variable ios_use_goma_rbe to avoid breaking the bots that do
override the value but ignore it (bot set it to true anyway).

Bug: none
Change-Id: I2a3c098304594fb20491ab92100e9a4101a048db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2555117
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830616}
parent 679696cf
...@@ -19,7 +19,7 @@ if (current_cpu == "arm" || current_cpu == "arm64") { ...@@ -19,7 +19,7 @@ if (current_cpu == "arm" || current_cpu == "arm64") {
import("//build/config/arm.gni") import("//build/config/arm.gni")
} }
if (is_mac) { if (is_apple) {
import("//build/config/mac/symbols.gni") import("//build/config/mac/symbols.gni")
} }
...@@ -216,7 +216,7 @@ declare_args() { ...@@ -216,7 +216,7 @@ declare_args() {
# official builders. # official builders.
strip_absolute_paths_from_debug_symbols_default = strip_absolute_paths_from_debug_symbols_default =
is_android || is_fuchsia || is_nacl || (is_win && use_lld) || is_linux || is_android || is_fuchsia || is_nacl || (is_win && use_lld) || is_linux ||
is_chromeos || (is_mac && !enable_dsyms) || ios_use_goma_rbe is_chromeos || (is_apple && !enable_dsyms)
# If the platform uses stripped absolute paths by default, then we don't expose # If the platform uses stripped absolute paths by default, then we don't expose
# it as a configuration option. If this is causing problems, please file a bug. # it as a configuration option. If this is causing problems, please file a bug.
......
...@@ -87,14 +87,11 @@ config("compiler") { ...@@ -87,14 +87,11 @@ config("compiler") {
# that is iOS-only. Please see that target for advice on what should go in # that is iOS-only. Please see that target for advice on what should go in
# :runtime_library vs. :compiler. # :runtime_library vs. :compiler.
config("runtime_library") { config("runtime_library") {
# The variable ios_sdk_path may be relative to root_out_dir on the bots. As # The variable ios_sdk_path is relative to root_out_dir for goma RBE. As it
# it is passed to the compiler via cflags, ldflags which do not rebase the # is passed to the compiler via cflags, ldflags which do not rebase the
# values (since they are compiler flags, not paths), it may be required to # values (since they are compiler flags, not paths), it has to rebased. Use
# rebase it. Use a local variable to avoid repeating the rebase invocation. # a local variable to avoid repeating the rebase invocation.
_sdk_root = ios_sdk_path
if (ios_enable_relative_sdk_path) {
_sdk_root = rebase_path(ios_sdk_path, root_build_dir) _sdk_root = rebase_path(ios_sdk_path, root_build_dir)
}
common_flags = [ common_flags = [
"-isysroot", "-isysroot",
...@@ -222,8 +219,7 @@ _xctrunner_path = ...@@ -222,8 +219,7 @@ _xctrunner_path =
# #
# To workaround this, add a target that pretends to create those files # To workaround this, add a target that pretends to create those files
# (but does nothing). See https://crbug.com/1061487 for why this is needed. # (but does nothing). See https://crbug.com/1061487 for why this is needed.
if (ios_use_goma_rbe) { action("copy_xctrunner_app") {
action("copy_xctrunner_app") {
testonly = true testonly = true
script = "//build/noop.py" script = "//build/noop.py"
outputs = [ outputs = [
...@@ -231,7 +227,6 @@ if (ios_use_goma_rbe) { ...@@ -231,7 +227,6 @@ if (ios_use_goma_rbe) {
"$_xctrunner_path/PkgInfo", "$_xctrunner_path/PkgInfo",
"$_xctrunner_path/XCTRunner", "$_xctrunner_path/XCTRunner",
] ]
}
} }
# When creating the test runner for an XCUITest, the arm64e slice of the binary # When creating the test runner for an XCUITest, the arm64e slice of the binary
...@@ -251,7 +246,5 @@ action("xctest_runner_without_arm64e") { ...@@ -251,7 +246,5 @@ action("xctest_runner_without_arm64e") {
xcode_version, xcode_version,
] ]
if (ios_use_goma_rbe) {
deps = [ ":copy_xctrunner_app" ] deps = [ ":copy_xctrunner_app" ]
}
} }
...@@ -58,9 +58,6 @@ declare_args() { ...@@ -58,9 +58,6 @@ declare_args() {
# You can also pass the value via "--args" parameter for "gn gen" command by # You can also pass the value via "--args" parameter for "gn gen" command by
# using the syntax --args='additional_target_cpus=["arm"] target_cpu="arm64"'. # using the syntax --args='additional_target_cpus=["arm"] target_cpu="arm64"'.
additional_target_cpus = [] additional_target_cpus = []
# TODO(crbug.com/1015730): remove this flag because ios_use_goma_rbe covers.
ios_enable_relative_sdk_path = ios_use_goma_rbe
} }
declare_args() { declare_args() {
...@@ -130,6 +127,8 @@ if (ios_sdk_path == "") { ...@@ -130,6 +127,8 @@ if (ios_sdk_path == "") {
ios_sdk_info_args = [ ios_sdk_info_args = [
"--get_sdk_info", "--get_sdk_info",
"--get_machine_info", "--get_machine_info",
"--create_symlink_at",
"sdk/xcode_links",
] ]
ios_sdk_info_args += [ ios_sdk_name ] ios_sdk_info_args += [ ios_sdk_name ]
if (ios_sdk_developer_dir != "") { if (ios_sdk_developer_dir != "") {
...@@ -138,12 +137,6 @@ if (ios_sdk_path == "") { ...@@ -138,12 +137,6 @@ if (ios_sdk_path == "") {
ios_sdk_developer_dir, ios_sdk_developer_dir,
] ]
} }
if (ios_use_goma_rbe) {
ios_sdk_info_args += [
"--create_symlink_at",
"sdk/xcode_links",
]
}
script_name = "//build/config/mac/sdk_info.py" script_name = "//build/config/mac/sdk_info.py"
_ios_sdk_result = exec_script(script_name, ios_sdk_info_args, "scope") _ios_sdk_result = exec_script(script_name, ios_sdk_info_args, "scope")
ios_sdk_path = _ios_sdk_result.sdk_path ios_sdk_path = _ios_sdk_result.sdk_path
......
...@@ -433,15 +433,8 @@ template("create_signed_bundle") { ...@@ -433,15 +433,8 @@ template("create_signed_bundle") {
code_signing_args += [ "--disable-code-signature" ] code_signing_args += [ "--disable-code-signature" ]
} }
if (defined(invoker.extra_system_frameworks)) { if (defined(invoker.extra_system_frameworks)) {
# All framework in extra_system_frameworks are expected to be system
# framework and the path to be already system absolute so do not use
# rebase_path here unless ios_enable_relative_sdk_path is trued.
foreach(_framework, invoker.extra_system_frameworks) { foreach(_framework, invoker.extra_system_frameworks) {
if (ios_enable_relative_sdk_path) {
_framework_path = rebase_path(_framework, root_build_dir) _framework_path = rebase_path(_framework, root_build_dir)
} else {
_framework_path = _framework
}
code_signing_args += [ "-F=$_framework_path" ] code_signing_args += [ "-F=$_framework_path" ]
} }
} }
...@@ -1974,10 +1967,8 @@ template("ios_xcuitest_test_runner_bundle") { ...@@ -1974,10 +1967,8 @@ template("ios_xcuitest_test_runner_bundle") {
"-o=" + rebase_path(_output_name, root_build_dir), "-o=" + rebase_path(_output_name, root_build_dir),
] + rebase_path(sources, root_build_dir) ] + rebase_path(sources, root_build_dir)
if (ios_use_goma_rbe) {
deps = [ "//build/config/ios:copy_xctrunner_app" ] deps = [ "//build/config/ios:copy_xctrunner_app" ]
} }
}
ios_info_plist(_info_plist_target) { ios_info_plist(_info_plist_target) {
testonly = true testonly = true
...@@ -2006,10 +1997,8 @@ template("ios_xcuitest_test_runner_bundle") { ...@@ -2006,10 +1997,8 @@ template("ios_xcuitest_test_runner_bundle") {
outputs = [ "{{bundle_contents_dir}}/PkgInfo" ] outputs = [ "{{bundle_contents_dir}}/PkgInfo" ]
if (ios_use_goma_rbe) {
public_deps = [ "//build/config/ios:copy_xctrunner_app" ] public_deps = [ "//build/config/ios:copy_xctrunner_app" ]
} }
}
_xctest_bundle = invoker.xctest_bundle _xctest_bundle = invoker.xctest_bundle
create_signed_bundle(_target_name) { create_signed_bundle(_target_name) {
......
...@@ -77,7 +77,7 @@ if (!use_system_xcode) { ...@@ -77,7 +77,7 @@ if (!use_system_xcode) {
} }
# put system xcode under src to avoid absolute path. # put system xcode under src to avoid absolute path.
if (use_system_xcode && ios_use_goma_rbe) { if (use_system_xcode) {
sdk_info_args += [ sdk_info_args += [
"--get_sdk_info", "--get_sdk_info",
"--create_symlink_at", "--create_symlink_at",
...@@ -89,7 +89,7 @@ sdk_info_args += [ mac_sdk_name ] ...@@ -89,7 +89,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 && ios_use_goma_rbe) { if (mac_sdk_path == "" && use_system_xcode) {
mac_sdk_path = _mac_sdk_result.sdk_path mac_sdk_path = _mac_sdk_result.sdk_path
} }
......
...@@ -25,8 +25,9 @@ declare_args() { ...@@ -25,8 +25,9 @@ declare_args() {
# TODO(crbug.com/726475): true if use_goma = true in the future. # TODO(crbug.com/726475): true if use_goma = true in the future.
use_java_goma = false use_java_goma = false
# Auto-configure for Goma RBE backend. # Deprecated and ignored as Goma RBE is now the default. Still exists
# TODO(crbug.com/1015730): true if use_goma = true in the future. # to avoid breaking the build on the bots. Will be removed when all
# bots have been configured to not set this variable.
ios_use_goma_rbe = false ios_use_goma_rbe = false
} }
......
...@@ -328,6 +328,23 @@ ask there. As mentioned above, be sure that the ...@@ -328,6 +328,23 @@ ask there. As mentioned above, be sure that the
[waterfall](https://build.chromium.org/buildbot/waterfall/) is green and the tree [waterfall](https://build.chromium.org/buildbot/waterfall/) is green and the tree
is open before checking out. This will increase your chances of success. is open before checking out. This will increase your chances of success.
### Debugging
To help with reproductible builds, and to work with Goma, the path to source
files in debugging symbols are relative to source directory. To allow Xcode
to find the source files, you need to ensure to have an `~/.lldbinit-Xcode`
file with the following lines into it (substitute {SRC} for your actual path
to the root of Chromium's sources):
```
script sys.path[:0] = ['{SRC}/tools/lldb']
script import lldbinit
```
This will also allow you to see the content of some of Chromium types in the
debugger like `base::string16`, ... If you want to use `lldb` directly, name
the file `~/.lldbinit` instead of `~/.lldbinit-Xcode`.
### Changing the version of Xcode ### Changing the version of Xcode
To change the version of Xcode used to build Chromium on iOS, please follow To change the version of Xcode used to build Chromium on iOS, please follow
......
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