| 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 12 matching lines...) Expand all Loading... |
| 121 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', | 124 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', |
| 122 }], | 125 }], |
| 123 ['gyp_managed_install == 1', { | 126 ['gyp_managed_install == 1', { |
| 124 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 127 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
| 125 }, { | 128 }, { |
| 126 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 129 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
| 127 }], | 130 }], |
| 128 ], | 131 ], |
| 129 }, | 132 }, |
| 130 'native_lib_target%': '', | 133 'native_lib_target%': '', |
| 134 'emma_instrument': '<(emma_coverage)', |
| 131 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 135 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
| 132 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 136 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
| 133 }, | 137 }, |
| 134 # Pass the jar path to the apk's "fake" jar target. This would be better as | 138 # 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 | 139 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
| 136 # cannot be lifted in a dependent to all_dependent_settings. | 140 # cannot be lifted in a dependent to all_dependent_settings. |
| 137 'all_dependent_settings': { | 141 'all_dependent_settings': { |
| 138 'variables': { | 142 'variables': { |
| 139 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 143 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| 140 }, | 144 }, |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 '--src-dirs=>(all_src_dirs)', | 463 '--src-dirs=>(all_src_dirs)', |
| 460 '--javac-includes=<(javac_includes)', | 464 '--javac-includes=<(javac_includes)', |
| 461 '--chromium-code=<(chromium_code)', | 465 '--chromium-code=<(chromium_code)', |
| 462 '--stamp=<(compile_stamp)', | 466 '--stamp=<(compile_stamp)', |
| 463 | 467 |
| 464 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 468 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
| 465 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 469 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
| 466 ], | 470 ], |
| 467 }, | 471 }, |
| 468 { | 472 { |
| 473 'action_name': 'instr_classes_<(_target_name)', |
| 474 'message': 'Instrumenting <(_target_name) classes', |
| 475 'variables': { |
| 476 'input_path': '<(classes_dir)', |
| 477 'output_path': '<(classes_final_dir)', |
| 478 'stamp_path': '<(instr_stamp)', |
| 479 'instr_type': 'classes', |
| 480 }, |
| 481 'outputs': [ |
| 482 '<(instr_stamp)', |
| 483 ], |
| 484 'inputs': [ |
| 485 '<(compile_stamp)', |
| 486 ], |
| 487 'includes': [ 'android/instr_action.gypi' ], |
| 488 }, |
| 489 { |
| 469 'action_name': 'jar_<(_target_name)', | 490 'action_name': 'jar_<(_target_name)', |
| 470 'message': 'Creating <(_target_name) jar', | 491 'message': 'Creating <(_target_name) jar', |
| 471 'inputs': [ | 492 'inputs': [ |
| 493 '<(instr_stamp)', |
| 472 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 494 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 473 '<(DEPTH)/build/android/gyp/util/md5_check.py', | 495 '<(DEPTH)/build/android/gyp/util/md5_check.py', |
| 474 '<(DEPTH)/build/android/gyp/jar.py', | 496 '<(DEPTH)/build/android/gyp/jar.py', |
| 475 '<(compile_stamp)', | |
| 476 ], | 497 ], |
| 477 'outputs': [ | 498 'outputs': [ |
| 478 '<(jar_stamp)', | 499 '<(jar_stamp)', |
| 479 ], | 500 ], |
| 480 'action': [ | 501 'action': [ |
| 481 'python', '<(DEPTH)/build/android/gyp/jar.py', | 502 'python', '<(DEPTH)/build/android/gyp/jar.py', |
| 482 '--classes-dir=<(classes_dir)', | 503 '--classes-dir=<(classes_final_dir)', |
| 483 '--jar-path=<(jar_path)', | 504 '--jar-path=<(jar_path)', |
| 484 '--excluded-classes=<(jar_excluded_classes)', | 505 '--excluded-classes=<(jar_excluded_classes)', |
| 485 '--stamp=<(jar_stamp)', | 506 '--stamp=<(jar_stamp)', |
| 486 | 507 |
| 487 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 508 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
| 488 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 509 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
| 489 ] | 510 ] |
| 490 }, | 511 }, |
| 491 { | 512 { |
| 492 'action_name': 'ant_obfuscate_<(_target_name)', | 513 'action_name': 'ant_obfuscate_<(_target_name)', |
| 493 'message': 'Obfuscating <(_target_name)', | 514 'message': 'Obfuscating <(_target_name)', |
| 494 'inputs': [ | 515 'inputs': [ |
| 495 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', | 516 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', |
| 496 '<(DEPTH)/build/android/ant/create-test-jar.js', | 517 '<(DEPTH)/build/android/ant/create-test-jar.js', |
| 497 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 518 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 498 '<(DEPTH)/build/android/gyp/ant.py', | 519 '<(DEPTH)/build/android/gyp/ant.py', |
| 499 '<(compile_stamp)', | 520 '<(instr_stamp)', |
| 500 '>@(proguard_flags_paths)', | 521 '>@(proguard_flags_paths)', |
| 501 ], | 522 ], |
| 502 'outputs': [ | 523 'outputs': [ |
| 503 '<(obfuscate_stamp)', | 524 '<(obfuscate_stamp)', |
| 504 ], | 525 ], |
| 505 'action': [ | 526 'action': [ |
| 506 'python', '<(DEPTH)/build/android/gyp/ant.py', | 527 'python', '<(DEPTH)/build/android/gyp/ant.py', |
| 507 '-quiet', | 528 '-quiet', |
| 508 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', | 529 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', |
| 509 '-DANDROID_SDK_JAR=<(android_sdk_jar)', | 530 '-DANDROID_SDK_JAR=<(android_sdk_jar)', |
| (...skipping 25 matching lines...) Expand all Loading... |
| 535 ], | 556 ], |
| 536 }, | 557 }, |
| 537 { | 558 { |
| 538 'action_name': 'dex_<(_target_name)', | 559 'action_name': 'dex_<(_target_name)', |
| 539 'variables': { | 560 'variables': { |
| 540 'conditions': [ | 561 'conditions': [ |
| 541 ['proguard_enabled == "true"', { | 562 ['proguard_enabled == "true"', { |
| 542 'input_paths': [ '<(obfuscate_stamp)' ], | 563 'input_paths': [ '<(obfuscate_stamp)' ], |
| 543 'proguard_enabled_input_path': '<(obfuscated_jar_path)', | 564 'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
| 544 }], | 565 }], |
| 566 ['emma_instrument != 0', { |
| 567 'dex_input_paths': [ '<(emma_device_jar)' ], |
| 568 'dex_no_locals': 1, |
| 569 }], |
| 545 ], | 570 ], |
| 546 'input_paths': [ '<(compile_stamp)' ], | 571 'input_paths': [ '<(instr_stamp)' ], |
| 547 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], | 572 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], |
| 548 'dex_generated_input_dirs': [ '<(classes_dir)' ], | 573 'dex_generated_input_dirs': [ '<(classes_final_dir)' ], |
| 549 'output_path': '<(dex_path)', | 574 'output_path': '<(dex_path)', |
| 550 }, | 575 }, |
| 551 'includes': [ 'android/dex_action.gypi' ], | 576 'includes': [ 'android/dex_action.gypi' ], |
| 552 }, | 577 }, |
| 553 { | 578 { |
| 554 'action_name': 'ant package resources', | 579 'action_name': 'ant package resources', |
| 555 'message': 'Packaging resources for <(_target_name) APK.', | 580 'message': 'Packaging resources for <(_target_name) APK.', |
| 556 'inputs': [ | 581 'inputs': [ |
| 557 '<(DEPTH)/build/android/ant/apk-package-resources.xml', | 582 '<(DEPTH)/build/android/ant/apk-package-resources.xml', |
| 558 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 583 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 'python', '<(DEPTH)/build/android/gyp/ant.py', | 648 'python', '<(DEPTH)/build/android/gyp/ant.py', |
| 624 '-quiet', | 649 '-quiet', |
| 625 '-DANDROID_SDK_ROOT=<(android_sdk_root)', | 650 '-DANDROID_SDK_ROOT=<(android_sdk_root)', |
| 626 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', | 651 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', |
| 627 '-DAPK_NAME=<(apk_name)', | 652 '-DAPK_NAME=<(apk_name)', |
| 628 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', | 653 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', |
| 629 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', | 654 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', |
| 630 '-DOUT_DIR=<(intermediate_dir)', | 655 '-DOUT_DIR=<(intermediate_dir)', |
| 631 '-DSOURCE_DIR=<(source_dir)', | 656 '-DSOURCE_DIR=<(source_dir)', |
| 632 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', | 657 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', |
| 658 '-DEMMA_INSTRUMENT=<(emma_instrument)', |
| 633 | 659 |
| 634 '-Dbasedir=.', | 660 '-Dbasedir=.', |
| 635 '-buildfile', | 661 '-buildfile', |
| 636 '<(DEPTH)/build/android/ant/apk-package.xml', | 662 '<(DEPTH)/build/android/ant/apk-package.xml', |
| 637 | 663 |
| 638 # Add list of inputs to the command line, so if inputs change | 664 # Add list of inputs to the command line, so if inputs change |
| 639 # (e.g. if a Java file is removed), the command will be re-run. | 665 # (e.g. if a Java file is removed), the command will be re-run. |
| 640 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 666 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 641 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 667 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
| 642 ] | 668 ] |
| 643 }, | 669 }, |
| 644 ], | 670 ], |
| 645 } | 671 } |
| OLD | NEW |