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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 def _FilterUnwantedDepsPaths(dep_paths, target_type): | 170 def _FilterUnwantedDepsPaths(dep_paths, target_type): |
171 # Don't allow root targets to be considered as a dep. | 171 # Don't allow root targets to be considered as a dep. |
172 ret = [p for p in dep_paths if GetDepConfig(p)['type'] not in _ROOT_TYPES] | 172 ret = [p for p in dep_paths if GetDepConfig(p)['type'] not in _ROOT_TYPES] |
173 | 173 |
174 # Don't allow java libraries to cross through assets/resources. | 174 # Don't allow java libraries to cross through assets/resources. |
175 if target_type in _RESOURCE_TYPES: | 175 if target_type in _RESOURCE_TYPES: |
176 ret = [p for p in ret if GetDepConfig(p)['type'] in _RESOURCE_TYPES] | 176 ret = [p for p in ret if GetDepConfig(p)['type'] in _RESOURCE_TYPES] |
177 return ret | 177 return ret |
178 | 178 |
179 | 179 |
| 180 def _AsInterfaceJar(jar_path): |
| 181 return jar_path[:-3] + 'interface.jar' |
| 182 |
| 183 |
180 def main(argv): | 184 def main(argv): |
181 parser = optparse.OptionParser() | 185 parser = optparse.OptionParser() |
182 build_utils.AddDepfileOption(parser) | 186 build_utils.AddDepfileOption(parser) |
183 parser.add_option('--build-config', help='Path to build_config output.') | 187 parser.add_option('--build-config', help='Path to build_config output.') |
184 parser.add_option( | 188 parser.add_option( |
185 '--type', | 189 '--type', |
186 help='Type of this target (e.g. android_library).') | 190 help='Type of this target (e.g. android_library).') |
187 parser.add_option( | 191 parser.add_option( |
188 '--possible-deps-configs', | 192 '--possible-deps-configs', |
189 help='List of paths for dependency\'s build_config files. Some ' | 193 help='List of paths for dependency\'s build_config files. Some ' |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 ' apks if it\'s enabled for the tested apk') | 462 ' apks if it\'s enabled for the tested apk') |
459 | 463 |
460 # Dependencies for the final dex file of an apk or a 'deps_dex'. | 464 # Dependencies for the final dex file of an apk or a 'deps_dex'. |
461 if options.type in ['android_apk', 'deps_dex']: | 465 if options.type in ['android_apk', 'deps_dex']: |
462 config['final_dex'] = {} | 466 config['final_dex'] = {} |
463 dex_config = config['final_dex'] | 467 dex_config = config['final_dex'] |
464 dex_config['dependency_dex_files'] = deps_dex_files | 468 dex_config['dependency_dex_files'] = deps_dex_files |
465 | 469 |
466 if options.type in ('java_binary', 'java_library', 'android_apk'): | 470 if options.type in ('java_binary', 'java_library', 'android_apk'): |
467 config['javac']['classpath'] = javac_classpath | 471 config['javac']['classpath'] = javac_classpath |
| 472 config['javac']['interface_classpath'] = [ |
| 473 _AsInterfaceJar(p) for p in javac_classpath] |
468 config['java'] = { | 474 config['java'] = { |
469 'full_classpath': java_full_classpath | 475 'full_classpath': java_full_classpath |
470 } | 476 } |
471 | 477 |
472 if options.type == 'android_apk': | 478 if options.type == 'android_apk': |
| 479 dependency_jars = [c['jar_path'] for c in all_library_deps] |
| 480 all_interface_jars = [ |
| 481 _AsInterfaceJar(p) for p in dependency_jars + [options.jar_path]] |
473 config['dist_jar'] = { | 482 config['dist_jar'] = { |
474 'dependency_jars': [ | 483 'dependency_jars': dependency_jars, |
475 c['jar_path'] for c in all_library_deps | 484 'all_interface_jars': all_interface_jars, |
476 ] | |
477 } | 485 } |
478 manifest = AndroidManifest(options.android_manifest) | 486 manifest = AndroidManifest(options.android_manifest) |
479 deps_info['package_name'] = manifest.GetPackageName() | 487 deps_info['package_name'] = manifest.GetPackageName() |
480 if not options.tested_apk_config and manifest.GetInstrumentation(): | 488 if not options.tested_apk_config and manifest.GetInstrumentation(): |
481 # This must then have instrumentation only for itself. | 489 # This must then have instrumentation only for itself. |
482 manifest.CheckInstrumentation(manifest.GetPackageName()) | 490 manifest.CheckInstrumentation(manifest.GetPackageName()) |
483 | 491 |
484 library_paths = [] | 492 library_paths = [] |
485 java_libraries_list_holder = [None] | 493 java_libraries_list_holder = [None] |
486 libraries = build_utils.ParseGypList(options.native_libs or '[]') | 494 libraries = build_utils.ParseGypList(options.native_libs or '[]') |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 _MergeAssets(deps.All('android_assets'))) | 529 _MergeAssets(deps.All('android_assets'))) |
522 | 530 |
523 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 531 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
524 | 532 |
525 if options.depfile: | 533 if options.depfile: |
526 build_utils.WriteDepfile(options.depfile, all_inputs) | 534 build_utils.WriteDepfile(options.depfile, all_inputs) |
527 | 535 |
528 | 536 |
529 if __name__ == '__main__': | 537 if __name__ == '__main__': |
530 sys.exit(main(sys.argv[1:])) | 538 sys.exit(main(sys.argv[1:])) |
OLD | NEW |