Index: build/toolchain/mac/BUILD.gn |
diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn |
index 7807746f146f7dbeb49640e1c11fa912a0b3e95a..829c42c1d654f5d309d38bf939345e014e3e069d 100644 |
--- a/build/toolchain/mac/BUILD.gn |
+++ b/build/toolchain/mac/BUILD.gn |
@@ -59,7 +59,29 @@ template("mac_toolchain") { |
cxx = invoker.cxx |
ld = invoker.ld |
+ # When implementing tools using Python scripts, a TOOL_VERSION=N env |
+ # variable is placed in front of the command. The N should be incremented |
+ # whenever the script is changed, so that the build system rebuilds all |
+ # edges that utilize the script. Ideally this should be changed to use |
+ # proper input-dirty checking, but that could be expensive. Instead, use a |
+ # script to get the tool scripts' modification time to use as the version. |
+ # This won't cause a re-generation of GN files when the tool script changes |
+ # but it will cause edges to be marked as dirty if the ninja files are |
+ # regenerated. See https://crbug.com/619083 for details. A proper fix |
+ # would be to have inputs to tools (https://crbug.com/621119). |
+ tool_versions = |
+ exec_script("get_tool_mtime.py", |
brettw
2016/06/17 20:43:30
Can you move this up above the template() definiti
Robert Sesek
2016/06/17 20:53:32
Done.
|
+ rebase_path([ |
+ "//build/toolchain/mac/compile_xcassets.py", |
+ "//build/toolchain/mac/copy_bundle_data.py", |
+ "//build/toolchain/mac/filter_libtool.py", |
+ "//build/toolchain/mac/linker_driver.py", |
+ ], |
+ root_build_dir), |
+ "trim scope") |
+ |
linker_driver = |
+ "TOOL_VERSION=${tool_versions.linker_driver} " + |
rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) |
# Make these apply to all tools below. |
@@ -136,7 +158,7 @@ template("mac_toolchain") { |
tool("alink") { |
script = |
rebase_path("//build/toolchain/mac/filter_libtool.py", root_build_dir) |
- command = "rm -f {{output}} && python $script libtool -static {{arflags}} -o {{output}} {{inputs}}" |
+ command = "rm -f {{output}} && TOOL_VERSION=${tool_versions.filter_libtool} python $script libtool -static {{arflags}} -o {{output}} {{inputs}}" |
description = "LIBTOOL-STATIC {{output}}" |
outputs = [ |
"{{output_dir}}/{{target_output_name}}{{output_extension}}", |
@@ -283,7 +305,7 @@ template("mac_toolchain") { |
} |
_tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py", |
root_build_dir) |
- command = "python $_tool ${_extra_args} {{source}} {{output}}" |
+ command = "TOOL_VERSION=${tool_versions.copy_bundle_data} python $_tool ${_extra_args} {{source}} {{output}}" |
description = "COPY_BUNDLE_DATA {{source}} {{output}}" |
pool = ":bundle_pool($default_toolchain)" |
} |
@@ -298,6 +320,7 @@ template("mac_toolchain") { |
_min_deployment_target = mac_deployment_target |
} |
command = "rm -f {{output}} && " + |
+ "TOOL_VERSION=${tool_versions.compile_xcassets} " + |
"python $_tool -p $_sdk_name -t $_min_deployment_target " + |
"-o {{output}} {{inputs}}" |