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 ] |
| 478 }, { |
| 479 'instr_action': 'copy', |
| 480 'extra_instr_args': [], |
| 481 }] |
| 482 ] |
| 483 }, |
| 484 'inputs': [ |
| 485 '<(compile_stamp)', |
| 486 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 487 '<(DEPTH)/build/android/gyp/instr.py', |
| 488 ], |
| 489 'outputs': [ |
| 490 '<(instr_stamp)', |
| 491 ], |
| 492 'action': [ |
| 493 'python', '<(DEPTH)/build/android/gyp/instr.py', |
| 494 '<(instr_action)', |
| 495 '--input-path=<(classes_dir)', |
| 496 '--output-path=<(classes_final_dir)', |
| 497 '--stamp=<(instr_stamp)', |
| 498 '<@(extra_instr_args)', |
| 499 ] |
| 500 }, |
| 501 { |
464 'action_name': 'jar_<(_target_name)', | 502 'action_name': 'jar_<(_target_name)', |
465 'message': 'Creating <(_target_name) jar', | 503 'message': 'Creating <(_target_name) jar', |
466 'inputs': [ | 504 'inputs': [ |
| 505 '<(instr_stamp)', |
467 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 506 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
468 '<(DEPTH)/build/android/gyp/util/md5_check.py', | 507 '<(DEPTH)/build/android/gyp/util/md5_check.py', |
469 '<(DEPTH)/build/android/gyp/jar.py', | 508 '<(DEPTH)/build/android/gyp/jar.py', |
470 '<(compile_stamp)', | |
471 ], | 509 ], |
472 'outputs': [ | 510 'outputs': [ |
473 '<(jar_stamp)', | 511 '<(jar_stamp)', |
474 ], | 512 ], |
475 'action': [ | 513 'action': [ |
476 'python', '<(DEPTH)/build/android/gyp/jar.py', | 514 'python', '<(DEPTH)/build/android/gyp/jar.py', |
477 '--classes-dir=<(classes_dir)', | 515 '--classes-dir=<(classes_final_dir)', |
478 '--jar-path=<(jar_path)', | 516 '--jar-path=<(jar_path)', |
479 '--excluded-classes=<(jar_excluded_classes)', | 517 '--excluded-classes=<(jar_excluded_classes)', |
480 '--stamp=<(jar_stamp)', | 518 '--stamp=<(jar_stamp)', |
481 | 519 |
482 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 520 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
483 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 521 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
484 ] | 522 ] |
485 }, | 523 }, |
486 { | 524 { |
487 'action_name': 'ant_obfuscate_<(_target_name)', | 525 'action_name': 'ant_obfuscate_<(_target_name)', |
488 'message': 'Obfuscating <(_target_name)', | 526 'message': 'Obfuscating <(_target_name)', |
489 'inputs': [ | 527 'inputs': [ |
490 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', | 528 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', |
491 '<(DEPTH)/build/android/ant/create-test-jar.js', | 529 '<(DEPTH)/build/android/ant/create-test-jar.js', |
492 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 530 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
493 '<(DEPTH)/build/android/gyp/ant.py', | 531 '<(DEPTH)/build/android/gyp/ant.py', |
494 '<(compile_stamp)', | 532 '<(instr_stamp)', |
495 '>@(proguard_flags_paths)', | 533 '>@(proguard_flags_paths)', |
496 ], | 534 ], |
497 'outputs': [ | 535 'outputs': [ |
498 '<(obfuscate_stamp)', | 536 '<(obfuscate_stamp)', |
499 ], | 537 ], |
500 'action': [ | 538 'action': [ |
501 'python', '<(DEPTH)/build/android/gyp/ant.py', | 539 'python', '<(DEPTH)/build/android/gyp/ant.py', |
502 '-quiet', | 540 '-quiet', |
503 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', | 541 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', |
504 '-DANDROID_SDK_JAR=<(android_sdk_jar)', | 542 '-DANDROID_SDK_JAR=<(android_sdk_jar)', |
(...skipping 24 matching lines...) Expand all Loading... |
529 ], | 567 ], |
530 }, | 568 }, |
531 { | 569 { |
532 'action_name': 'dex_<(_target_name)', | 570 'action_name': 'dex_<(_target_name)', |
533 'variables': { | 571 'variables': { |
534 'conditions': [ | 572 'conditions': [ |
535 ['proguard_enabled == "true"', { | 573 ['proguard_enabled == "true"', { |
536 'input_paths': [ '<(obfuscate_stamp)' ], | 574 'input_paths': [ '<(obfuscate_stamp)' ], |
537 'proguard_enabled_input_path': '<(obfuscated_jar_path)', | 575 'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
538 }], | 576 }], |
| 577 ['emma_instrument != 0', { |
| 578 'dex_input_paths': [ '<(emma_device_jar)' ], |
| 579 }], |
539 ], | 580 ], |
540 'input_paths': [ '<(compile_stamp)' ], | 581 'input_paths': [ '<(instr_stamp)' ], |
541 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], | 582 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], |
542 'dex_generated_input_dirs': [ '<(classes_dir)' ], | 583 'dex_generated_input_dirs': [ '<(classes_final_dir)' ], |
543 'output_path': '<(dex_path)', | 584 'output_path': '<(dex_path)', |
544 }, | 585 }, |
545 'includes': [ 'android/dex_action.gypi' ], | 586 'includes': [ 'android/dex_action.gypi' ], |
546 }, | 587 }, |
547 { | 588 { |
548 'action_name': 'ant package resources', | 589 'action_name': 'ant package resources', |
549 'message': 'Packaging resources for <(_target_name) APK.', | 590 'message': 'Packaging resources for <(_target_name) APK.', |
550 'inputs': [ | 591 'inputs': [ |
551 '<(DEPTH)/build/android/ant/apk-package-resources.xml', | 592 '<(DEPTH)/build/android/ant/apk-package-resources.xml', |
552 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 593 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 'action': [ | 656 'action': [ |
616 'python', '<(DEPTH)/build/android/gyp/ant.py', | 657 'python', '<(DEPTH)/build/android/gyp/ant.py', |
617 '-quiet', | 658 '-quiet', |
618 '-DANDROID_SDK_ROOT=<(android_sdk_root)', | 659 '-DANDROID_SDK_ROOT=<(android_sdk_root)', |
619 '-DAPK_NAME=<(apk_name)', | 660 '-DAPK_NAME=<(apk_name)', |
620 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', | 661 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', |
621 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', | 662 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', |
622 '-DOUT_DIR=<(intermediate_dir)', | 663 '-DOUT_DIR=<(intermediate_dir)', |
623 '-DSOURCE_DIR=<(source_dir)', | 664 '-DSOURCE_DIR=<(source_dir)', |
624 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', | 665 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', |
| 666 '-DEMMA_INSTRUMENT=<(emma_instrument)', |
625 | 667 |
626 '-Dbasedir=.', | 668 '-Dbasedir=.', |
627 '-buildfile', | 669 '-buildfile', |
628 '<(DEPTH)/build/android/ant/apk-package.xml', | 670 '<(DEPTH)/build/android/ant/apk-package.xml', |
629 | 671 |
630 # Add list of inputs to the command line, so if inputs change | 672 # 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. | 673 # (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. | 674 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
633 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 675 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
634 ] | 676 ] |
635 }, | 677 }, |
636 ], | 678 ], |
637 } | 679 } |
OLD | NEW |