diff options
author | dfalcantara@chromium.org <dfalcantara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 21:42:06 +0000 |
---|---|---|
committer | dfalcantara@chromium.org <dfalcantara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 21:42:06 +0000 |
commit | d67b1ce8691f3a829d090f401d22485b8c99adfc (patch) | |
tree | b4daadb6ccf52db0357e6264a596a0a8dee6bc19 /build | |
parent | 44c4b354a12e74b4af35be64853745ec9afe0d33 (diff) | |
download | chromium_src-d67b1ce8691f3a829d090f401d22485b8c99adfc.zip chromium_src-d67b1ce8691f3a829d090f401d22485b8c99adfc.tar.gz chromium_src-d67b1ce8691f3a829d090f401d22485b8c99adfc.tar.bz2 |
Revert "[Android] Support building standalone APK in component build"
This breaks the Android component build.
This reverts commit 125e64a9eb6406446fb864aea9fa887521f19616.
>> [Android] Support building standalone APK in component build
>>
>> Many people's workflows assume that they can install the APK created in
>> out/Debug/apks. With the component build that APK is actually an
>> "incomplete" APK that cannot be manually installed (or rather causes
>> obscure errors when manually installed).
>>
>> This change does two things. First, it moves the "incomplete" APK
>> output to out/Debug/<package_name>/<ApkName>.apk. This should prevent
>> accidental installs of the "incomplete" APK. Second, it introduces an
>> option (create_standalone_apk) that when doing a component build, if
>> set, will merge the shared libraries into the "incomplete" APK to
>> create a standalone APK. This standalone APK will be created in
>> out/Debug/apks/.
>>
>> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=207345
>>
>> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=207516
BUG=
R=cjhopman@chromium.org
Review URL: https://codereview.chromium.org/17291013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r-- | build/android/create_standalone_apk_action.gypi | 41 | ||||
-rw-r--r-- | build/android/developer_recommended_flags.gypi | 9 | ||||
-rw-r--r-- | build/android/finalize_apk_action.gypi | 46 | ||||
-rwxr-xr-x | build/android/gyp/create_standalone_apk.py | 61 | ||||
-rw-r--r-- | build/common.gypi | 1 | ||||
-rw-r--r-- | build/java_apk.gypi | 76 |
6 files changed, 29 insertions, 205 deletions
diff --git a/build/android/create_standalone_apk_action.gypi b/build/android/create_standalone_apk_action.gypi deleted file mode 100644 index ca9c190..0000000 --- a/build/android/create_standalone_apk_action.gypi +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This file is meant to be included into an action to provide an action that -# combines a directory of shared libraries and an incomplete APK into a -# standalone APK. -# -# To use this, create a gyp action with the following form: -# { -# 'action_name': 'some descriptive action name', -# 'variables': { -# 'inputs': [ 'input_path1', 'input_path2' ], -# 'input_apk_path': '<(unsigned_apk_path)', -# 'output_apk_path': '<(unsigned_standalone_apk_path)', -# 'libraries_top_dir': '<(libraries_top_dir)', -# }, -# 'includes': [ 'relative/path/to/create_standalone_apk_action.gypi' ], -# }, - -{ - 'message': 'Creating standalone APK: <(output_apk_path)', - 'variables': { - 'inputs': [], - }, - 'inputs': [ - '<(DEPTH)/build/android/gyp/util/build_utils.py', - '<(DEPTH)/build/android/gyp/create_standalone_apk.py', - '<(input_apk_path)', - '>@(inputs)', - ], - 'outputs': [ - '<(output_apk_path)', - ], - 'action': [ - 'python', '<(DEPTH)/build/android/gyp/create_standalone_apk.py', - '--libraries-top-dir=<(libraries_top_dir)', - '--input-apk-path=<(unsigned_apk_path)', - '--output-apk-path=<(unsigned_standalone_apk_path)', - ], -} diff --git a/build/android/developer_recommended_flags.gypi b/build/android/developer_recommended_flags.gypi index 2847096..2edf9ab 100644 --- a/build/android/developer_recommended_flags.gypi +++ b/build/android/developer_recommended_flags.gypi @@ -37,16 +37,11 @@ # with each device attached. This greatly reduces the time required for incremental builds. # # This comes with some caveats: - # Only works with a single device connected (it will print a warning if - # zero or multiple devices are attached). + # Only works with a single device connected. # Some actions are always run (i.e. ninja will never say "no work to do"). + # Native libraries are not packaged in the APK (you can not manually install the APK) 'gyp_managed_install%': 1, - # With gyp_managed_install, we do not necessarily need a standalone APK. - # When create_standalone_apk is set to 1, we will build a standalone APK - # anyway. For even faster builds, you can set create_standalone_apk to 0. - 'create_standalone_apk%': 1, - # Set clang to 1 to use the clang compiler. Clang has much (much, much) better warning/error # messages than gcc. # TODO(cjhopman): Enable this when http://crbug.com/156420 is addressed. Until then, users can diff --git a/build/android/finalize_apk_action.gypi b/build/android/finalize_apk_action.gypi deleted file mode 100644 index 5ee6043..0000000 --- a/build/android/finalize_apk_action.gypi +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This file is meant to be included into an action to provide an action that -# signs and zipaligns an APK. -# -# To use this, create a gyp action with the following form: -# { -# 'action_name': 'some descriptive action name', -# 'variables': { -# 'inputs': [ 'input_path1', 'input_path2' ], -# 'input_apk_path': 'relative/path/to/input.apk', -# 'output_apk_path': 'relative/path/to/output.apk', -# }, -# 'includes': [ '../../build/android/finalize_apk.gypi' ], -# }, -# - -{ - 'message': 'Signing/aligning <(_target_name) APK: <(input_apk_path).', - 'variables': { - 'inputs': [], - 'keystore_path%': '<(DEPTH)/build/android/ant/chromium-debug.keystore', - }, - 'inputs': [ - '<(DEPTH)/build/android/gyp/util/build_utils.py', - '<(DEPTH)/build/android/gyp/finalize_apk.py', - '<(keystore_path)', - '<(input_apk_path)', - '>@(inputs)', - ], - 'outputs': [ - '<(output_apk_path)', - ], - 'action': [ - 'python', '<(DEPTH)/build/android/gyp/finalize_apk.py', - '--android-sdk-root=<(android_sdk_root)', - '--unsigned-apk-path=<(input_apk_path)', - '--final-apk-path=<(output_apk_path)', - '--keystore-path=<(keystore_path)', - - # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. - '--ignore=>!(echo \'>(_inputs)\' | md5sum)', - ], -} diff --git a/build/android/gyp/create_standalone_apk.py b/build/android/gyp/create_standalone_apk.py deleted file mode 100755 index de541a6..0000000 --- a/build/android/gyp/create_standalone_apk.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Combines stripped libraries and incomplete APK into single standalone APK. - -""" - -import optparse -import os -import shutil -import sys -import tempfile - -from util import build_utils -from util import md5_check - -def CreateStandaloneApk(options): - def DoZip(): - with tempfile.NamedTemporaryFile(suffix='.zip') as intermediate_file: - intermediate_path = intermediate_file.name - shutil.copy(options.input_apk_path, intermediate_path) - apk_path_abs = os.path.abspath(intermediate_path) - build_utils.CheckCallDie( - ['zip', '-r', '-1', apk_path_abs, 'lib'], - cwd=options.libraries_top_dir, - suppress_output=True) - shutil.copy(intermediate_path, options.output_apk_path) - - input_paths = [options.input_apk_path, options.libraries_top_dir] - record_path = '%s.standalone.stamp' % options.input_apk_path - md5_check.CallAndRecordIfStale( - DoZip, - record_path=record_path, - input_paths=input_paths) - - -def main(argv): - parser = optparse.OptionParser() - parser.add_option('--libraries-top-dir', - help='Top directory that contains libraries ' - '(i.e. library paths are like ' - 'libraries_top_dir/lib/android_app_abi/foo.so).') - parser.add_option('--input-apk-path', help='Path to incomplete APK.') - parser.add_option('--output-apk-path', help='Path for standalone APK.') - parser.add_option('--stamp', help='Path to touch on success.') - options, _ = parser.parse_args() - - required_options = ['libraries_top_dir', 'input_apk_path', 'output_apk_path'] - build_utils.CheckOptions(options, parser, required=required_options) - - CreateStandaloneApk(options) - - if options.stamp: - build_utils.Touch(options.stamp) - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/build/common.gypi b/build/common.gypi index d8222e1..23d0530 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -818,7 +818,6 @@ 'use_system_libjpeg%': '<(use_system_libjpeg)', 'android_webview_build%': '<(android_webview_build)', 'gyp_managed_install%': 0, - 'create_standalone_apk%': 1, 'google_tv%': '<(google_tv)', 'enable_app_list%': '<(enable_app_list)', 'use_default_render_theme%': '<(use_default_render_theme)', diff --git a/build/java_apk.gypi b/build/java_apk.gypi index db0ae81..8c794f0 100644 --- a/build/java_apk.gypi +++ b/build/java_apk.gypi @@ -102,28 +102,24 @@ 'link_stamp': '<(intermediate_dir)/link.stamp', 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', 'codegen_input_paths': [], + 'keystore_path': '<(DEPTH)/build/android/ant/chromium-debug.keystore', 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', - 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', 'source_dir': '<(java_in_dir)/src', 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFIGURATION_NAME)', 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh', - 'create_standalone_apk%': 1, 'variables': { 'conditions': [ ['gyp_managed_install == 1', { 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', - 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk', }, { 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', - 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', }], ], }, 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', - 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', }, # Pass the jar path to the apk's "fake" jar target. This would be better as # direct_dependent_settings, but a variable set by a direct_dependent_settings @@ -234,8 +230,7 @@ 'conditions': [ ['gyp_managed_install == 1', { 'variables': { - 'libraries_top_dir': '<(intermediate_dir)/lib.stripped', - 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)', + 'libraries_source_dir': '<(intermediate_dir)/lib.stripped/<(android_app_abi)', 'device_library_dir': '<(device_intermediate_dir)/lib.stripped', }, 'dependencies': [ @@ -263,30 +258,11 @@ '--script-host-path=<(symlink_script_host_path)', '--script-device-path=<(symlink_script_device_path)', '--target-dir=<(device_library_dir)', - '--apk=<(incomplete_apk_path)', + '--apk=<(final_apk_path)', '--stamp=<(link_stamp)', ], }, ], - 'conditions': [ - ['create_standalone_apk == 1', { - 'actions': [ - { - 'action_name': 'create standalone APK', - 'variables': { - 'inputs': [ - '<(ordered_libraries_file)', - '<(strip_stamp)', - ], - 'input_apk_path': '<(unsigned_apk_path)', - 'output_apk_path': '<(unsigned_standalone_apk_path)', - 'libraries_top_dir%': '<(libraries_top_dir)', - }, - 'includes': [ 'android/create_standalone_apk_action.gypi' ], - }, - ], - }], - ], }, { # gyp_managed_install != 1 'variables': { @@ -296,18 +272,6 @@ }], ], }], # native_lib_target != '' - ['gyp_managed_install == 0 or create_standalone_apk == 1', { - 'actions': [ - { - 'action_name': 'finalize standalone apk', - 'variables': { - 'input_apk_path': '<(unsigned_standalone_apk_path)', - 'output_apk_path': '<(final_apk_path)', - }, - 'includes': [ 'android/finalize_apk_action.gypi'] - }, - ], - }], ['java_strings_grd != ""', { 'variables': { 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit', @@ -334,20 +298,12 @@ ['gyp_managed_install == 1', { 'actions': [ { - 'action_name': 'finalize incomplete apk', - 'variables': { - 'input_apk_path': '<(unsigned_apk_path)', - 'output_apk_path': '<(incomplete_apk_path)', - }, - 'includes': [ 'android/finalize_apk_action.gypi'] - }, - { 'action_name': 'apk_install_<(_target_name)', 'message': 'Installing <(apk_name).apk', 'inputs': [ '<(DEPTH)/build/android/gyp/util/build_utils.py', '<(DEPTH)/build/android/gyp/apk_install.py', - '<(incomplete_apk_path)', + '<(final_apk_path)', ], 'outputs': [ '<(apk_install_record)', @@ -360,7 +316,7 @@ 'action': [ 'python', '<(DEPTH)/build/android/gyp/apk_install.py', '--android-sdk-tools=<(android_sdk_tools)', - '--apk-path=<(incomplete_apk_path)', + '--apk-path=<(final_apk_path)', '--install-record=<(apk_install_record)' ], }, @@ -627,5 +583,27 @@ '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', ] }, + { + 'action_name': 'finalize_apk', + 'message': 'Signing/aligning <(_target_name) APK.', + 'inputs': [ + '<(DEPTH)/build/android/gyp/util/build_utils.py', + '<(DEPTH)/build/android/gyp/finalize_apk.py', + '<(unsigned_apk_path)', + ], + 'outputs': [ + '<(final_apk_path)', + ], + 'action': [ + 'python', '<(DEPTH)/build/android/gyp/finalize_apk.py', + '--android-sdk-root=<(android_sdk_root)', + '--unsigned-apk-path=<(unsigned_apk_path)', + '--final-apk-path=<(final_apk_path)', + '--keystore-path=<(keystore_path)', + + # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. + '--ignore=>!(echo \'>(_inputs)\' | md5sum)', + ], + }, ], } |