OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 # This file is meant to be included into an action to invoke grit in a | 5 # This file is meant to be included into an action to invoke grit in a |
6 # consistent manner. To use this the following variables need to be | 6 # consistent manner. To use this the following variables need to be |
7 # defined: | 7 # defined: |
8 # grit_grd_file: string: grd file path | 8 # grit_grd_file: string: grd file path |
9 # grit_out_dir: string: the output directory path | 9 # grit_out_dir: string: the output directory path |
10 | 10 |
11 # It would be really nice to do this with a rule instead of actions, but it | 11 # It would be really nice to do this with a rule instead of actions, but it |
12 # would need to determine inputs and outputs via grit_info on a per-file | 12 # would need to determine inputs and outputs via grit_info on a per-file |
13 # basis. GYP rules don't currently support that. They could be extended to | 13 # basis. GYP rules don't currently support that. They could be extended to |
14 # do this, but then every generator would need to be updated to handle this. | 14 # do this, but then every generator would need to be updated to handle this. |
15 | 15 |
16 { | 16 { |
17 'variables': { | 17 'variables': { |
18 'grit_cmd': ['python', '<(DEPTH)/tools/grit/grit.py'], | 18 'grit_cmd': ['python', '<(DEPTH)/tools/grit/grit.py'], |
19 'grit_resource_ids%': '<(DEPTH)/tools/gritsettings/resource_ids', | 19 'grit_resource_ids%': '<(DEPTH)/tools/gritsettings/resource_ids', |
20 # This makes it possible to add more defines in specific targets, | 20 # This makes it possible to add more defines in specific targets, |
21 # instead of build/common.gypi . | 21 # instead of build/common.gypi . |
22 'grit_additional_defines%': [], | 22 'grit_additional_defines%': [], |
23 'grit_rc_header_format%': [], | 23 'grit_rc_header_format%': [], |
| 24 |
| 25 'conditions': [ |
| 26 # These scripts can skip writing generated files if they are identical |
| 27 # to the already existing files, which avoids further build steps, like |
| 28 # recompilation. However, a dependency (earlier build step) having a |
| 29 # newer timestamp than an output (later build step) confuses some build |
| 30 # systems, so only use this on ninja, which explicitly supports this use |
| 31 # case (gyp turns all actions into ninja restat rules). |
| 32 ['"<(GENERATOR)"=="ninja"', { |
| 33 'write_only_new': '1', |
| 34 }, { |
| 35 'write_only_new': '0', |
| 36 }], |
| 37 ], |
24 }, | 38 }, |
25 'inputs': [ | 39 'inputs': [ |
26 '<!@pymod_do_main(grit_info <@(grit_defines) <@(grit_additional_defines) ' | 40 '<!@pymod_do_main(grit_info <@(grit_defines) <@(grit_additional_defines) ' |
27 '--inputs <(grit_grd_file) -f "<(grit_resource_ids)")', | 41 '--inputs <(grit_grd_file) -f "<(grit_resource_ids)")', |
28 ], | 42 ], |
29 'outputs': [ | 43 'outputs': [ |
30 '<!@pymod_do_main(grit_info <@(grit_defines) <@(grit_additional_defines) ' | 44 '<!@pymod_do_main(grit_info <@(grit_defines) <@(grit_additional_defines) ' |
31 '--outputs \'<(grit_out_dir)\' ' | 45 '--outputs \'<(grit_out_dir)\' ' |
32 '<(grit_grd_file) -f "<(grit_resource_ids)")', | 46 '<(grit_grd_file) -f "<(grit_resource_ids)")', |
33 ], | 47 ], |
34 'action': ['<@(grit_cmd)', | 48 'action': ['<@(grit_cmd)', |
35 '-i', '<(grit_grd_file)', 'build', | 49 '-i', '<(grit_grd_file)', 'build', |
36 '-f', '<(grit_resource_ids)', | 50 '-f', '<(grit_resource_ids)', |
37 '-o', '<(grit_out_dir)', | 51 '-o', '<(grit_out_dir)', |
| 52 '--write-only-new=<(write_only_new)', |
38 '<@(grit_defines)', | 53 '<@(grit_defines)', |
39 '<@(grit_additional_defines)', | 54 '<@(grit_additional_defines)', |
40 '<@(grit_rc_header_format)'], | 55 '<@(grit_rc_header_format)'], |
41 'message': 'Generating resources from <(grit_grd_file)', | 56 'message': 'Generating resources from <(grit_grd_file)', |
42 } | 57 } |
OLD | NEW |