| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 'additional_res_dirs': [], | 67 'additional_res_dirs': [], |
| 68 'additional_res_packages': [], | 68 'additional_res_packages': [], |
| 69 'is_test_apk%': 0, | 69 'is_test_apk%': 0, |
| 70 'java_strings_grd%': '', | 70 'java_strings_grd%': '', |
| 71 'library_manifest_paths' : [], | 71 'library_manifest_paths' : [], |
| 72 'resource_input_paths': [], | 72 'resource_input_paths': [], |
| 73 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', | 73 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', |
| 74 'asset_location%': '<(intermediate_dir)/assets', | 74 'asset_location%': '<(intermediate_dir)/assets', |
| 75 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', | 75 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', |
| 76 'compile_input_paths': [ ], | 76 'compile_input_paths': [ ], |
| 77 'package_input_paths': [ ], |
| 77 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', | 78 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', |
| 78 # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and | 79 # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and |
| 79 # nativelibraries template should be moved out of content/ (to base/?). | 80 # nativelibraries template should be moved out of content/ (to base/?). |
| 80 # http://crbug.com/225101 | 81 # http://crbug.com/225101 |
| 81 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates
/NativeLibraries.template', | 82 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates
/NativeLibraries.template', |
| 82 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', | 83 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', |
| 83 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', | 84 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', |
| 84 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', | 85 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', |
| 85 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', | 86 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', |
| 86 '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', |
| 87 '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', |
| 88 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 89 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
| 89 'jar_stamp': '<(intermediate_dir)/jar.stamp', | 90 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
| 90 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | 91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
| 92 'strip_stamp': '<(intermediate_dir)/strip.stamp', |
| 91 'classes_dir': '<(intermediate_dir)/classes', | 93 'classes_dir': '<(intermediate_dir)/classes', |
| 92 'javac_includes': [], | 94 'javac_includes': [], |
| 93 'jar_excluded_classes': [], | 95 'jar_excluded_classes': [], |
| 94 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| 95 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
| 96 'dex_path': '<(intermediate_dir)/classes.dex', | 98 'dex_path': '<(intermediate_dir)/classes.dex', |
| 97 'android_manifest': '<(java_in_dir)/AndroidManifest.xml', | 99 'android_manifest': '<(java_in_dir)/AndroidManifest.xml', |
| 98 'codegen_input_paths': [], | 100 'codegen_input_paths': [], |
| 99 }, | 101 }, |
| 100 'sources': [ | |
| 101 '<@(native_libs_paths)', | |
| 102 ], | |
| 103 # Pass the jar path to the apk's "fake" jar target. This would be better as | 102 # Pass the jar path to the apk's "fake" jar target. This would be better as |
| 104 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 103 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
| 105 # cannot be lifted in a dependent to all_dependent_settings. | 104 # cannot be lifted in a dependent to all_dependent_settings. |
| 106 'all_dependent_settings': { | 105 'all_dependent_settings': { |
| 107 'variables': { | 106 'variables': { |
| 108 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 107 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| 109 }, | 108 }, |
| 110 }, | 109 }, |
| 111 'rules': [ | |
| 112 { | |
| 113 'rule_name': 'copy_and_strip_native_libraries', | |
| 114 'extension': 'so', | |
| 115 'variables': { | |
| 116 'apk_libraries_dir': '<(intermediate_dir)/libs/<(android_app_abi)', | |
| 117 'stripped_library_path': '<(apk_libraries_dir)/<(RULE_INPUT_ROOT).so', | |
| 118 }, | |
| 119 'inputs': [ | |
| 120 '<(DEPTH)/build/android/strip_library_for_apk.py', | |
| 121 ], | |
| 122 'outputs': [ | |
| 123 '<(stripped_library_path)', | |
| 124 ], | |
| 125 'action': [ | |
| 126 'python', '<(DEPTH)/build/android/strip_library_for_apk.py', | |
| 127 '--android-strip=<(android_strip)', | |
| 128 '--android-strip-arg=--strip-unneeded', | |
| 129 '--stripped-libraries-dir=<(apk_libraries_dir)', | |
| 130 '<(RULE_INPUT_PATH)', | |
| 131 ], | |
| 132 }, | |
| 133 ], | |
| 134 'conditions': [ | 110 'conditions': [ |
| 135 ['resource_dir!=""', { | 111 ['resource_dir!=""', { |
| 136 'variables': { | 112 'variables': { |
| 137 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] | 113 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] |
| 138 }, | 114 }, |
| 139 }], | 115 }], |
| 140 ['R_package != ""', { | 116 ['R_package != ""', { |
| 141 'variables': { | 117 'variables': { |
| 142 # We generate R.java in package R_package (in addition to the package | 118 # We generate R.java in package R_package (in addition to the package |
| 143 # listed in the AndroidManifest.xml, which is unavoidable). | 119 # listed in the AndroidManifest.xml, which is unavoidable). |
| 144 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | 120 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
| 145 'additional_res_packages': ['<(R_package)'], | 121 'additional_res_packages': ['<(R_package)'], |
| 146 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], | 122 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], |
| 147 }, | 123 }, |
| 148 }], | 124 }], |
| 149 ['native_libs_paths != []', { | 125 ['native_libs_paths != []', { |
| 150 'variables': { | 126 'variables': { |
| 151 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], | 127 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], |
| 152 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], | 128 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
| 129 'package_input_paths': [ '<(strip_stamp)' ], |
| 153 }, | 130 }, |
| 154 'actions': [ | 131 'actions': [ |
| 155 { | 132 { |
| 156 'action_name': 'ordered_libraries_<(_target_name)', | 133 'action_name': 'ordered_libraries_<(_target_name)', |
| 157 'message': 'Writing dependency ordered libraries for <(_target_name).'
, | 134 'message': 'Writing dependency ordered libraries for <(_target_name).'
, |
| 158 'inputs': [ | 135 'inputs': [ |
| 159 '<(DEPTH)/build/android/pylib/build_utils.py', | 136 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 160 '<(DEPTH)/build/android/write_ordered_libraries.py', | 137 '<(DEPTH)/build/android/write_ordered_libraries.py', |
| 161 '<@(native_libs_paths)', | 138 '<@(native_libs_paths)', |
| 162 ], | 139 ], |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 '<(native_libraries_java_stamp)', | 177 '<(native_libraries_java_stamp)', |
| 201 ], | 178 ], |
| 202 'action': [ | 179 'action': [ |
| 203 'python', '<(DEPTH)/build/android/gcc_preprocess.py', | 180 'python', '<(DEPTH)/build/android/gcc_preprocess.py', |
| 204 '--include-path=<(native_libraries_template_data_dir)', | 181 '--include-path=<(native_libraries_template_data_dir)', |
| 205 '--output=<(native_libraries_java_file)', | 182 '--output=<(native_libraries_java_file)', |
| 206 '--template=<(native_libraries_template)', | 183 '--template=<(native_libraries_template)', |
| 207 '--stamp=<(native_libraries_java_stamp)', | 184 '--stamp=<(native_libraries_java_stamp)', |
| 208 ], | 185 ], |
| 209 }, | 186 }, |
| 187 { |
| 188 'action_name': 'strip_native_libraries', |
| 189 'message': 'Stripping libraries for <(_target_name)', |
| 190 'variables': { |
| 191 'apk_libraries_dir': '<(intermediate_dir)/libs/<(android_app_abi)', |
| 192 }, |
| 193 'inputs': [ |
| 194 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 195 '<(DEPTH)/build/android/strip_library_for_apk.py', |
| 196 '<(ordered_libraries_file)' |
| 197 ], |
| 198 'outputs': [ |
| 199 '<(strip_stamp)', |
| 200 ], |
| 201 'action': [ |
| 202 'python', '<(DEPTH)/build/android/strip_library_for_apk.py', |
| 203 '--android-strip=<(android_strip)', |
| 204 '--android-strip-arg=--strip-unneeded', |
| 205 '--stripped-libraries-dir=<(apk_libraries_dir)', |
| 206 '--libraries-dir=<(SHARED_LIB_DIR)', |
| 207 '--libraries-file=<(ordered_libraries_file)', |
| 208 '--stamp=<(strip_stamp)', |
| 209 ], |
| 210 }, |
| 210 ], | 211 ], |
| 211 }], # native_libs_paths != [] | 212 }], # native_libs_paths != [] |
| 212 ['java_strings_grd != ""', { | 213 ['java_strings_grd != ""', { |
| 213 'variables': { | 214 'variables': { |
| 214 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit
', | 215 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit
', |
| 215 'additional_res_dirs': ['<(res_grit_dir)'], | 216 'additional_res_dirs': ['<(res_grit_dir)'], |
| 216 # grit_grd_file is used by grit_action.gypi, included below. | 217 # grit_grd_file is used by grit_action.gypi, included below. |
| 217 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', | 218 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
| 218 'resource_input_paths': [ | 219 'resource_input_paths': [ |
| 219 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir
)" <(grit_grd_file))' | 220 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir
)" <(grit_grd_file))' |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 417 |
| 417 '>@(dex_inputs)', | 418 '>@(dex_inputs)', |
| 418 '>@(dex_generated_inputs)', | 419 '>@(dex_generated_inputs)', |
| 419 ] | 420 ] |
| 420 }, | 421 }, |
| 421 { | 422 { |
| 422 'action_name': 'ant_package_<(_target_name)', | 423 'action_name': 'ant_package_<(_target_name)', |
| 423 'message': 'Packaging <(_target_name).', | 424 'message': 'Packaging <(_target_name).', |
| 424 'inputs': [ | 425 'inputs': [ |
| 425 '<(DEPTH)/build/android/ant/apk-package.xml', | 426 '<(DEPTH)/build/android/ant/apk-package.xml', |
| 426 #TODO(cjhopman): this should be the stripped library paths. | |
| 427 '>@(native_libs_paths)', | |
| 428 '<(dex_path)', | 427 '<(dex_path)', |
| 429 '<(codegen_stamp)', | 428 '<(codegen_stamp)', |
| 430 '<(obfuscate_stamp)', | 429 '<(obfuscate_stamp)', |
| 430 '>@(package_input_paths)', |
| 431 ], | 431 ], |
| 432 'conditions': [ | 432 'conditions': [ |
| 433 ['is_test_apk == 1', { | 433 ['is_test_apk == 1', { |
| 434 'variables': { | 434 'variables': { |
| 435 'additional_res_dirs=': [], | 435 'additional_res_dirs=': [], |
| 436 'additional_res_packages=': [], | 436 'additional_res_packages=': [], |
| 437 } | 437 } |
| 438 }], | 438 }], |
| 439 ], | 439 ], |
| 440 'outputs': [ | 440 'outputs': [ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 465 | 465 |
| 466 # Add list of inputs to the command line, so if inputs change | 466 # Add list of inputs to the command line, so if inputs change |
| 467 # (e.g. if a Java file is removed), the command will be re-run. | 467 # (e.g. if a Java file is removed), the command will be re-run. |
| 468 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 468 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 469 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 469 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
| 470 | 470 |
| 471 ] | 471 ] |
| 472 }, | 472 }, |
| 473 ], | 473 ], |
| 474 } | 474 } |
| OLD | NEW |