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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 'R_package%':'', | 66 'R_package%':'', |
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': [ ], |
| 77 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', |
| 78 # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and |
| 79 # nativelibraries template should be moved out of content/ (to base/?). |
| 80 # http://crbug.com/225101 |
| 81 '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_file': '<(native_libraries_java_dir)/NativeLibraries.
java', |
| 84 '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_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', |
| 87 'native_libraries_template_data_stamp': '<(intermediate_dir)/native_librarie
s_template_data.stamp', |
76 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 88 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
77 'jar_stamp': '<(intermediate_dir)/jar.stamp', | 89 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
78 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | 90 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
79 'classes_dir': '<(intermediate_dir)/classes', | 91 'classes_dir': '<(intermediate_dir)/classes', |
80 'javac_includes': [], | 92 'javac_includes': [], |
81 'jar_excluded_classes': [], | 93 'jar_excluded_classes': [], |
82 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 94 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
83 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 95 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
84 'dex_path': '<(intermediate_dir)/classes.dex', | 96 'dex_path': '<(intermediate_dir)/classes.dex', |
85 'android_manifest': '<(java_in_dir)/AndroidManifest.xml', | 97 'android_manifest': '<(java_in_dir)/AndroidManifest.xml', |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 }], | 139 }], |
128 ['R_package != ""', { | 140 ['R_package != ""', { |
129 'variables': { | 141 'variables': { |
130 # We generate R.java in package R_package (in addition to the package | 142 # We generate R.java in package R_package (in addition to the package |
131 # listed in the AndroidManifest.xml, which is unavoidable). | 143 # listed in the AndroidManifest.xml, which is unavoidable). |
132 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | 144 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
133 'additional_res_packages': ['<(R_package)'], | 145 'additional_res_packages': ['<(R_package)'], |
134 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], | 146 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], |
135 }, | 147 }, |
136 }], | 148 }], |
| 149 ['native_libs_paths != []', { |
| 150 'variables': { |
| 151 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], |
| 152 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
| 153 }, |
| 154 'actions': [ |
| 155 { |
| 156 'action_name': 'ordered_libraries_<(_target_name)', |
| 157 'message': 'Writing dependency ordered libraries for <(_target_name).'
, |
| 158 'inputs': [ |
| 159 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 160 '<(DEPTH)/build/android/write_ordered_libraries.py', |
| 161 '<@(native_libs_paths)', |
| 162 ], |
| 163 'outputs': [ |
| 164 '<(ordered_libraries_file)', |
| 165 ], |
| 166 'action': [ |
| 167 'python', '<(DEPTH)/build/android/write_ordered_libraries.py', |
| 168 '--input-libraries=<(native_libs_paths)', |
| 169 '--output=<(ordered_libraries_file)', |
| 170 ], |
| 171 }, |
| 172 { |
| 173 'action_name': 'native_libraries_template_data_<(_target_name)', |
| 174 'message': 'Creating native_libraries_list.h for <(_target_name).', |
| 175 'inputs': [ |
| 176 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 177 '<(DEPTH)/build/android/create_native_libraries_header.py', |
| 178 '<(ordered_libraries_file)', |
| 179 ], |
| 180 'outputs': [ |
| 181 '<(native_libraries_template_data_stamp)', |
| 182 ], |
| 183 'action': [ |
| 184 'python', '<(DEPTH)/build/android/create_native_libraries_header.py'
, |
| 185 '--ordered-libraries=<(ordered_libraries_file)', |
| 186 '--output=<(native_libraries_template_data_file)', |
| 187 '--stamp=<(native_libraries_template_data_stamp)', |
| 188 ], |
| 189 }, |
| 190 { |
| 191 'action_name': 'native_libraries_<(_target_name)', |
| 192 'message': 'Creating NativeLibraries.java for <(_target_name).', |
| 193 'inputs': [ |
| 194 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 195 '<(DEPTH)/build/android/gcc_preprocess.py', |
| 196 '<(native_libraries_template_data_stamp)', |
| 197 '<(native_libraries_template)', |
| 198 ], |
| 199 'outputs': [ |
| 200 '<(native_libraries_java_stamp)', |
| 201 ], |
| 202 'action': [ |
| 203 'python', '<(DEPTH)/build/android/gcc_preprocess.py', |
| 204 '--include-path=<(native_libraries_template_data_dir)', |
| 205 '--output=<(native_libraries_java_file)', |
| 206 '--template=<(native_libraries_template)', |
| 207 '--stamp=<(native_libraries_java_stamp)', |
| 208 ], |
| 209 }, |
| 210 ], |
| 211 }], # native_libs_paths != [] |
137 ['java_strings_grd != ""', { | 212 ['java_strings_grd != ""', { |
138 'variables': { | 213 'variables': { |
139 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit
', | 214 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit
', |
140 'additional_res_dirs': ['<(res_grit_dir)'], | 215 'additional_res_dirs': ['<(res_grit_dir)'], |
141 # grit_grd_file is used by grit_action.gypi, included below. | 216 # grit_grd_file is used by grit_action.gypi, included below. |
142 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', | 217 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
143 'resource_input_paths': [ | 218 'resource_input_paths': [ |
144 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir
)" <(grit_grd_file))' | 219 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir
)" <(grit_grd_file))' |
145 ], | 220 ], |
146 }, | 221 }, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ], | 291 ], |
217 }, | 292 }, |
218 'inputs': [ | 293 'inputs': [ |
219 '<(DEPTH)/build/android/pylib/build_utils.py', | 294 '<(DEPTH)/build/android/pylib/build_utils.py', |
220 '<(DEPTH)/build/android/javac.py', | 295 '<(DEPTH)/build/android/javac.py', |
221 # If there is a separate find for additional_src_dirs, it will find the | 296 # If there is a separate find for additional_src_dirs, it will find the |
222 # wrong .java files when additional_src_dirs is empty. | 297 # wrong .java files when additional_src_dirs is empty. |
223 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', | 298 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', |
224 '>@(input_jars_paths)', | 299 '>@(input_jars_paths)', |
225 '<(codegen_stamp)', | 300 '<(codegen_stamp)', |
| 301 '>@(compile_input_paths)', |
226 ], | 302 ], |
227 'outputs': [ | 303 'outputs': [ |
228 '<(compile_stamp)', | 304 '<(compile_stamp)', |
229 ], | 305 ], |
230 'action': [ | 306 'action': [ |
231 'python', '<(DEPTH)/build/android/javac.py', | 307 'python', '<(DEPTH)/build/android/javac.py', |
232 '--output-dir=<(classes_dir)', | 308 '--output-dir=<(classes_dir)', |
233 '--classpath=>(input_jars_paths) <(android_sdk_jar)', | 309 '--classpath=>(input_jars_paths) <(android_sdk_jar)', |
234 '--src-dirs=>(all_src_dirs)', | 310 '--src-dirs=>(all_src_dirs)', |
235 '--javac-includes=<(javac_includes)', | 311 '--javac-includes=<(javac_includes)', |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 465 |
390 # 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 |
391 # (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. |
392 # 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. |
393 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 469 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
394 | 470 |
395 ] | 471 ] |
396 }, | 472 }, |
397 ], | 473 ], |
398 } | 474 } |
OLD | NEW |