OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Writes a build_config file. | 7 """Writes a build_config file. |
8 | 8 |
9 The build_config file for a target is a json file containing information about | 9 The build_config file for a target is a json file containing information about |
10 how to build that target based on the target's dependencies. This includes | 10 how to build that target based on the target's dependencies. This includes |
11 things like: the javac classpath, the list of android resources dependencies, | 11 things like: the javac classpath, the list of android resources dependencies, |
12 etc. It also includes the information needed to create the build_config for | 12 etc. It also includes the information needed to create the build_config for |
13 other targets that depend on that one. | 13 other targets that depend on that one. |
14 | 14 |
15 There are several different types of build_configs: | 15 There are several different types of build_configs: |
16 android_library: An android library containing java code. | 16 android_library: An android library containing java code. |
17 android_resources: A target containing android resources. | 17 android_resources: A target containing android resources. |
18 | 18 |
19 Android build scripts should not refer to the build_config directly, and the | 19 Android build scripts should not refer to the build_config directly, and the |
20 build specification should instead pass information in using the special | 20 build specification should instead pass information in using the special |
21 file-arg syntax (see build_utils.py:ExpandFileArgs). That syntax allows passing | 21 file-arg syntax (see build_utils.py:ExpandFileArgs). That syntax allows passing |
22 of values in a json dict in a file and looks like this: | 22 of values in a json dict in a file and looks like this: |
23 --python-arg=@(build_config_path:javac:classpath) | 23 --python-arg=@FileArg(build_config_path:javac:classpath) |
24 | 24 |
25 Note: If paths to input files are passed in this way, it is important that: | 25 Note: If paths to input files are passed in this way, it is important that: |
26 1. inputs/deps of the action ensure that the files are available the first | 26 1. inputs/deps of the action ensure that the files are available the first |
27 time the action runs. | 27 time the action runs. |
28 2. Either (a) or (b) | 28 2. Either (a) or (b) |
29 a. inputs/deps ensure that the action runs whenever one of the files changes | 29 a. inputs/deps ensure that the action runs whenever one of the files changes |
30 b. the files are added to the action's depfile | 30 b. the files are added to the action's depfile |
31 """ | 31 """ |
32 | 32 |
33 import optparse | 33 import optparse |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 139 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
140 | 140 |
141 if options.depfile: | 141 if options.depfile: |
142 build_utils.WriteDepfile( | 142 build_utils.WriteDepfile( |
143 options.depfile, | 143 options.depfile, |
144 all_deps_config_paths + build_utils.GetPythonDependencies()) | 144 all_deps_config_paths + build_utils.GetPythonDependencies()) |
145 | 145 |
146 | 146 |
147 if __name__ == '__main__': | 147 if __name__ == '__main__': |
148 sys.exit(main(sys.argv[1:])) | 148 sys.exit(main(sys.argv[1:])) |
OLD | NEW |