| OLD | NEW |
| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 assert(defined(invoker.source), | 306 assert(defined(invoker.source), |
| 307 "\"source\" must be defined for the grit template $target_name") | 307 "\"source\" must be defined for the grit template $target_name") |
| 308 | 308 |
| 309 grit_inputs = [ invoker.source ] | 309 grit_inputs = [ invoker.source ] |
| 310 | 310 |
| 311 if (defined(invoker.resource_ids)) { | 311 if (defined(invoker.resource_ids)) { |
| 312 resource_ids = invoker.resource_ids | 312 resource_ids = invoker.resource_ids |
| 313 } else { | 313 } else { |
| 314 resource_ids = grit_resource_id_file | 314 resource_ids = grit_resource_id_file |
| 315 } | 315 } |
| 316 grit_inputs += [ resource_ids ] # Script depends on ID file. | 316 if (resource_ids != "") { |
| 317 # The script depends on the ID file. Only add this dependency if the ID |
| 318 # file is specified. |
| 319 grit_inputs += [ resource_ids ] |
| 320 } |
| 317 | 321 |
| 318 if (defined(invoker.output_dir)) { | 322 if (defined(invoker.output_dir)) { |
| 319 output_dir = invoker.output_dir | 323 output_dir = invoker.output_dir |
| 320 } else { | 324 } else { |
| 321 output_dir = target_gen_dir | 325 output_dir = target_gen_dir |
| 322 } | 326 } |
| 323 | 327 |
| 324 if (defined(invoker.output_name)) { | 328 if (defined(invoker.output_name)) { |
| 325 grit_output_name = invoker.output_name | 329 grit_output_name = invoker.output_name |
| 326 } else { | 330 } else { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 } | 442 } |
| 439 } | 443 } |
| 440 | 444 |
| 441 # This is the thing that people actually link with, it must be named the | 445 # This is the thing that people actually link with, it must be named the |
| 442 # same as the argument the template was invoked with. | 446 # same as the argument the template was invoked with. |
| 443 source_set(target_name) { | 447 source_set(target_name) { |
| 444 # Since we generate a file, we need to be run before the targets that | 448 # Since we generate a file, we need to be run before the targets that |
| 445 # depend on us. | 449 # depend on us. |
| 446 sources = grit_outputs | 450 sources = grit_outputs |
| 447 | 451 |
| 448 # Deps set on the template invocation will go on the grit script running | 452 # Deps set on the template invocation will go on the action that runs |
| 449 # target rather than this library. | 453 # grit above rather than this library. This target needs to depend on the |
| 450 deps = [ | 454 # action publicly so other scripts can take the outputs from the grit |
| 455 # script as inputs. |
| 456 public_deps = [ |
| 451 ":$grit_custom_target", | 457 ":$grit_custom_target", |
| 452 ] | 458 ] |
| 453 public_configs = [ ":$grit_config" ] | 459 public_configs = [ ":$grit_config" ] |
| 454 | 460 |
| 455 if (defined(invoker.public_configs)) { | 461 if (defined(invoker.public_configs)) { |
| 456 public_configs += invoker.public_configs | 462 public_configs += invoker.public_configs |
| 457 } | 463 } |
| 458 | 464 |
| 459 if (defined(invoker.configs)) { | 465 if (defined(invoker.configs)) { |
| 460 configs += invoker.configs | 466 configs += invoker.configs |
| 461 } | 467 } |
| 462 | 468 |
| 463 if (defined(invoker.visibility)) { | 469 if (defined(invoker.visibility)) { |
| 464 visibility = invoker.visibility | 470 visibility = invoker.visibility |
| 465 } | 471 } |
| 466 output_name = grit_output_name | 472 output_name = grit_output_name |
| 467 } | 473 } |
| 468 } | 474 } |
| OLD | NEW |