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 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 parser.add_option('--package-name', | 71 parser.add_option('--package-name', |
72 help='Java package name for these resources.') | 72 help='Java package name for these resources.') |
73 parser.add_option('--android-manifest', help='Path to android manifest.') | 73 parser.add_option('--android-manifest', help='Path to android manifest.') |
74 | 74 |
75 # java library options | 75 # java library options |
76 parser.add_option('--jar-path', help='Path to target\'s jar output.') | 76 parser.add_option('--jar-path', help='Path to target\'s jar output.') |
77 parser.add_option('--supports-android', action='store_true', | 77 parser.add_option('--supports-android', action='store_true', |
78 help='Whether this library supports running on the Android platform.') | 78 help='Whether this library supports running on the Android platform.') |
79 parser.add_option('--requires-android', action='store_true', | 79 parser.add_option('--requires-android', action='store_true', |
80 help='Whether this library requires running on the Android platform.') | 80 help='Whether this library requires running on the Android platform.') |
| 81 parser.add_option('--bypass-platform-checks', action='store_true', |
| 82 help='Bypass checks for support/require Android platform.') |
81 | 83 |
82 # android library options | 84 # android library options |
83 parser.add_option('--dex-path', help='Path to target\'s dex output.') | 85 parser.add_option('--dex-path', help='Path to target\'s dex output.') |
84 | 86 |
85 # native library options | 87 # native library options |
86 parser.add_option('--native-libs', help='List of top-level native libs.') | 88 parser.add_option('--native-libs', help='List of top-level native libs.') |
87 parser.add_option('--readelf-path', help='Path to toolchain\'s readelf.') | 89 parser.add_option('--readelf-path', help='Path to toolchain\'s readelf.') |
88 | 90 |
89 options, args = parser.parse_args(argv) | 91 options, args = parser.parse_args(argv) |
90 | 92 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 'deps_info': { | 144 'deps_info': { |
143 'name': os.path.basename(options.build_config), | 145 'name': os.path.basename(options.build_config), |
144 'path': options.build_config, | 146 'path': options.build_config, |
145 'type': options.type, | 147 'type': options.type, |
146 'deps_configs': direct_deps_config_paths, | 148 'deps_configs': direct_deps_config_paths, |
147 } | 149 } |
148 } | 150 } |
149 deps_info = config['deps_info'] | 151 deps_info = config['deps_info'] |
150 | 152 |
151 | 153 |
152 if options.type == 'java_library': | 154 if options.type == 'java_library' and not options.bypass_platform_checks: |
153 deps_info['requires_android'] = options.requires_android | 155 deps_info['requires_android'] = options.requires_android |
154 deps_info['supports_android'] = options.supports_android | 156 deps_info['supports_android'] = options.supports_android |
155 | 157 |
156 deps_require_android = (all_resources_deps + | 158 deps_require_android = (all_resources_deps + |
157 [d['name'] for d in direct_library_deps if d['requires_android']]) | 159 [d['name'] for d in all_library_deps if d['requires_android']]) |
158 deps_not_support_android = ( | 160 deps_not_support_android = ( |
159 [d['name'] for d in direct_library_deps if not d['supports_android']]) | 161 [d['name'] for d in all_library_deps if not d['supports_android']]) |
160 | 162 |
161 if deps_require_android and not options.requires_android: | 163 if deps_require_android and not options.requires_android: |
162 raise Exception('Some deps require building for the Android platform: ' + | 164 raise Exception('Some deps require building for the Android platform: ' + |
163 str(deps_require_android)) | 165 str(deps_require_android)) |
164 | 166 |
165 if deps_not_support_android and options.supports_android: | 167 if deps_not_support_android and options.supports_android: |
166 raise Exception('Not all deps support the Android platform: ' + | 168 raise Exception('Not all deps support the Android platform: ' + |
167 str(deps_not_support_android)) | 169 str(deps_not_support_android)) |
168 | 170 |
169 | 171 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 252 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
251 | 253 |
252 if options.depfile: | 254 if options.depfile: |
253 build_utils.WriteDepfile( | 255 build_utils.WriteDepfile( |
254 options.depfile, | 256 options.depfile, |
255 all_deps_config_paths + build_utils.GetPythonDependencies()) | 257 all_deps_config_paths + build_utils.GetPythonDependencies()) |
256 | 258 |
257 | 259 |
258 if __name__ == '__main__': | 260 if __name__ == '__main__': |
259 sys.exit(main(sys.argv[1:])) | 261 sys.exit(main(sys.argv[1:])) |
OLD | NEW |