Commit 92754a40 authored by sdefresne's avatar sdefresne Committed by Commit bot

[iOS] Fix build always considered dirty.

Fix build when dSYM generation is enabled and output is a thin binary
by correctly informing gn and ninja of the location where the .dSYM
file is generated.

When defining "dsym_switch" in the toolchain definition, the value of
root_out_dir is not yet known (it is only known later when we know if
the toolchain is the default toolchain or not), so use {{root_out_dir}}
to lazily perform the expansion when the information is known.

When determining whether dSYM generation is enabled in the toolchain
definition, look at "toochain_os" instead of "is_ios" as "is_ios" is
defined based on target_os (i.e. is incorrect in the toolchain).

Use output_dir/output_name instead of using rebase_path() to generate
an output name containing directory information because 1. this is a
hack that output_dir was introduced to fix, 2. link tool and ninja do
not agree about the location of the .dSYM file.

BUG=630901

Review-Url: https://codereview.chromium.org/2174373002
Cr-Commit-Position: refs/heads/master@{#407737}
parent 03e20c08
...@@ -210,7 +210,6 @@ template("ios_app_bundle") { ...@@ -210,7 +210,6 @@ template("ios_app_bundle") {
} }
_link_executable = _target_name + "_executable" _link_executable = _target_name + "_executable"
_executable_path = "$target_out_dir/$_output_name"
if (ios_enable_code_signing) { if (ios_enable_code_signing) {
_link_executable_visibility = [ ":$_target_name" ] _link_executable_visibility = [ ":$_target_name" ]
...@@ -230,8 +229,6 @@ template("ios_app_bundle") { ...@@ -230,8 +229,6 @@ template("ios_app_bundle") {
_link_executable_visibility = [] _link_executable_visibility = []
_link_executable_visibility = [ ":$_lipo_executable" ] _link_executable_visibility = [ ":$_lipo_executable" ]
_link_executable = _target_name + "_arch_executable" _link_executable = _target_name + "_arch_executable"
_arch_executable_path = "$target_out_dir/$current_cpu/$_output_name"
} }
executable(_link_executable) { executable(_link_executable) {
...@@ -253,11 +250,12 @@ template("ios_app_bundle") { ...@@ -253,11 +250,12 @@ template("ios_app_bundle") {
visibility = _link_executable_visibility visibility = _link_executable_visibility
output_name = _output_name
output_prefix_override = true output_prefix_override = true
if (_is_fat_build) { if (_is_fat_build) {
output_name = rebase_path(_arch_executable_path, root_build_dir) output_dir = "$target_out_dir/$current_cpu"
} else { } else {
output_name = rebase_path(_executable_path, root_build_dir) output_dir = target_out_dir
} }
if (!defined(libs)) { if (!defined(libs)) {
...@@ -279,10 +277,10 @@ template("ios_app_bundle") { ...@@ -279,10 +277,10 @@ template("ios_app_bundle") {
visibility = _lipo_executable_visibility visibility = _lipo_executable_visibility
script = "//build/toolchain/mac/linker_driver.py" script = "//build/toolchain/mac/linker_driver.py"
outputs = [ outputs = [
_executable_path, "$target_out_dir/$_output_name",
] ]
inputs = [ inputs = [
_arch_executable_path, "$target_out_dir/$current_cpu/$_output_name",
] ]
deps = [ deps = [
":$_link_executable", ":$_link_executable",
...@@ -993,7 +991,6 @@ template("ios_xctest_test") { ...@@ -993,7 +991,6 @@ template("ios_xctest_test") {
} }
_xctest_loadable_module_target = _xctest_target + "_loadable_module" _xctest_loadable_module_target = _xctest_target + "_loadable_module"
_xctest_loadable_module_path = "$target_out_dir/$_xctest_output"
if (!ios_enable_code_signing) { if (!ios_enable_code_signing) {
_xctest_loadable_module_bundle = _xctest_loadable_module_bundle =
...@@ -1008,8 +1005,6 @@ template("ios_xctest_test") { ...@@ -1008,8 +1005,6 @@ template("ios_xctest_test") {
_xctest_lipo_loadable_module_target = _xctest_loadable_module_target _xctest_lipo_loadable_module_target = _xctest_loadable_module_target
_xctest_lipo_loadable_module_visibility = _xctest_lipo_loadable_module_visibility =
_xctest_loadable_module_visibility _xctest_loadable_module_visibility
_arch_xctest_loadable_module_path =
"$target_out_dir/$current_cpu/$_xctest_output"
_xctest_loadable_module_visibility = [] _xctest_loadable_module_visibility = []
_xctest_loadable_module_visibility = _xctest_loadable_module_visibility =
...@@ -1025,12 +1020,12 @@ template("ios_xctest_test") { ...@@ -1025,12 +1020,12 @@ template("ios_xctest_test") {
configs += [ "//build/config/ios:xctest_config" ] configs += [ "//build/config/ios:xctest_config" ]
if (_is_fat_build) { if (_is_fat_build) {
output_name = output_dir = "$target_out_dir/$current_cpu"
rebase_path(_arch_xctest_loadable_module_path, root_out_dir)
} else { } else {
output_name = rebase_path(_xctest_loadable_module_path, root_out_dir) output_dir = target_out_dir
} }
output_name = _xctest_output
output_prefix_override = true output_prefix_override = true
output_extension = "" output_extension = ""
} }
...@@ -1040,10 +1035,10 @@ template("ios_xctest_test") { ...@@ -1040,10 +1035,10 @@ template("ios_xctest_test") {
visibility = _xctest_lipo_loadable_module_visibility visibility = _xctest_lipo_loadable_module_visibility
script = "//build/toolchain/mac/linker_driver.py" script = "//build/toolchain/mac/linker_driver.py"
outputs = [ outputs = [
_xctest_loadable_module_path, "$target_out_dir/$_xctest_output",
] ]
inputs = [ inputs = [
_arch_xctest_loadable_module_path, "$target_out_dir/$current_cpu/$_xctest_output",
] ]
deps = [ deps = [
":$_xctest_loadable_module_target", ":$_xctest_loadable_module_target",
......
...@@ -92,7 +92,7 @@ template("mac_toolchain") { ...@@ -92,7 +92,7 @@ template("mac_toolchain") {
"TOOL_VERSION=${tool_versions.linker_driver} " + "TOOL_VERSION=${tool_versions.linker_driver} " +
rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir)
if (is_ios && additional_toolchains != []) { if (invoker.toolchain_os == "ios" && additional_toolchains != []) {
# For a fat build, the generation of dSYM needs to be performed after the # For a fat build, the generation of dSYM needs to be performed after the
# generation of the fat binaries using "lipo". So disable the generation # generation of the fat binaries using "lipo". So disable the generation
# of the dSYM for intermediate architecture specific binaries. # of the dSYM for intermediate architecture specific binaries.
...@@ -114,7 +114,7 @@ template("mac_toolchain") { ...@@ -114,7 +114,7 @@ template("mac_toolchain") {
# If dSYMs are enabled, this flag will be added to the link tools. # If dSYMs are enabled, this flag will be added to the link tools.
if (_enable_dsyms) { if (_enable_dsyms) {
dsym_switch = " -Wcrl,dsym," + rebase_path(root_out_dir) + " " dsym_switch = " -Wcrl,dsym,{{root_out_dir}} "
_dsym_output = _dsym_output =
"{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM/" "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM/"
} else { } else {
......
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