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

Side by Side Diff: build/secondary/tools/grit/grit_rule.gni

Issue 544423002: Convert GN visibility variables to lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years, 3 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 | « build/secondary/third_party/nss/BUILD.gn ('k') | build/toolchain/win/midl.gni » ('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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 # Instantiate grit. This will produce a script target to run grit, and a 5 # Instantiate grit. This will produce a script target to run grit, and a
6 # static library that compiles the .cc files. 6 # static library that compiles the .cc files.
7 # 7 #
8 # Parameters 8 # Parameters
9 # 9 #
10 # source (required) 10 # source (required)
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 assert_files_flags += [ 251 assert_files_flags += [
252 "--assert-file-list=" + rebase_path(asserted_list_file, root_build_dir), 252 "--assert-file-list=" + rebase_path(asserted_list_file, root_build_dir),
253 ] 253 ]
254 grit_outputs = get_path_info( 254 grit_outputs = get_path_info(
255 rebase_path(invoker.outputs, ".", output_dir), 255 rebase_path(invoker.outputs, ".", output_dir),
256 "abspath") 256 "abspath")
257 257
258 # The config and the action below get this visibility son only the generated 258 # The config and the action below get this visibility son only the generated
259 # source set can depend on them. The variable "target_name" will get 259 # source set can depend on them. The variable "target_name" will get
260 # overwritten inside the inner classes so we need to compute it here. 260 # overwritten inside the inner classes so we need to compute it here.
261 target_visibility = ":$target_name" 261 target_visibility = [ ":$target_name" ]
262 262
263 # The current grit setup makes an file in $output_dir/grit/foo.h that 263 # The current grit setup makes an file in $output_dir/grit/foo.h that
264 # the source code expects to include via "grit/foo.h". It would be nice to 264 # the source code expects to include via "grit/foo.h". It would be nice to
265 # change this to including absolute paths relative to the root gen directory 265 # change this to including absolute paths relative to the root gen directory
266 # (like "mycomponent/foo.h"). This config sets up the include path. 266 # (like "mycomponent/foo.h"). This config sets up the include path.
267 grit_config = target_name + "_grit_config" 267 grit_config = target_name + "_grit_config"
268 config(grit_config) { 268 config(grit_config) {
269 if (!defined(invoker.use_qualified_include) || 269 if (!defined(invoker.use_qualified_include) ||
270 !invoker.use_qualified_include) { 270 !invoker.use_qualified_include) {
271 include_dirs = [ output_dir ] 271 include_dirs = [ output_dir ]
(...skipping 22 matching lines...) Expand all
294 294
295 # Add extra defines with -D flags. 295 # Add extra defines with -D flags.
296 if (defined(invoker.defines)) { 296 if (defined(invoker.defines)) {
297 foreach (i, invoker.defines) { 297 foreach (i, invoker.defines) {
298 args += [ "-D", i ] 298 args += [ "-D", i ]
299 } 299 }
300 } 300 }
301 301
302 args += grit_flags + assert_files_flags 302 args += grit_flags + assert_files_flags
303 303
304 visibility = target_visibility 304 if (defined(invoker.visibility)) {
305 # This needs to include both what the invoker specified (since they
306 # probably include generated headers from this target), as well as the
307 # generated source set (since there's no guarantee that the visibility
308 # specified by the invoker includes our target).
309 #
310 # Only define visibility at all if the invoker specified it. Otherwise,
311 # we want to keep the public "no visibility specified" default.
312 visibility = target_visibility + invoker.visibility
313 }
305 314
306 deps = [ "//tools/grit:grit_sources" ] 315 deps = [ "//tools/grit:grit_sources" ]
307 if (defined(invoker.deps)) { 316 if (defined(invoker.deps)) {
308 deps += invoker.deps 317 deps += invoker.deps
309 } 318 }
310 } 319 }
311 320
312 # This is the thing that people actually link with, it must be named the 321 # This is the thing that people actually link with, it must be named the
313 # same as the argument the template was invoked with. 322 # same as the argument the template was invoked with.
314 source_set(target_name) { 323 source_set(target_name) {
315 # Since we generate a file, we need to be run before the targets that 324 # Since we generate a file, we need to be run before the targets that
316 # depend on us. 325 # depend on us.
317 sources = grit_outputs 326 sources = grit_outputs
318 327
319 # Deps set on the template invocation will go on the grit script running 328 # Deps set on the template invocation will go on the grit script running
320 # target rather than this library. 329 # target rather than this library.
321 deps = [ ":$grit_custom_target" ] 330 deps = [ ":$grit_custom_target" ]
322 direct_dependent_configs = [ ":$grit_config" ] 331 direct_dependent_configs = [ ":$grit_config" ]
323 332
324 if (defined(invoker.visibility)) { 333 if (defined(invoker.visibility)) {
325 visibility = invoker.visibility 334 visibility = invoker.visibility
326 } 335 }
327 output_name = grit_output_name 336 output_name = grit_output_name
328 } 337 }
329 } 338 }
OLDNEW
« no previous file with comments | « build/secondary/third_party/nss/BUILD.gn ('k') | build/toolchain/win/midl.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698