Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: build/java_apk.gypi

Issue 14843017: [Android] Support building standalone APK in component build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/common.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 'variables': { 53 'variables': {
54 'additional_input_paths': [], 54 'additional_input_paths': [],
55 'input_jars_paths': [], 55 'input_jars_paths': [],
56 'library_dexed_jars_paths': [], 56 'library_dexed_jars_paths': [],
57 'additional_src_dirs': [], 57 'additional_src_dirs': [],
58 'generated_src_dirs': [], 58 'generated_src_dirs': [],
59 'app_manifest_version_name%': '<(android_app_version_name)', 59 'app_manifest_version_name%': '<(android_app_version_name)',
60 'app_manifest_version_code%': '<(android_app_version_code)', 60 'app_manifest_version_code%': '<(android_app_version_code)',
61 'proguard_enabled%': 'false', 61 'proguard_enabled%': 'false',
62 'proguard_flags_paths%': ['<(DEPTH)/build/android/empty_proguard.flags'], 62 'proguard_flags_paths%': ['<(DEPTH)/build/android/empty_proguard.flags'],
63 'native_lib_target%': '',
64 'jar_name': 'chromium_apk_<(_target_name).jar', 63 'jar_name': 'chromium_apk_<(_target_name).jar',
65 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', 64 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
66 'R_package%':'', 65 'R_package%':'',
67 'additional_R_text_files': [], 66 'additional_R_text_files': [],
68 'additional_res_dirs': [], 67 'additional_res_dirs': [],
69 'additional_res_packages': [], 68 'additional_res_packages': [],
70 'is_test_apk%': 0, 69 'is_test_apk%': 0,
71 'java_strings_grd%': '', 70 'java_strings_grd%': '',
72 'library_manifest_paths' : [], 71 'library_manifest_paths' : [],
73 'resource_input_paths': [], 72 'resource_input_paths': [],
(...skipping 21 matching lines...) Expand all
95 'javac_includes': [], 94 'javac_includes': [],
96 'jar_excluded_classes': [], 95 'jar_excluded_classes': [],
97 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', 96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
98 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', 97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
99 'dex_path': '<(intermediate_dir)/classes.dex', 98 'dex_path': '<(intermediate_dir)/classes.dex',
100 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', 99 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
101 'push_stamp': '<(intermediate_dir)/push.stamp', 100 'push_stamp': '<(intermediate_dir)/push.stamp',
102 'link_stamp': '<(intermediate_dir)/link.stamp', 101 'link_stamp': '<(intermediate_dir)/link.stamp',
103 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', 102 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp',
104 'codegen_input_paths': [], 103 'codegen_input_paths': [],
105 'keystore_path': '<(DEPTH)/build/android/ant/chromium-debug.keystore',
106 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', 104 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
107 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', 105 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
106 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
108 'source_dir': '<(java_in_dir)/src', 107 'source_dir': '<(java_in_dir)/src',
109 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', 108 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
110 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFI GURATION_NAME)', 109 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFI GURATION_NAME)',
111 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', 110 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
112 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh ', 111 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh ',
112 'create_standalone_apk%': 1,
113 'variables': { 113 'variables': {
114 'variables': {
115 'native_lib_target%': '',
116 },
114 'conditions': [ 117 'conditions': [
118 ['gyp_managed_install == 1 and native_lib_target != ""', {
119 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand alone-unsigned.apk',
120 }, {
121 'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
122 }],
115 ['gyp_managed_install == 1', { 123 ['gyp_managed_install == 1', {
116 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', 124 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
117 }, { 125 }, {
118 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', 126 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
119 }], 127 }],
120 ], 128 ],
121 }, 129 },
130 'native_lib_target%': '',
122 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', 131 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
132 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
123 }, 133 },
124 # Pass the jar path to the apk's "fake" jar target. This would be better as 134 # Pass the jar path to the apk's "fake" jar target. This would be better as
125 # direct_dependent_settings, but a variable set by a direct_dependent_settings 135 # direct_dependent_settings, but a variable set by a direct_dependent_settings
126 # cannot be lifted in a dependent to all_dependent_settings. 136 # cannot be lifted in a dependent to all_dependent_settings.
127 'all_dependent_settings': { 137 'all_dependent_settings': {
128 'variables': { 138 'variables': {
129 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', 139 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
130 }, 140 },
131 }, 141 },
132 'conditions': [ 142 'conditions': [
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 'stripped_libraries_dir': '<(libraries_source_dir)', 233 'stripped_libraries_dir': '<(libraries_source_dir)',
224 'input_paths': ['<@(native_libs_paths)'], 234 'input_paths': ['<@(native_libs_paths)'],
225 'stamp': '<(strip_stamp)' 235 'stamp': '<(strip_stamp)'
226 }, 236 },
227 'includes': ['../build/android/strip_native_libraries.gypi'], 237 'includes': ['../build/android/strip_native_libraries.gypi'],
228 }, 238 },
229 ], 239 ],
230 'conditions': [ 240 'conditions': [
231 ['gyp_managed_install == 1', { 241 ['gyp_managed_install == 1', {
232 'variables': { 242 'variables': {
233 'libraries_source_dir': '<(intermediate_dir)/lib.stripped/<(android_ app_abi)', 243 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
244 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi) ',
234 'device_library_dir': '<(device_intermediate_dir)/lib.stripped', 245 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
235 }, 246 },
236 'dependencies': [ 247 'dependencies': [
237 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum', 248 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
238 ], 249 ],
239 'actions': [ 250 'actions': [
240 { 251 {
241 'includes': ['../build/android/push_libraries.gypi'], 252 'includes': ['../build/android/push_libraries.gypi'],
242 }, 253 },
243 { 254 {
244 'action_name': 'create device library symlinks', 255 'action_name': 'create device library symlinks',
245 'message': 'Creating links on device for <(_target_name).', 256 'message': 'Creating links on device for <(_target_name).',
246 'inputs': [ 257 'inputs': [
247 '<(DEPTH)/build/android/gyp/util/build_utils.py', 258 '<(DEPTH)/build/android/gyp/util/build_utils.py',
248 '<(DEPTH)/build/android/gyp/create_device_library_links.py', 259 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
249 '<(apk_install_record)', 260 '<(apk_install_record)',
250 '<(ordered_libraries_file)', 261 '<(ordered_libraries_file)',
251 ], 262 ],
252 'outputs': [ 263 'outputs': [
253 '<(link_stamp)' 264 '<(link_stamp)'
254 ], 265 ],
255 'action': [ 266 'action': [
256 'python', '<(DEPTH)/build/android/gyp/create_device_library_link s.py', 267 'python', '<(DEPTH)/build/android/gyp/create_device_library_link s.py',
257 '--libraries-json=<(ordered_libraries_file)', 268 '--libraries-json=<(ordered_libraries_file)',
258 '--script-host-path=<(symlink_script_host_path)', 269 '--script-host-path=<(symlink_script_host_path)',
259 '--script-device-path=<(symlink_script_device_path)', 270 '--script-device-path=<(symlink_script_device_path)',
260 '--target-dir=<(device_library_dir)', 271 '--target-dir=<(device_library_dir)',
261 '--apk=<(final_apk_path)', 272 '--apk=<(incomplete_apk_path)',
262 '--stamp=<(link_stamp)', 273 '--stamp=<(link_stamp)',
263 ], 274 ],
264 }, 275 },
265 ], 276 ],
277 'conditions': [
278 ['create_standalone_apk == 1', {
279 'actions': [
280 {
281 'action_name': 'create standalone APK',
282 'variables': {
283 'inputs': [
284 '<(ordered_libraries_file)',
285 '<(strip_stamp)',
286 ],
287 'input_apk_path': '<(unsigned_apk_path)',
288 'output_apk_path': '<(unsigned_standalone_apk_path)',
289 'libraries_top_dir%': '<(libraries_top_dir)',
290 },
291 'includes': [ 'android/create_standalone_apk_action.gypi' ],
292 },
293 ],
294 }],
295 ],
266 }, { 296 }, {
267 # gyp_managed_install != 1 297 # gyp_managed_install != 1
268 'variables': { 298 'variables': {
269 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_ap p_abi)', 299 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_ap p_abi)',
270 'package_input_paths': [ '<(strip_stamp)' ], 300 'package_input_paths': [ '<(strip_stamp)' ],
271 }, 301 },
272 }], 302 }],
273 ], 303 ],
274 }], # native_lib_target != '' 304 }], # native_lib_target != ''
305 ['gyp_managed_install == 0 or create_standalone_apk == 1', {
306 'actions': [
307 {
308 'action_name': 'finalize standalone apk',
309 'variables': {
310 'input_apk_path': '<(unsigned_standalone_apk_path)',
311 'output_apk_path': '<(final_apk_path)',
312 },
313 'includes': [ 'android/finalize_apk_action.gypi']
314 },
315 ],
316 }],
275 ['java_strings_grd != ""', { 317 ['java_strings_grd != ""', {
276 'variables': { 318 'variables': {
277 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit ', 319 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit ',
278 'additional_res_dirs': ['<(res_grit_dir)'], 320 'additional_res_dirs': ['<(res_grit_dir)'],
279 # grit_grd_file is used by grit_action.gypi, included below. 321 # grit_grd_file is used by grit_action.gypi, included below.
280 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', 322 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)',
281 'resource_input_paths': [ 323 'resource_input_paths': [
282 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir )" <(grit_grd_file))' 324 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir )" <(grit_grd_file))'
283 ], 325 ],
284 }, 326 },
285 'actions': [ 327 'actions': [
286 { 328 {
287 'action_name': 'generate_localized_strings_xml', 329 'action_name': 'generate_localized_strings_xml',
288 'variables': { 330 'variables': {
289 'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'], 331 'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'],
290 'grit_out_dir': '<(res_grit_dir)', 332 'grit_out_dir': '<(res_grit_dir)',
291 # resource_ids is unneeded since we don't generate .h headers. 333 # resource_ids is unneeded since we don't generate .h headers.
292 'grit_resource_ids': '', 334 'grit_resource_ids': '',
293 }, 335 },
294 'includes': ['../build/grit_action.gypi'], 336 'includes': ['../build/grit_action.gypi'],
295 }, 337 },
296 ], 338 ],
297 }], 339 }],
298 ['gyp_managed_install == 1', { 340 ['gyp_managed_install == 1', {
299 'actions': [ 341 'actions': [
300 { 342 {
343 'action_name': 'finalize incomplete apk',
344 'variables': {
345 'input_apk_path': '<(unsigned_apk_path)',
346 'output_apk_path': '<(incomplete_apk_path)',
347 },
348 'includes': [ 'android/finalize_apk_action.gypi']
349 },
350 {
301 'action_name': 'apk_install_<(_target_name)', 351 'action_name': 'apk_install_<(_target_name)',
302 'message': 'Installing <(apk_name).apk', 352 'message': 'Installing <(apk_name).apk',
303 'inputs': [ 353 'inputs': [
304 '<(DEPTH)/build/android/gyp/util/build_utils.py', 354 '<(DEPTH)/build/android/gyp/util/build_utils.py',
305 '<(DEPTH)/build/android/gyp/apk_install.py', 355 '<(DEPTH)/build/android/gyp/apk_install.py',
306 '<(final_apk_path)', 356 '<(incomplete_apk_path)',
307 ], 357 ],
308 'outputs': [ 358 'outputs': [
309 '<(apk_install_record)', 359 '<(apk_install_record)',
310 # If a user switches the connected device, the APK may need to be 360 # If a user switches the connected device, the APK may need to be
311 # installed even if there have been no changes. To ensure that the 361 # installed even if there have been no changes. To ensure that the
312 # APK on the device is always up-to-date, this step should always 362 # APK on the device is always up-to-date, this step should always
313 # be triggered. 363 # be triggered.
314 '<(apk_install_record).fake', 364 '<(apk_install_record).fake',
315 ], 365 ],
316 'action': [ 366 'action': [
317 'python', '<(DEPTH)/build/android/gyp/apk_install.py', 367 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
318 '--android-sdk-tools=<(android_sdk_tools)', 368 '--android-sdk-tools=<(android_sdk_tools)',
319 '--apk-path=<(final_apk_path)', 369 '--apk-path=<(incomplete_apk_path)',
320 '--install-record=<(apk_install_record)' 370 '--install-record=<(apk_install_record)'
321 ], 371 ],
322 }, 372 },
323 ], 373 ],
324 }], 374 }],
325 ], 375 ],
326 'actions': [ 376 'actions': [
327 { 377 {
328 'action_name': 'ant_codegen_<(_target_name)', 378 'action_name': 'ant_codegen_<(_target_name)',
329 'message': 'Generating R.java for <(_target_name)', 379 'message': 'Generating R.java for <(_target_name)',
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 '-Dbasedir=.', 626 '-Dbasedir=.',
577 '-buildfile', 627 '-buildfile',
578 '<(DEPTH)/build/android/ant/apk-package.xml', 628 '<(DEPTH)/build/android/ant/apk-package.xml',
579 629
580 # Add list of inputs to the command line, so if inputs change 630 # Add list of inputs to the command line, so if inputs change
581 # (e.g. if a Java file is removed), the command will be re-run. 631 # (e.g. if a Java file is removed), the command will be re-run.
582 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. 632 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
583 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', 633 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)',
584 ] 634 ]
585 }, 635 },
586 {
587 'action_name': 'finalize_apk',
588 'message': 'Signing/aligning <(_target_name) APK.',
589 'inputs': [
590 '<(DEPTH)/build/android/gyp/util/build_utils.py',
591 '<(DEPTH)/build/android/gyp/finalize_apk.py',
592 '<(unsigned_apk_path)',
593 ],
594 'outputs': [
595 '<(final_apk_path)',
596 ],
597 'action': [
598 'python', '<(DEPTH)/build/android/gyp/finalize_apk.py',
599 '--android-sdk-root=<(android_sdk_root)',
600 '--unsigned-apk-path=<(unsigned_apk_path)',
601 '--final-apk-path=<(final_apk_path)',
602 '--keystore-path=<(keystore_path)',
603
604 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
605 '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
606 ],
607 },
608 ], 636 ],
609 } 637 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698