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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 89 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
90 'jar_stamp': '<(intermediate_dir)/jar.stamp', | 90 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | 91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
92 'strip_stamp': '<(intermediate_dir)/strip.stamp', | 92 'strip_stamp': '<(intermediate_dir)/strip.stamp', |
93 'classes_dir': '<(intermediate_dir)/classes', | 93 'classes_dir': '<(intermediate_dir)/classes', |
94 'javac_includes': [], | 94 'javac_includes': [], |
95 'jar_excluded_classes': [], | 95 'jar_excluded_classes': [], |
96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
98 'dex_path': '<(intermediate_dir)/classes.dex', | 98 'dex_path': '<(intermediate_dir)/classes.dex', |
| 99 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', |
99 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', | 100 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', |
100 'push_stamp': '<(intermediate_dir)/push.stamp', | 101 'push_stamp': '<(intermediate_dir)/push.stamp', |
101 'link_stamp': '<(intermediate_dir)/link.stamp', | 102 'link_stamp': '<(intermediate_dir)/link.stamp', |
102 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', | 103 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', |
103 'codegen_input_paths': [], | 104 'codegen_input_paths': [], |
104 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', | 105 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', |
105 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | 106 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
106 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', | 107 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', |
107 'source_dir': '<(java_in_dir)/src', | 108 'source_dir': '<(java_in_dir)/src', |
108 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', | 109 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', |
(...skipping 14 matching lines...) Expand all Loading... |
123 ['gyp_managed_install == 1', { | 124 ['gyp_managed_install == 1', { |
124 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 125 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
125 }, { | 126 }, { |
126 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 127 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
127 }], | 128 }], |
128 ], | 129 ], |
129 }, | 130 }, |
130 'native_lib_target%': '', | 131 'native_lib_target%': '', |
131 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 132 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
132 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 133 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
| 134 'conditions': [ |
| 135 ['coverage == 1', { |
| 136 'classes_final_dir': '<(intermediate_dir)/classes_instr', |
| 137 }, { |
| 138 'classes_final_dir': '<(intermediate_dir)/classes', |
| 139 }] |
| 140 ] |
133 }, | 141 }, |
134 # Pass the jar path to the apk's "fake" jar target. This would be better as | 142 # Pass the jar path to the apk's "fake" jar target. This would be better as |
135 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 143 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
136 # cannot be lifted in a dependent to all_dependent_settings. | 144 # cannot be lifted in a dependent to all_dependent_settings. |
137 'all_dependent_settings': { | 145 'all_dependent_settings': { |
138 'variables': { | 146 'variables': { |
139 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 147 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
140 }, | 148 }, |
141 }, | 149 }, |
142 'conditions': [ | 150 'conditions': [ |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 'action': [ | 373 'action': [ |
366 'python', '<(DEPTH)/build/android/gyp/apk_install.py', | 374 'python', '<(DEPTH)/build/android/gyp/apk_install.py', |
367 '--android-sdk-tools=<(android_sdk_tools)', | 375 '--android-sdk-tools=<(android_sdk_tools)', |
368 '--apk-path=<(incomplete_apk_path)', | 376 '--apk-path=<(incomplete_apk_path)', |
369 '--build-device-configuration=<(build_device_config_path)', | 377 '--build-device-configuration=<(build_device_config_path)', |
370 '--install-record=<(apk_install_record)', | 378 '--install-record=<(apk_install_record)', |
371 ], | 379 ], |
372 }, | 380 }, |
373 ], | 381 ], |
374 }], | 382 }], |
| 383 ['coverage == 1', { |
| 384 'actions': [ |
| 385 { |
| 386 'action_name': 'emma_instr_<(_target_name)', |
| 387 'message': 'Instrumenting <(_target_name) classes', |
| 388 'inputs': [ |
| 389 '<(compile_stamp)', |
| 390 '<(DEPTH)/build/android/ant/apk-instr.xml', |
| 391 '<(DEPTH)/build/android/gyp/ant.py', |
| 392 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 393 ], |
| 394 'outputs': [ |
| 395 '<(intermediate_dir)/coverage.em', |
| 396 '<(classes_final_dir)', |
| 397 ], |
| 398 'action': [ |
| 399 'python', '<(DEPTH)/build/android/gyp/ant.py', |
| 400 '-DCLASSES_DIR=<(classes_dir)', |
| 401 '-DCLASSES_INSTR_DIR=<(classes_final_dir)', |
| 402 '-DEMMA_COVERAGE_FILE=<(intermediate_dir)/coverage.em', |
| 403 '-DANDROID_SDK_ROOT=<(android_sdk_root)', |
| 404 '-Dbasedir=.', |
| 405 '-buildfile', |
| 406 '<(DEPTH)/build/android/ant/apk-instr.xml', |
| 407 ] |
| 408 }, |
| 409 ], |
| 410 }], |
375 ], | 411 ], |
376 'actions': [ | 412 'actions': [ |
377 { | 413 { |
378 'action_name': 'ant_codegen_<(_target_name)', | 414 'action_name': 'ant_codegen_<(_target_name)', |
379 'message': 'Generating R.java for <(_target_name)', | 415 'message': 'Generating R.java for <(_target_name)', |
380 'conditions': [ | 416 'conditions': [ |
381 ['is_test_apk == 1', { | 417 ['is_test_apk == 1', { |
382 'variables': { | 418 'variables': { |
383 'additional_res_dirs=': [], | 419 'additional_res_dirs=': [], |
384 'additional_res_packages=': [], | 420 'additional_res_packages=': [], |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 '--chromium-code=<(chromium_code)', | 492 '--chromium-code=<(chromium_code)', |
457 '--stamp=<(compile_stamp)', | 493 '--stamp=<(compile_stamp)', |
458 | 494 |
459 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 495 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
460 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 496 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
461 ], | 497 ], |
462 }, | 498 }, |
463 { | 499 { |
464 'action_name': 'jar_<(_target_name)', | 500 'action_name': 'jar_<(_target_name)', |
465 'message': 'Creating <(_target_name) jar', | 501 'message': 'Creating <(_target_name) jar', |
| 502 'conditions': [ |
| 503 ['coverage == 1', { |
| 504 'inputs': [ '<(intermediate_dir)/coverage.em', ] |
| 505 }] |
| 506 ], |
466 'inputs': [ | 507 'inputs': [ |
467 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 508 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
468 '<(DEPTH)/build/android/gyp/util/md5_check.py', | 509 '<(DEPTH)/build/android/gyp/util/md5_check.py', |
469 '<(DEPTH)/build/android/gyp/jar.py', | 510 '<(DEPTH)/build/android/gyp/jar.py', |
470 '<(compile_stamp)', | |
471 ], | 511 ], |
472 'outputs': [ | 512 'outputs': [ |
473 '<(jar_stamp)', | 513 '<(jar_stamp)', |
474 ], | 514 ], |
475 'action': [ | 515 'action': [ |
476 'python', '<(DEPTH)/build/android/gyp/jar.py', | 516 'python', '<(DEPTH)/build/android/gyp/jar.py', |
477 '--classes-dir=<(classes_dir)', | 517 '--classes-dir=<(classes_final_dir)', |
478 '--jar-path=<(jar_path)', | 518 '--jar-path=<(jar_path)', |
479 '--excluded-classes=<(jar_excluded_classes)', | 519 '--excluded-classes=<(jar_excluded_classes)', |
480 '--stamp=<(jar_stamp)', | 520 '--stamp=<(jar_stamp)', |
481 | 521 |
482 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 522 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
483 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 523 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
484 ] | 524 ] |
485 }, | 525 }, |
486 { | 526 { |
487 'action_name': 'ant_obfuscate_<(_target_name)', | 527 'action_name': 'ant_obfuscate_<(_target_name)', |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 ], | 569 ], |
530 }, | 570 }, |
531 { | 571 { |
532 'action_name': 'dex_<(_target_name)', | 572 'action_name': 'dex_<(_target_name)', |
533 'variables': { | 573 'variables': { |
534 'conditions': [ | 574 'conditions': [ |
535 ['proguard_enabled == "true"', { | 575 ['proguard_enabled == "true"', { |
536 'input_paths': [ '<(obfuscate_stamp)' ], | 576 'input_paths': [ '<(obfuscate_stamp)' ], |
537 'proguard_enabled_input_path': '<(obfuscated_jar_path)', | 577 'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
538 }], | 578 }], |
| 579 ['coverage == 1', { |
| 580 'dex_input_paths': [ '<(emma_device_jar)' ], |
| 581 }], |
539 ], | 582 ], |
540 'input_paths': [ '<(compile_stamp)' ], | 583 'input_paths': [ '<(compile_stamp)', '<(classes_final_dir)' ], |
541 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], | 584 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], |
542 'dex_generated_input_dirs': [ '<(classes_dir)' ], | 585 'dex_generated_input_dirs': [ '<(classes_final_dir)' ], |
543 'output_path': '<(dex_path)', | 586 'output_path': '<(dex_path)', |
544 }, | 587 }, |
545 'includes': [ 'android/dex_action.gypi' ], | 588 'includes': [ 'android/dex_action.gypi' ], |
546 }, | 589 }, |
547 { | 590 { |
548 'action_name': 'ant package resources', | 591 'action_name': 'ant package resources', |
549 'message': 'Packaging resources for <(_target_name) APK.', | 592 'message': 'Packaging resources for <(_target_name) APK.', |
550 'inputs': [ | 593 'inputs': [ |
551 '<(DEPTH)/build/android/ant/apk-package-resources.xml', | 594 '<(DEPTH)/build/android/ant/apk-package-resources.xml', |
552 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 595 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 'action': [ | 658 'action': [ |
616 'python', '<(DEPTH)/build/android/gyp/ant.py', | 659 'python', '<(DEPTH)/build/android/gyp/ant.py', |
617 '-quiet', | 660 '-quiet', |
618 '-DANDROID_SDK_ROOT=<(android_sdk_root)', | 661 '-DANDROID_SDK_ROOT=<(android_sdk_root)', |
619 '-DAPK_NAME=<(apk_name)', | 662 '-DAPK_NAME=<(apk_name)', |
620 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', | 663 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', |
621 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', | 664 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', |
622 '-DOUT_DIR=<(intermediate_dir)', | 665 '-DOUT_DIR=<(intermediate_dir)', |
623 '-DSOURCE_DIR=<(source_dir)', | 666 '-DSOURCE_DIR=<(source_dir)', |
624 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', | 667 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', |
| 668 '-DCOVERAGE=<(coverage)', |
625 | 669 |
626 '-Dbasedir=.', | 670 '-Dbasedir=.', |
627 '-buildfile', | 671 '-buildfile', |
628 '<(DEPTH)/build/android/ant/apk-package.xml', | 672 '<(DEPTH)/build/android/ant/apk-package.xml', |
629 | 673 |
630 # Add list of inputs to the command line, so if inputs change | 674 # Add list of inputs to the command line, so if inputs change |
631 # (e.g. if a Java file is removed), the command will be re-run. | 675 # (e.g. if a Java file is removed), the command will be re-run. |
632 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 676 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
633 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 677 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
634 ] | 678 ] |
635 }, | 679 }, |
636 ], | 680 ], |
637 } | 681 } |
OLD | NEW |