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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 # nativelibraries template should be moved out of content/ (to base/?). | 80 # nativelibraries template should be moved out of content/ (to base/?). |
81 # http://crbug.com/225101 | 81 # http://crbug.com/225101 |
82 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates
/NativeLibraries.template', | 82 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates
/NativeLibraries.template', |
83 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', | 83 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', |
84 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', | 84 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', |
85 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', | 85 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', |
86 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', | 86 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', |
87 'native_libraries_template_data_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', | 87 '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', | 88 'native_libraries_template_data_stamp': '<(intermediate_dir)/native_librarie
s_template_data.stamp', |
89 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 89 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
| 90 'instr_stamp': '<(intermediate_dir)/instr.stamp', |
90 'jar_stamp': '<(intermediate_dir)/jar.stamp', | 91 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | 92 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
92 'strip_stamp': '<(intermediate_dir)/strip.stamp', | 93 'strip_stamp': '<(intermediate_dir)/strip.stamp', |
93 'classes_dir': '<(intermediate_dir)/classes', | 94 'classes_dir': '<(intermediate_dir)/classes', |
| 95 'classes_final_dir': '<(intermediate_dir)/classes_instr', |
94 'javac_includes': [], | 96 'javac_includes': [], |
95 'jar_excluded_classes': [], | 97 'jar_excluded_classes': [], |
96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 98 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 99 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
98 'dex_path': '<(intermediate_dir)/classes.dex', | 100 'dex_path': '<(intermediate_dir)/classes.dex', |
| 101 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', |
99 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', | 102 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', |
100 'push_stamp': '<(intermediate_dir)/push.stamp', | 103 'push_stamp': '<(intermediate_dir)/push.stamp', |
101 'link_stamp': '<(intermediate_dir)/link.stamp', | 104 'link_stamp': '<(intermediate_dir)/link.stamp', |
102 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', | 105 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', |
103 'codegen_input_paths': [], | 106 'codegen_input_paths': [], |
104 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', | 107 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', |
105 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | 108 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
106 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', | 109 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', |
107 'source_dir': '<(java_in_dir)/src', | 110 'source_dir': '<(java_in_dir)/src', |
108 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', | 111 '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)', | 457 '--src-dirs=>(all_src_dirs)', |
455 '--javac-includes=<(javac_includes)', | 458 '--javac-includes=<(javac_includes)', |
456 '--chromium-code=<(chromium_code)', | 459 '--chromium-code=<(chromium_code)', |
457 '--stamp=<(compile_stamp)', | 460 '--stamp=<(compile_stamp)', |
458 | 461 |
459 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 462 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
460 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 463 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
461 ], | 464 ], |
462 }, | 465 }, |
463 { | 466 { |
| 467 'action_name': 'instr_classes_<(_target_name)', |
| 468 'message': 'Instrumenting <(_target_name) classes', |
| 469 'variables': { |
| 470 'conditions': [ |
| 471 ['emma_instrument != 0', { |
| 472 'instr_action': 'instrument_classes', |
| 473 'extra_instr_args': [ |
| 474 '--coverage-file=<(intermediate_dir)/coverage.em', |
| 475 '--sources-file=<(intermediate_dir)/emma_sources.txt', |
| 476 '--sources=<(java_in_dir)/src >(additional_src_dirs) >(generated_s
rc_dirs)', |
| 477 '--src-root=<(DEPTH)', |
| 478 '--sdk-root=<(android_sdk_root)', |
| 479 ] |
| 480 }, { |
| 481 'instr_action': 'copy', |
| 482 'extra_instr_args': [], |
| 483 }] |
| 484 ] |
| 485 }, |
| 486 'inputs': [ |
| 487 '<(compile_stamp)', |
| 488 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 489 '<(DEPTH)/build/android/gyp/instr.py', |
| 490 '<(DEPTH)/build/android/pylib/utils/command_option_parser.py', |
| 491 ], |
| 492 'outputs': [ |
| 493 '<(instr_stamp)', |
| 494 ], |
| 495 'action': [ |
| 496 'python', '<(DEPTH)/build/android/gyp/instr.py', |
| 497 '<(instr_action)', |
| 498 '--input-path=<(classes_dir)', |
| 499 '--output-path=<(classes_final_dir)', |
| 500 '--stamp=<(instr_stamp)', |
| 501 '<@(extra_instr_args)', |
| 502 ] |
| 503 }, |
| 504 { |
464 'action_name': 'jar_<(_target_name)', | 505 'action_name': 'jar_<(_target_name)', |
465 'message': 'Creating <(_target_name) jar', | 506 'message': 'Creating <(_target_name) jar', |
466 'inputs': [ | 507 'inputs': [ |
| 508 '<(instr_stamp)', |
467 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 509 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
468 '<(DEPTH)/build/android/gyp/util/md5_check.py', | 510 '<(DEPTH)/build/android/gyp/util/md5_check.py', |
469 '<(DEPTH)/build/android/gyp/jar.py', | 511 '<(DEPTH)/build/android/gyp/jar.py', |
470 '<(compile_stamp)', | |
471 ], | 512 ], |
472 'outputs': [ | 513 'outputs': [ |
473 '<(jar_stamp)', | 514 '<(jar_stamp)', |
474 ], | 515 ], |
475 'action': [ | 516 'action': [ |
476 'python', '<(DEPTH)/build/android/gyp/jar.py', | 517 'python', '<(DEPTH)/build/android/gyp/jar.py', |
477 '--classes-dir=<(classes_dir)', | 518 '--classes-dir=<(classes_final_dir)', |
478 '--jar-path=<(jar_path)', | 519 '--jar-path=<(jar_path)', |
479 '--excluded-classes=<(jar_excluded_classes)', | 520 '--excluded-classes=<(jar_excluded_classes)', |
480 '--stamp=<(jar_stamp)', | 521 '--stamp=<(jar_stamp)', |
481 | 522 |
482 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 523 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
483 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 524 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
484 ] | 525 ] |
485 }, | 526 }, |
486 { | 527 { |
487 'action_name': 'ant_obfuscate_<(_target_name)', | 528 'action_name': 'ant_obfuscate_<(_target_name)', |
488 'message': 'Obfuscating <(_target_name)', | 529 'message': 'Obfuscating <(_target_name)', |
489 'inputs': [ | 530 'inputs': [ |
490 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', | 531 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', |
491 '<(DEPTH)/build/android/ant/create-test-jar.js', | 532 '<(DEPTH)/build/android/ant/create-test-jar.js', |
492 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 533 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
493 '<(DEPTH)/build/android/gyp/ant.py', | 534 '<(DEPTH)/build/android/gyp/ant.py', |
494 '<(compile_stamp)', | 535 '<(instr_stamp)', |
495 '>@(proguard_flags_paths)', | 536 '>@(proguard_flags_paths)', |
496 ], | 537 ], |
497 'outputs': [ | 538 'outputs': [ |
498 '<(obfuscate_stamp)', | 539 '<(obfuscate_stamp)', |
499 ], | 540 ], |
500 'action': [ | 541 'action': [ |
501 'python', '<(DEPTH)/build/android/gyp/ant.py', | 542 'python', '<(DEPTH)/build/android/gyp/ant.py', |
502 '-quiet', | 543 '-quiet', |
503 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', | 544 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', |
504 '-DANDROID_SDK_JAR=<(android_sdk_jar)', | 545 '-DANDROID_SDK_JAR=<(android_sdk_jar)', |
(...skipping 24 matching lines...) Expand all Loading... |
529 ], | 570 ], |
530 }, | 571 }, |
531 { | 572 { |
532 'action_name': 'dex_<(_target_name)', | 573 'action_name': 'dex_<(_target_name)', |
533 'variables': { | 574 'variables': { |
534 'conditions': [ | 575 'conditions': [ |
535 ['proguard_enabled == "true"', { | 576 ['proguard_enabled == "true"', { |
536 'input_paths': [ '<(obfuscate_stamp)' ], | 577 'input_paths': [ '<(obfuscate_stamp)' ], |
537 'proguard_enabled_input_path': '<(obfuscated_jar_path)', | 578 'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
538 }], | 579 }], |
| 580 ['emma_instrument != 0', { |
| 581 'dex_input_paths': [ '<(emma_device_jar)' ], |
| 582 }], |
539 ], | 583 ], |
540 'input_paths': [ '<(compile_stamp)' ], | 584 'input_paths': [ '<(instr_stamp)' ], |
541 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], | 585 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], |
542 'dex_generated_input_dirs': [ '<(classes_dir)' ], | 586 'dex_generated_input_dirs': [ '<(classes_final_dir)' ], |
543 'output_path': '<(dex_path)', | 587 'output_path': '<(dex_path)', |
544 }, | 588 }, |
545 'includes': [ 'android/dex_action.gypi' ], | 589 'includes': [ 'android/dex_action.gypi' ], |
546 }, | 590 }, |
547 { | 591 { |
548 'action_name': 'ant package resources', | 592 'action_name': 'ant package resources', |
549 'message': 'Packaging resources for <(_target_name) APK.', | 593 'message': 'Packaging resources for <(_target_name) APK.', |
550 'inputs': [ | 594 'inputs': [ |
551 '<(DEPTH)/build/android/ant/apk-package-resources.xml', | 595 '<(DEPTH)/build/android/ant/apk-package-resources.xml', |
552 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 596 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 'action': [ | 659 'action': [ |
616 'python', '<(DEPTH)/build/android/gyp/ant.py', | 660 'python', '<(DEPTH)/build/android/gyp/ant.py', |
617 '-quiet', | 661 '-quiet', |
618 '-DANDROID_SDK_ROOT=<(android_sdk_root)', | 662 '-DANDROID_SDK_ROOT=<(android_sdk_root)', |
619 '-DAPK_NAME=<(apk_name)', | 663 '-DAPK_NAME=<(apk_name)', |
620 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', | 664 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', |
621 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', | 665 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', |
622 '-DOUT_DIR=<(intermediate_dir)', | 666 '-DOUT_DIR=<(intermediate_dir)', |
623 '-DSOURCE_DIR=<(source_dir)', | 667 '-DSOURCE_DIR=<(source_dir)', |
624 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', | 668 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', |
| 669 '-DEMMA_INSTRUMENT=<(emma_instrument)', |
625 | 670 |
626 '-Dbasedir=.', | 671 '-Dbasedir=.', |
627 '-buildfile', | 672 '-buildfile', |
628 '<(DEPTH)/build/android/ant/apk-package.xml', | 673 '<(DEPTH)/build/android/ant/apk-package.xml', |
629 | 674 |
630 # Add list of inputs to the command line, so if inputs change | 675 # 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. | 676 # (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. | 677 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
633 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 678 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
634 ] | 679 ] |
635 }, | 680 }, |
636 ], | 681 ], |
637 } | 682 } |
OLD | NEW |