Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2549)

Unified Diff: build/toolchain/mac/BUILD.gn

Issue 2075703002: [Mac/iOS/GN] Place a version in the command of toolchain tools implemented using scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/toolchain/mac/get_tool_mtime.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/mac/BUILD.gn
diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn
index 146744030c2e838f51fe3b71a9adc55c1e20f721..3ea247265aa12a25fbde0be8e3227653a02ad3da 100644
--- a/build/toolchain/mac/BUILD.gn
+++ b/build/toolchain/mac/BUILD.gn
@@ -59,8 +59,23 @@ template("mac_toolchain") {
cxx = invoker.cxx
ld = invoker.ld
+ # When implementing tools using Python scripts, a TOOL_VERSION=N env
brettw 2016/06/17 17:29:43 I just filed https://bugs.chromium.org/p/chromium/
Robert Sesek 2016/06/17 18:07:53 Done.
+ # 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 script's modification time to set 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.
+ get_tool_mtime = "get_tool_mtime.py"
+
linker_driver =
rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir)
+ linker_driver =
+ "TOOL_VERSION=" +
+ exec_script(get_tool_mtime, [ linker_driver ], "trim string") +
+ " $linker_driver"
# Make these apply to all tools below.
lib_switch = "-l"
@@ -136,7 +151,8 @@ 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}}"
+ tool_version = exec_script(get_tool_mtime, [ script ], "trim string")
sdefresne 2016/06/16 18:15:25 I'm not really sure about using exec_script becaus
Robert Sesek 2016/06/16 18:26:16 Right. I wrote that in both the comment above and
+ command = "rm -f {{output}} && TOOL_VERSION=$tool_version python $script libtool -static {{arflags}} -o {{output}} {{inputs}}"
description = "LIBTOOL-STATIC {{output}}"
outputs = [
"{{output_dir}}/{{target_output_name}}{{output_extension}}",
@@ -278,13 +294,16 @@ template("mac_toolchain") {
tool("copy_bundle_data") {
_tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py",
root_build_dir)
- command = "python $_tool {{source}} {{output}}"
+ _tool_version = exec_script(get_tool_mtime, [ _tool ], "trim string")
+ command =
+ "TOOL_VERSION=$_tool_version python $_tool {{source}} {{output}}"
description = "COPY_BUNDLE_DATA {{source}} {{output}}"
pool = ":bundle_pool($default_toolchain)"
}
tool("compile_xcassets") {
_tool = rebase_path("//build/toolchain/mac/compile_xcassets.py",
root_build_dir)
+ _tool_version = exec_script(get_tool_mtime, [ _tool ], "trim string")
brettw 2016/06/17 17:29:43 It looks like the shortest exec_script time I see
Robert Sesek 2016/06/17 18:07:53 Done. Some numbers for reference: Before this cha
if (is_ios) {
_sdk_name = ios_sdk_name
_min_deployment_target = ios_deployment_target
@@ -292,7 +311,7 @@ template("mac_toolchain") {
_sdk_name = mac_sdk_name
_min_deployment_target = mac_deployment_target
}
- command = "rm -f {{output}} && " +
+ command = "rm -f {{output}} && " + "TOOL_VERSION=$_tool_version " +
"python $_tool -p $_sdk_name -t $_min_deployment_target " +
"-o {{output}} {{inputs}}"
« no previous file with comments | « no previous file | build/toolchain/mac/get_tool_mtime.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698