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) |
11 # Path to .grd file. | 11 # Path to .grd file. |
12 # | 12 # |
13 # outputs (required) | 13 # outputs (required) |
14 # List of outputs from grit, relative to the target_gen_dir. If supplied, | 14 # List of outputs from grit, relative to the target_gen_dir. Grit will |
15 # a call to Grit to compute the outputs can be skipped which will make | 15 # verify at build time that this list is correct and will fail if there |
16 # GN run faster. Grit will verify at build time that this list is correct | 16 # is a mismatch between the outputs specified by the .grd file and the |
17 # and will fail if there is a mismatch between the outputs specified by | 17 # outputs list here. |
18 # the .grd file and the outputs list here. | |
19 # | 18 # |
20 # To get this list, you can look in the .grd file for | 19 # To get this list, you can look in the .grd file for |
21 # <output filename="..." and put those filename here. The base directory | 20 # <output filename="..." and put those filename here. The base directory |
22 # of the list in Grit and the output list specified in the GN grit target | 21 # of the list in Grit and the output list specified in the GN grit target |
23 # are the same (the target_gen_dir) so you can generally copy the names | 22 # are the same (the target_gen_dir) so you can generally copy the names |
24 # exactly. | 23 # exactly. |
25 # | 24 # |
26 # To get the list of outputs programatically, run: | 25 # To get the list of outputs programatically, run: |
27 # python tools/grit/grit_info.py --outputs . path/to/your.grd | 26 # python tools/grit/grit_info.py --outputs . path/to/your.grd |
28 # And strip the leading "./" from the output files. | 27 # And strip the leading "./" from the output files. |
(...skipping 14 matching lines...) Expand all Loading... |
43 # want to specify output_name if the target name is not particularly | 42 # want to specify output_name if the target name is not particularly |
44 # unique, since this can cause files from multiple grit targets to | 43 # unique, since this can cause files from multiple grit targets to |
45 # overwrite each other. | 44 # overwrite each other. |
46 # | 45 # |
47 # output_name (optiona) | 46 # output_name (optiona) |
48 # Provide an alternate base name for the generated files, like the .d | 47 # Provide an alternate base name for the generated files, like the .d |
49 # files. Normally these are based on the target name and go in the | 48 # files. Normally these are based on the target name and go in the |
50 # output_dir, but if multiple targets with the same name end up in | 49 # output_dir, but if multiple targets with the same name end up in |
51 # the same output_dir, they can collide. | 50 # the same output_dir, they can collide. |
52 # | 51 # |
| 52 # depfile_dir (optional) |
| 53 # If set, used to store the depfile and corresponding stamp file. |
| 54 # Defaults to output_dir |
| 55 # |
53 # use_qualified_include (optional) | 56 # use_qualified_include (optional) |
54 # If set, output_dir is not added to include_dirs. | 57 # If set, output_dir is not added to include_dirs. |
55 # | 58 # |
56 # configs (optional) | 59 # configs (optional) |
57 # List of additional configs to be applied to the generated target. | 60 # List of additional configs to be applied to the generated target. |
58 # deps (optional) | 61 # deps (optional) |
59 # inputs (optional) | 62 # inputs (optional) |
60 # List of additional files, required for grit to process source file. | 63 # List of additional files, required for grit to process source file. |
61 # visibility (optional) | 64 # visibility (optional) |
62 # Normal meaning. | 65 # Normal meaning. |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } else { | 327 } else { |
325 output_dir = target_gen_dir | 328 output_dir = target_gen_dir |
326 } | 329 } |
327 | 330 |
328 if (defined(invoker.output_name)) { | 331 if (defined(invoker.output_name)) { |
329 grit_output_name = invoker.output_name | 332 grit_output_name = invoker.output_name |
330 } else { | 333 } else { |
331 grit_output_name = target_name | 334 grit_output_name = target_name |
332 } | 335 } |
333 | 336 |
| 337 if (defined(invoker.depfile_dir)) { |
| 338 depfile_dir = invoker.depfile_dir |
| 339 } else { |
| 340 depfile_dir = output_dir |
| 341 } |
| 342 |
334 # These are all passed as arguments to the script so have to be relative to | 343 # These are all passed as arguments to the script so have to be relative to |
335 # the build directory. | 344 # the build directory. |
336 if (resource_ids != "") { | 345 if (resource_ids != "") { |
337 resource_ids = rebase_path(resource_ids, root_build_dir) | 346 resource_ids = rebase_path(resource_ids, root_build_dir) |
338 } | 347 } |
339 rebased_output_dir = rebase_path(output_dir, root_build_dir) | 348 rebased_output_dir = rebase_path(output_dir, root_build_dir) |
340 source_path = rebase_path(invoker.source, root_build_dir) | 349 source_path = rebase_path(invoker.source, root_build_dir) |
341 | 350 |
342 if (defined(invoker.grit_flags)) { | 351 if (defined(invoker.grit_flags)) { |
343 grit_flags = invoker.grit_flags | 352 grit_flags = invoker.grit_flags |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 include_dirs = [ output_dir ] | 385 include_dirs = [ output_dir ] |
377 } | 386 } |
378 visibility = target_visibility | 387 visibility = target_visibility |
379 } | 388 } |
380 | 389 |
381 grit_custom_target = target_name + "_grit" | 390 grit_custom_target = target_name + "_grit" |
382 action(grit_custom_target) { | 391 action(grit_custom_target) { |
383 script = "//tools/grit/grit.py" | 392 script = "//tools/grit/grit.py" |
384 inputs = grit_inputs | 393 inputs = grit_inputs |
385 | 394 |
386 depfile = "$output_dir/${grit_output_name}_stamp.d" | 395 depfile = "$depfile_dir/${grit_output_name}_stamp.d" |
387 outputs = [ "${depfile}.stamp" ] + grit_outputs | 396 outputs = [ "${depfile}.stamp" ] + grit_outputs |
388 | 397 |
389 args = [ | 398 args = [ |
390 "-i", | 399 "-i", |
391 source_path, | 400 source_path, |
392 "build", | 401 "build", |
393 ] | 402 ] |
394 if (resource_ids != "") { | 403 if (resource_ids != "") { |
395 args += [ | 404 args += [ |
396 "-f", | 405 "-f", |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 if (defined(invoker.configs)) { | 474 if (defined(invoker.configs)) { |
466 configs += invoker.configs | 475 configs += invoker.configs |
467 } | 476 } |
468 | 477 |
469 if (defined(invoker.visibility)) { | 478 if (defined(invoker.visibility)) { |
470 visibility = invoker.visibility | 479 visibility = invoker.visibility |
471 } | 480 } |
472 output_name = grit_output_name | 481 output_name = grit_output_name |
473 } | 482 } |
474 } | 483 } |
OLD | NEW |