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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | build/toolchain/mac/get_tool_mtime.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires 5 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires
6 # some enhancements since the commands on Mac are slightly different than on 6 # some enhancements since the commands on Mac are slightly different than on
7 # Linux. 7 # Linux.
8 8
9 import("../goma.gni") 9 import("../goma.gni")
10 import("//build/config/ios/ios_sdk.gni") 10 import("//build/config/ios/ios_sdk.gni")
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 # concurrent_links is picked up from the declare_arg(). 53 # concurrent_links is picked up from the declare_arg().
54 54
55 # We can't do string interpolation ($ in strings) on things with dots in 55 # We can't do string interpolation ($ in strings) on things with dots in
56 # them. To allow us to use $cc below, for example, we create copies of 56 # them. To allow us to use $cc below, for example, we create copies of
57 # these values in our scope. 57 # these values in our scope.
58 cc = invoker.cc 58 cc = invoker.cc
59 cxx = invoker.cxx 59 cxx = invoker.cxx
60 ld = invoker.ld 60 ld = invoker.ld
61 61
62 # 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.
63 # variable is placed in front of the command. The N should be incremented
64 # whenever the script is changed, so that the build system rebuilds all
65 # edges that utilize the script. Ideally this should be changed to use
66 # proper input-dirty checking, but that could be expensive. Instead, use a
67 # script to get the tool script's modification time to set as the version.
68 # This won't cause a re-generation of GN files when the tool script changes
69 # but it will cause edges to be marked as dirty if the ninja files are
70 # regenerated. See https://crbug.com/619083 for details.
71 get_tool_mtime = "get_tool_mtime.py"
72
62 linker_driver = 73 linker_driver =
63 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) 74 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir)
75 linker_driver =
76 "TOOL_VERSION=" +
77 exec_script(get_tool_mtime, [ linker_driver ], "trim string") +
78 " $linker_driver"
64 79
65 # Make these apply to all tools below. 80 # Make these apply to all tools below.
66 lib_switch = "-l" 81 lib_switch = "-l"
67 lib_dir_switch = "-L" 82 lib_dir_switch = "-L"
68 83
69 # Object files go in this directory. Use label_name instead of 84 # Object files go in this directory. Use label_name instead of
70 # target_output_name since labels will generally have no spaces and will be 85 # target_output_name since labels will generally have no spaces and will be
71 # unique in the directory. 86 # unique in the directory.
72 object_subdir = "{{target_out_dir}}/{{label_name}}" 87 object_subdir = "{{target_out_dir}}/{{label_name}}"
73 88
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 depsformat = "gcc" 144 depsformat = "gcc"
130 description = "OBJCXX {{output}}" 145 description = "OBJCXX {{output}}"
131 outputs = [ 146 outputs = [
132 "$object_subdir/{{source_name_part}}.o", 147 "$object_subdir/{{source_name_part}}.o",
133 ] 148 ]
134 } 149 }
135 150
136 tool("alink") { 151 tool("alink") {
137 script = 152 script =
138 rebase_path("//build/toolchain/mac/filter_libtool.py", root_build_dir) 153 rebase_path("//build/toolchain/mac/filter_libtool.py", root_build_dir)
139 command = "rm -f {{output}} && python $script libtool -static {{arflags}} -o {{output}} {{inputs}}" 154 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
155 command = "rm -f {{output}} && TOOL_VERSION=$tool_version python $script l ibtool -static {{arflags}} -o {{output}} {{inputs}}"
140 description = "LIBTOOL-STATIC {{output}}" 156 description = "LIBTOOL-STATIC {{output}}"
141 outputs = [ 157 outputs = [
142 "{{output_dir}}/{{target_output_name}}{{output_extension}}", 158 "{{output_dir}}/{{target_output_name}}{{output_extension}}",
143 ] 159 ]
144 default_output_dir = "{{target_out_dir}}" 160 default_output_dir = "{{target_out_dir}}"
145 default_output_extension = ".a" 161 default_output_extension = ".a"
146 output_prefix = "lib" 162 output_prefix = "lib"
147 } 163 }
148 164
149 tool("solink") { 165 tool("solink") {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 description = stamp_description 287 description = stamp_description
272 } 288 }
273 tool("copy") { 289 tool("copy") {
274 command = copy_command 290 command = copy_command
275 description = copy_description 291 description = copy_description
276 } 292 }
277 293
278 tool("copy_bundle_data") { 294 tool("copy_bundle_data") {
279 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py", 295 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py",
280 root_build_dir) 296 root_build_dir)
281 command = "python $_tool {{source}} {{output}}" 297 _tool_version = exec_script(get_tool_mtime, [ _tool ], "trim string")
298 command =
299 "TOOL_VERSION=$_tool_version python $_tool {{source}} {{output}}"
282 description = "COPY_BUNDLE_DATA {{source}} {{output}}" 300 description = "COPY_BUNDLE_DATA {{source}} {{output}}"
283 pool = ":bundle_pool($default_toolchain)" 301 pool = ":bundle_pool($default_toolchain)"
284 } 302 }
285 tool("compile_xcassets") { 303 tool("compile_xcassets") {
286 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", 304 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py",
287 root_build_dir) 305 root_build_dir)
306 _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
288 if (is_ios) { 307 if (is_ios) {
289 _sdk_name = ios_sdk_name 308 _sdk_name = ios_sdk_name
290 _min_deployment_target = ios_deployment_target 309 _min_deployment_target = ios_deployment_target
291 } else { 310 } else {
292 _sdk_name = mac_sdk_name 311 _sdk_name = mac_sdk_name
293 _min_deployment_target = mac_deployment_target 312 _min_deployment_target = mac_deployment_target
294 } 313 }
295 command = "rm -f {{output}} && " + 314 command = "rm -f {{output}} && " + "TOOL_VERSION=$_tool_version " +
296 "python $_tool -p $_sdk_name -t $_min_deployment_target " + 315 "python $_tool -p $_sdk_name -t $_min_deployment_target " +
297 "-o {{output}} {{inputs}}" 316 "-o {{output}} {{inputs}}"
298 317
299 description = "COMPILE_XCASSETS {{output}}" 318 description = "COMPILE_XCASSETS {{output}}"
300 pool = ":bundle_pool($default_toolchain)" 319 pool = ":bundle_pool($default_toolchain)"
301 } 320 }
302 321
303 toolchain_args() { 322 toolchain_args() {
304 current_cpu = invoker.toolchain_cpu 323 current_cpu = invoker.toolchain_cpu
305 current_os = invoker.toolchain_os 324 current_os = invoker.toolchain_os
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 409 }
391 410
392 mac_toolchain("x64") { 411 mac_toolchain("x64") {
393 toolchain_cpu = "x64" 412 toolchain_cpu = "x64"
394 toolchain_os = "mac" 413 toolchain_os = "mac"
395 cc = "${goma_prefix}/gcc" 414 cc = "${goma_prefix}/gcc"
396 cxx = "${goma_prefix}/g++" 415 cxx = "${goma_prefix}/g++"
397 ld = cxx 416 ld = cxx
398 is_clang = false 417 is_clang = false
399 } 418 }
OLDNEW
« 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