OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
6 # to build Android APKs in a consistent manner. | 6 # to build Android APKs in a consistent manner. |
7 # | 7 # |
8 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
9 # { | 9 # { |
10 # 'target_name': 'my_package_apk', | 10 # 'target_name': 'my_package_apk', |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 'app_manifest_version_code%': '<(android_app_version_code)', | 60 'app_manifest_version_code%': '<(android_app_version_code)', |
61 'proguard_enabled%': 'false', | 61 'proguard_enabled%': 'false', |
62 'proguard_flags_paths%': ['<(DEPTH)/build/android/empty_proguard.flags'], | 62 'proguard_flags_paths%': ['<(DEPTH)/build/android/empty_proguard.flags'], |
63 'jar_name': 'chromium_apk_<(_target_name).jar', | 63 'jar_name': 'chromium_apk_<(_target_name).jar', |
64 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', | 64 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', |
65 'R_package%':'', | 65 'R_package%':'', |
66 'additional_R_text_files': [], | 66 'additional_R_text_files': [], |
67 'additional_res_dirs': [], | 67 'additional_res_dirs': [], |
68 'additional_res_packages': [], | 68 'additional_res_packages': [], |
69 'is_test_apk%': 0, | 69 'is_test_apk%': 0, |
| 70 'emma_instrument%': 0, |
70 'java_strings_grd%': '', | 71 'java_strings_grd%': '', |
71 'library_manifest_paths' : [], | 72 'library_manifest_paths' : [], |
72 'resource_input_paths': [], | 73 'resource_input_paths': [], |
73 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', | 74 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', |
74 'asset_location%': '<(intermediate_dir)/assets', | 75 'asset_location%': '<(intermediate_dir)/assets', |
75 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', | 76 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', |
76 'compile_input_paths': [], | 77 'compile_input_paths': [], |
77 'package_input_paths': [], | 78 'package_input_paths': [], |
78 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', | 79 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', |
79 # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and | 80 # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and |
80 # nativelibraries template should be moved out of content/ (to base/?). | 81 # nativelibraries template should be moved out of content/ (to base/?). |
81 # http://crbug.com/225101 | 82 # http://crbug.com/225101 |
82 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates
/NativeLibraries.template', | 83 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates
/NativeLibraries.template', |
83 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', | 84 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', |
84 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', | 85 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', |
85 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', | 86 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', |
86 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', | 87 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', |
87 'native_libraries_template_data_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', | 88 'native_libraries_template_data_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', |
88 'native_libraries_template_data_stamp': '<(intermediate_dir)/native_librarie
s_template_data.stamp', | 89 'native_libraries_template_data_stamp': '<(intermediate_dir)/native_librarie
s_template_data.stamp', |
89 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 90 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
| 91 'instr_stamp': '<(intermediate_dir)/instr.stamp', |
90 'jar_stamp': '<(intermediate_dir)/jar.stamp', | 92 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | 93 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
92 'strip_stamp': '<(intermediate_dir)/strip.stamp', | 94 'strip_stamp': '<(intermediate_dir)/strip.stamp', |
93 'classes_dir': '<(intermediate_dir)/classes', | 95 'classes_dir': '<(intermediate_dir)/classes', |
| 96 'classes_final_dir': '<(intermediate_dir)/classes_instr', |
94 'javac_includes': [], | 97 'javac_includes': [], |
95 'jar_excluded_classes': [], | 98 'jar_excluded_classes': [], |
96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 99 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 100 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
98 'dex_path': '<(intermediate_dir)/classes.dex', | 101 'dex_path': '<(intermediate_dir)/classes.dex', |
| 102 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', |
99 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', | 103 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', |
100 'push_stamp': '<(intermediate_dir)/push.stamp', | 104 'push_stamp': '<(intermediate_dir)/push.stamp', |
101 'link_stamp': '<(intermediate_dir)/link.stamp', | 105 'link_stamp': '<(intermediate_dir)/link.stamp', |
102 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', | 106 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', |
103 'codegen_input_paths': [], | 107 'codegen_input_paths': [], |
104 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', | 108 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', |
105 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | 109 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
106 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', | 110 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', |
107 'source_dir': '<(java_in_dir)/src', | 111 'source_dir': '<(java_in_dir)/src', |
108 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', | 112 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 '--src-dirs=>(all_src_dirs)', | 458 '--src-dirs=>(all_src_dirs)', |
455 '--javac-includes=<(javac_includes)', | 459 '--javac-includes=<(javac_includes)', |
456 '--chromium-code=<(chromium_code)', | 460 '--chromium-code=<(chromium_code)', |
457 '--stamp=<(compile_stamp)', | 461 '--stamp=<(compile_stamp)', |
458 | 462 |
459 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 463 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
460 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 464 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
461 ], | 465 ], |
462 }, | 466 }, |
463 { | 467 { |
| 468 'action_name': 'instr_classes_<(_target_name)', |
| 469 'message': 'Instrumenting <(_target_name) classes', |
| 470 'variables': { |
| 471 'input_path': '<(classes_dir)', |
| 472 'output_path': '<(classes_final_dir)', |
| 473 'stamp_path': '<(instr_stamp)', |
| 474 'instr_type': 'classes', |
| 475 }, |
| 476 'outputs': [ |
| 477 '<(instr_stamp)', |
| 478 ], |
| 479 'inputs': [ |
| 480 '<(compile_stamp)', |
| 481 ], |
| 482 'includes': [ 'android/instr_action.gypi' ], |
| 483 }, |
| 484 { |
464 'action_name': 'jar_<(_target_name)', | 485 'action_name': 'jar_<(_target_name)', |
465 'message': 'Creating <(_target_name) jar', | 486 'message': 'Creating <(_target_name) jar', |
466 'inputs': [ | 487 'inputs': [ |
| 488 '<(instr_stamp)', |
467 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 489 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
468 '<(DEPTH)/build/android/gyp/util/md5_check.py', | 490 '<(DEPTH)/build/android/gyp/util/md5_check.py', |
469 '<(DEPTH)/build/android/gyp/jar.py', | 491 '<(DEPTH)/build/android/gyp/jar.py', |
470 '<(compile_stamp)', | |
471 ], | 492 ], |
472 'outputs': [ | 493 'outputs': [ |
473 '<(jar_stamp)', | 494 '<(jar_stamp)', |
474 ], | 495 ], |
475 'action': [ | 496 'action': [ |
476 'python', '<(DEPTH)/build/android/gyp/jar.py', | 497 'python', '<(DEPTH)/build/android/gyp/jar.py', |
477 '--classes-dir=<(classes_dir)', | 498 '--classes-dir=<(classes_final_dir)', |
478 '--jar-path=<(jar_path)', | 499 '--jar-path=<(jar_path)', |
479 '--excluded-classes=<(jar_excluded_classes)', | 500 '--excluded-classes=<(jar_excluded_classes)', |
480 '--stamp=<(jar_stamp)', | 501 '--stamp=<(jar_stamp)', |
481 | 502 |
482 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 503 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
483 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 504 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
484 ] | 505 ] |
485 }, | 506 }, |
486 { | 507 { |
487 'action_name': 'ant_obfuscate_<(_target_name)', | 508 'action_name': 'ant_obfuscate_<(_target_name)', |
488 'message': 'Obfuscating <(_target_name)', | 509 'message': 'Obfuscating <(_target_name)', |
489 'inputs': [ | 510 'inputs': [ |
490 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', | 511 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', |
491 '<(DEPTH)/build/android/ant/create-test-jar.js', | 512 '<(DEPTH)/build/android/ant/create-test-jar.js', |
492 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 513 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
493 '<(DEPTH)/build/android/gyp/ant.py', | 514 '<(DEPTH)/build/android/gyp/ant.py', |
494 '<(compile_stamp)', | 515 '<(instr_stamp)', |
495 '>@(proguard_flags_paths)', | 516 '>@(proguard_flags_paths)', |
496 ], | 517 ], |
497 'outputs': [ | 518 'outputs': [ |
498 '<(obfuscate_stamp)', | 519 '<(obfuscate_stamp)', |
499 ], | 520 ], |
500 'action': [ | 521 'action': [ |
501 'python', '<(DEPTH)/build/android/gyp/ant.py', | 522 'python', '<(DEPTH)/build/android/gyp/ant.py', |
502 '-quiet', | 523 '-quiet', |
503 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', | 524 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', |
504 '-DANDROID_SDK_JAR=<(android_sdk_jar)', | 525 '-DANDROID_SDK_JAR=<(android_sdk_jar)', |
(...skipping 25 matching lines...) Expand all Loading... |
530 ], | 551 ], |
531 }, | 552 }, |
532 { | 553 { |
533 'action_name': 'dex_<(_target_name)', | 554 'action_name': 'dex_<(_target_name)', |
534 'variables': { | 555 'variables': { |
535 'conditions': [ | 556 'conditions': [ |
536 ['proguard_enabled == "true"', { | 557 ['proguard_enabled == "true"', { |
537 'input_paths': [ '<(obfuscate_stamp)' ], | 558 'input_paths': [ '<(obfuscate_stamp)' ], |
538 'proguard_enabled_input_path': '<(obfuscated_jar_path)', | 559 'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
539 }], | 560 }], |
| 561 ['emma_instrument != 0', { |
| 562 'dex_input_paths': [ '<(emma_device_jar)' ], |
| 563 }], |
540 ], | 564 ], |
541 'input_paths': [ '<(compile_stamp)' ], | 565 'input_paths': [ '<(instr_stamp)' ], |
542 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], | 566 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], |
543 'dex_generated_input_dirs': [ '<(classes_dir)' ], | 567 'dex_generated_input_dirs': [ '<(classes_final_dir)' ], |
544 'output_path': '<(dex_path)', | 568 'output_path': '<(dex_path)', |
545 }, | 569 }, |
546 'includes': [ 'android/dex_action.gypi' ], | 570 'includes': [ 'android/dex_action.gypi' ], |
547 }, | 571 }, |
548 { | 572 { |
549 'action_name': 'ant package resources', | 573 'action_name': 'ant package resources', |
550 'message': 'Packaging resources for <(_target_name) APK.', | 574 'message': 'Packaging resources for <(_target_name) APK.', |
551 'inputs': [ | 575 'inputs': [ |
552 '<(DEPTH)/build/android/ant/apk-package-resources.xml', | 576 '<(DEPTH)/build/android/ant/apk-package-resources.xml', |
553 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 577 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 'python', '<(DEPTH)/build/android/gyp/ant.py', | 642 'python', '<(DEPTH)/build/android/gyp/ant.py', |
619 '-quiet', | 643 '-quiet', |
620 '-DANDROID_SDK_ROOT=<(android_sdk_root)', | 644 '-DANDROID_SDK_ROOT=<(android_sdk_root)', |
621 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', | 645 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', |
622 '-DAPK_NAME=<(apk_name)', | 646 '-DAPK_NAME=<(apk_name)', |
623 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', | 647 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', |
624 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', | 648 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', |
625 '-DOUT_DIR=<(intermediate_dir)', | 649 '-DOUT_DIR=<(intermediate_dir)', |
626 '-DSOURCE_DIR=<(source_dir)', | 650 '-DSOURCE_DIR=<(source_dir)', |
627 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', | 651 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', |
| 652 '-DEMMA_INSTRUMENT=<(emma_instrument)', |
628 | 653 |
629 '-Dbasedir=.', | 654 '-Dbasedir=.', |
630 '-buildfile', | 655 '-buildfile', |
631 '<(DEPTH)/build/android/ant/apk-package.xml', | 656 '<(DEPTH)/build/android/ant/apk-package.xml', |
632 | 657 |
633 # Add list of inputs to the command line, so if inputs change | 658 # Add list of inputs to the command line, so if inputs change |
634 # (e.g. if a Java file is removed), the command will be re-run. | 659 # (e.g. if a Java file is removed), the command will be re-run. |
635 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 660 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
636 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 661 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
637 ] | 662 ] |
638 }, | 663 }, |
639 ], | 664 ], |
640 } | 665 } |
OLD | NEW |