Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 # is_test_apk - Set to 1 if building a test apk. This prevents resources from | 39 # is_test_apk - Set to 1 if building a test apk. This prevents resources from |
| 40 # dependencies from being re-included. | 40 # dependencies from being re-included. |
| 41 # native_lib_target - The target_name of the target which generates the final | 41 # native_lib_target - The target_name of the target which generates the final |
| 42 # shared library to be included in this apk. A stripped copy of the | 42 # shared library to be included in this apk. A stripped copy of the |
| 43 # library will be included in the apk. | 43 # library will be included in the apk. |
| 44 # resource_dir - The directory for resources. | 44 # resource_dir - The directory for resources. |
| 45 # R_package - A custom Java package to generate the resource file R.java in. | 45 # R_package - A custom Java package to generate the resource file R.java in. |
| 46 # By default, the package given in AndroidManifest.xml will be used. | 46 # By default, the package given in AndroidManifest.xml will be used. |
| 47 # use_chromium_linker - Enable the content dynamic linker that allows sharing t he | 47 # use_chromium_linker - Enable the content dynamic linker that allows sharing t he |
| 48 # RELRO section of the native libraries between the different processes. | 48 # RELRO section of the native libraries between the different processes. |
| 49 # use_relocation_packer - Enable relocation packing. Relies on the chromium | |
| 50 # linker, so use_chromium_linker must also be enabled. | |
| 49 # enable_chromium_linker_tests - Enable the content dynamic linker test support | 51 # enable_chromium_linker_tests - Enable the content dynamic linker test support |
| 50 # code. This allows a test APK to inject a Linker.TestRunner instance at | 52 # code. This allows a test APK to inject a Linker.TestRunner instance at |
| 51 # runtime. Should only be used by the chromium_linker_test_apk target!! | 53 # runtime. Should only be used by the chromium_linker_test_apk target!! |
| 52 # never_lint - Set to 1 to not run lint on this target. | 54 # never_lint - Set to 1 to not run lint on this target. |
| 53 { | 55 { |
| 54 'variables': { | 56 'variables': { |
| 55 'tested_apk_obfuscated_jar_path%': '/', | 57 'tested_apk_obfuscated_jar_path%': '/', |
| 56 'tested_apk_dex_path%': '/', | 58 'tested_apk_dex_path%': '/', |
| 57 'additional_input_paths': [], | 59 'additional_input_paths': [], |
| 58 'input_jars_paths': [], | 60 'input_jars_paths': [], |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 86 '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', |
| 87 'native_libraries_template_version_file': '<(native_libraries_template_data_ dir)/native_libraries_version.h', | 89 'native_libraries_template_version_file': '<(native_libraries_template_data_ dir)/native_libraries_version.h', |
| 88 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 90 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
| 89 'lint_stamp': '<(intermediate_dir)/lint.stamp', | 91 'lint_stamp': '<(intermediate_dir)/lint.stamp', |
| 90 'lint_result': '<(intermediate_dir)/lint_result.xml', | 92 'lint_result': '<(intermediate_dir)/lint_result.xml', |
| 91 'lint_config': '<(intermediate_dir)/lint_config.xml', | 93 'lint_config': '<(intermediate_dir)/lint_config.xml', |
| 92 'never_lint%': 0, | 94 'never_lint%': 0, |
| 93 'instr_stamp': '<(intermediate_dir)/instr.stamp', | 95 'instr_stamp': '<(intermediate_dir)/instr.stamp', |
| 94 'jar_stamp': '<(intermediate_dir)/jar.stamp', | 96 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
| 95 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | 97 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
| 98 'pack_stamp': '<(intermediate_dir)/pack.stamp', | |
|
rmcilroy
2014/06/27 11:14:54
nit - pack_relocations.stamp
simonb (inactive)
2014/06/30 16:23:23
Done.
| |
| 96 'strip_stamp': '<(intermediate_dir)/strip.stamp', | 99 'strip_stamp': '<(intermediate_dir)/strip.stamp', |
| 97 'classes_dir': '<(intermediate_dir)/classes/2', | 100 'classes_dir': '<(intermediate_dir)/classes/2', |
| 98 'javac_includes': [], | 101 'javac_includes': [], |
| 99 'jar_excluded_classes': [], | 102 'jar_excluded_classes': [], |
| 100 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', | 103 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', |
| 101 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 104 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| 102 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 105 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
| 103 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', | 106 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', |
| 104 'dex_path': '<(intermediate_dir)/classes.dex', | 107 'dex_path': '<(intermediate_dir)/classes.dex', |
| 105 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', | 108 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 117 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_t arget_name)/<(CONFIGURATION_NAME)', | 120 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_t arget_name)/<(CONFIGURATION_NAME)', |
| 118 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', | 121 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', |
| 119 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh ', | 122 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh ', |
| 120 'create_standalone_apk%': 1, | 123 'create_standalone_apk%': 1, |
| 121 'res_v14_verify_only%': 0, | 124 'res_v14_verify_only%': 0, |
| 122 'variables': { | 125 'variables': { |
| 123 'variables': { | 126 'variables': { |
| 124 'native_lib_target%': '', | 127 'native_lib_target%': '', |
| 125 'native_lib_version_name%': '', | 128 'native_lib_version_name%': '', |
| 126 'use_chromium_linker%' : 0, | 129 'use_chromium_linker%' : 0, |
| 130 'use_relocation_packer%' : 0, | |
| 127 'enable_chromium_linker_tests%': 0, | 131 'enable_chromium_linker_tests%': 0, |
| 128 'is_test_apk%': 0, | 132 'is_test_apk%': 0, |
| 129 }, | 133 }, |
| 130 'conditions': [ | 134 'conditions': [ |
| 131 ['gyp_managed_install == 1 and native_lib_target != ""', { | 135 ['gyp_managed_install == 1 and native_lib_target != ""', { |
| 132 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand alone-unsigned.apk', | 136 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand alone-unsigned.apk', |
| 133 }, { | 137 }, { |
| 134 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', | 138 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', |
| 135 }], | 139 }], |
| 136 ['gyp_managed_install == 1', { | 140 ['gyp_managed_install == 1', { |
| 137 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 141 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
| 138 }, { | 142 }, { |
| 139 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 143 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
| 140 }], | 144 }], |
| 141 ['is_test_apk == 0 and emma_coverage != 0', { | 145 ['is_test_apk == 0 and emma_coverage != 0', { |
| 142 'emma_instrument%': 1, | 146 'emma_instrument%': 1, |
| 143 },{ | 147 },{ |
| 144 'emma_instrument%': 0, | 148 'emma_instrument%': 0, |
| 145 }], | 149 }], |
| 146 ], | 150 ], |
| 147 }, | 151 }, |
| 148 'native_lib_target%': '', | 152 'native_lib_target%': '', |
| 149 'native_lib_version_name%': '', | 153 'native_lib_version_name%': '', |
| 150 'use_chromium_linker%' : 0, | 154 'use_chromium_linker%' : 0, |
| 155 'use_relocation_packer%' : 0, | |
| 151 'enable_chromium_linker_tests%': 0, | 156 'enable_chromium_linker_tests%': 0, |
| 152 'emma_instrument%': '<(emma_instrument)', | 157 'emma_instrument%': '<(emma_instrument)', |
| 153 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 158 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
| 154 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 159 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
| 155 'extra_native_libs': [], | 160 'extra_native_libs': [], |
| 156 }, | 161 }, |
| 157 # Pass the jar path to the apk's "fake" jar target. This would be better as | 162 # Pass the jar path to the apk's "fake" jar target. This would be better as |
| 158 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 163 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
| 159 # cannot be lifted in a dependent to all_dependent_settings. | 164 # cannot be lifted in a dependent to all_dependent_settings. |
| 160 'all_dependent_settings': { | 165 'all_dependent_settings': { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 '--output=<(native_libraries_java_file)', | 314 '--output=<(native_libraries_java_file)', |
| 310 '--template=<(native_libraries_template)', | 315 '--template=<(native_libraries_template)', |
| 311 '--stamp=<(native_libraries_java_stamp)', | 316 '--stamp=<(native_libraries_java_stamp)', |
| 312 '<@(gcc_preprocess_defines)', | 317 '<@(gcc_preprocess_defines)', |
| 313 ], | 318 ], |
| 314 }, | 319 }, |
| 315 { | 320 { |
| 316 'action_name': 'strip_native_libraries', | 321 'action_name': 'strip_native_libraries', |
| 317 'variables': { | 322 'variables': { |
| 318 'ordered_libraries_file%': '<(ordered_libraries_file)', | 323 'ordered_libraries_file%': '<(ordered_libraries_file)', |
| 319 'stripped_libraries_dir': '<(libraries_source_dir)', | 324 'stripped_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)', |
|
rmcilroy
2014/06/27 11:14:55
I'm not entirely familiar with the output director
simonb (inactive)
2014/06/30 16:23:23
SHARED_INTERMEDIATE_DIR doesn't currently hold uns
rmcilroy
2014/07/01 11:13:02
This is perfect, thanks for making the change.
| |
| 320 'input_paths': [ | 325 'input_paths': [ |
| 321 '<@(native_libs_paths)', | 326 '<@(native_libs_paths)', |
| 322 '<@(extra_native_libs)', | 327 '<@(extra_native_libs)', |
| 323 ], | 328 ], |
| 324 'stamp': '<(strip_stamp)' | 329 'stamp': '<(strip_stamp)' |
| 325 }, | 330 }, |
| 326 'includes': ['../build/android/strip_native_libraries.gypi'], | 331 'includes': ['../build/android/strip_native_libraries.gypi'], |
| 327 }, | 332 }, |
| 333 { | |
| 334 'action_name': 'pack_arm_relocations', | |
| 335 'variables': { | |
| 336 'ordered_libraries_file%': '<(ordered_libraries_file)', | |
| 337 'stripped_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)', | |
| 338 'packed_libraries_dir': '<(libraries_source_dir)', | |
| 339 'input_paths': [ | |
| 340 '<(strip_stamp)', | |
| 341 ], | |
| 342 'stamp': '<(pack_stamp)', | |
| 343 'conditions': [ | |
| 344 ['use_chromium_linker == 1 and use_relocation_packer == 1', { | |
|
rmcilroy
2014/06/27 11:14:55
Can you make it an error to have "use_relocation_p
simonb (inactive)
2014/06/30 16:23:23
Gyp appears to lack any mechanism to raise an exce
rmcilroy
2014/07/01 11:13:02
I was afraid of that.. Thanks for checking.
| |
| 345 'enable_packing': 1, | |
| 346 }, { | |
| 347 'enable_packing': 0, | |
| 348 }], | |
| 349 ], | |
| 350 }, | |
| 351 'dependencies': [ | |
| 352 'strip_native_libraries', | |
| 353 ], | |
| 354 'includes': ['../build/android/pack_arm_relocations.gypi'], | |
| 355 }, | |
| 328 ], | 356 ], |
| 329 'conditions': [ | 357 'conditions': [ |
| 330 ['gyp_managed_install == 1', { | 358 ['gyp_managed_install == 1', { |
| 331 'variables': { | 359 'variables': { |
| 332 'libraries_top_dir': '<(intermediate_dir)/lib.stripped', | 360 'libraries_top_dir': '<(intermediate_dir)/lib.stripped', |
| 333 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi) ', | 361 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi) ', |
| 334 'device_library_dir': '<(device_intermediate_dir)/lib.stripped', | 362 'device_library_dir': '<(device_intermediate_dir)/lib.stripped', |
| 335 'configuration_name': '<(CONFIGURATION_NAME)', | 363 'configuration_name': '<(CONFIGURATION_NAME)', |
| 336 }, | 364 }, |
| 337 'dependencies': [ | 365 'dependencies': [ |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 793 '-DEMMA_INSTRUMENT=<(emma_instrument)', | 821 '-DEMMA_INSTRUMENT=<(emma_instrument)', |
| 794 '-DEMMA_DEVICE_JAR=<(emma_device_jar)', | 822 '-DEMMA_DEVICE_JAR=<(emma_device_jar)', |
| 795 | 823 |
| 796 '-Dbasedir=.', | 824 '-Dbasedir=.', |
| 797 '-buildfile', | 825 '-buildfile', |
| 798 '<(DEPTH)/build/android/ant/apk-package.xml', | 826 '<(DEPTH)/build/android/ant/apk-package.xml', |
| 799 ] | 827 ] |
| 800 }, | 828 }, |
| 801 ], | 829 ], |
| 802 } | 830 } |
| OLD | NEW |