0

Move shared library copy and strip to java_apk.gypi

Also, for each such shared library included in an apk, create a link in
the appropriate directory in <(android_product_out) to enable annotating
native stack traces for those apks.

BUG=


Review URL: https://chromiumcodereview.appspot.com/11096038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161440 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
cjhopman@chromium.org
2012-10-11 23:23:49 +00:00
parent 06ae764c59
commit cbd76ebec7
5 changed files with 65 additions and 49 deletions

@ -128,9 +128,10 @@
'variables': {
'package_name': 'android_webview',
'apk_name': 'AndroidWebView',
'manifest_package_name': 'org.chromium.android_webview',
'java_in_dir': '../android_webview/java',
'resource_dir': '../res',
'native_libs_paths': ['<(PRODUCT_DIR)/android_webview/libs/<(android_app_abi)/libwebview.so'],
'native_libs_paths': ['<(SHARED_LIB_DIR)/libwebview.so'],
'input_pak_files': [
'<(SHARED_INTERMEDIATE_DIR)/repack/chrome.pak',
'<(SHARED_INTERMEDIATE_DIR)/repack/chrome_100_percent.pak',
@ -145,20 +146,6 @@
],
'additional_input_paths': [ '<@(copied_pak_files)' ],
},
'actions': [
{
'action_name': 'copy_and_strip_so',
'inputs': ['<(SHARED_LIB_DIR)/libwebview.so'],
'outputs': ['<(PRODUCT_DIR)/android_webview/libs/<(android_app_abi)/libwebview.so'],
'action': [
'<(android_strip)',
'--strip-unneeded', # All symbols not needed for relocation.
'<@(_inputs)',
'-o',
'<@(_outputs)',
],
},
],
'copies': [
{
'destination': '<(PRODUCT_DIR)/android_webview/assets',

@ -0,0 +1,24 @@
#!/bin/bash
# Copyright (c) 2012 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.
# Creates a stripped copy of a library and a link to the unstripped copy.
# The stripped copy is included in the apk and the link is needed for the crash
# stack annotation tool.
if [[ $# -ne 4 ]]
then
echo "Usage: prepare_library_for_apk android_strip path/to/library stripped/library/output/path link/output/path"
exit 1
fi
ANDROID_STRIP=$1
LIBRARY=$2
STRIPPED=$3
LINK=$4
set -x
mkdir -p $LINK
$ANDROID_STRIP --strip-unneeded $LIBRARY -o $STRIPPED
ln -f $LIBRARY $LINK

@ -48,21 +48,52 @@
# input_jars_paths - The path to jars to be included in the classpath. This
# should be filled automatically by depending on the appropriate targets.
# native_libs_paths - The path to any native library to be included in this
# target.
# target. This should be a path in <(SHARED_LIB_DIR). A stripped copy of
# the library will be included in the apk and symbolic links to the
# unstripped copy will be added to <(android_product_out) to enable native
# debugging.
{
'variables': {
'asset_location%': '',
'additional_input_paths': [],
'input_jars_paths': [],
'native_libs_paths': [],
'additional_src_dirs': [],
'generated_src_dirs': [],
'app_manifest_version_name%': '<(android_app_version_name)',
'app_manifest_version_code%': '<(android_app_version_code)',
'proguard_enabled%': 'false',
'proguard_flags%': ''
'proguard_flags%': '',
'native_libs_paths': [],
'manifest_package_name%': 'unknown.package.name',
},
'sources': [
'<@(native_libs_paths)'
],
'rules': [
{
'rule_name': 'copy_and_strip_native_libraries',
'extension': 'so',
'variables': {
'stripped_library_path': '<(PRODUCT_DIR)/<(package_name)/libs/<(android_app_abi)/<(RULE_INPUT_ROOT).so',
'link_dir': '<(android_product_out)/symbols/data/data/<(manifest_package_name)/lib/',
},
'outputs': [
'<(stripped_library_path)',
'<(link_dir)/<(RULE_INPUT_ROOT).so',
],
# There is no way to do 2 actions for each source library in gyp. So to
# both strip the library and create the link in <(link_dir) a separate
# script is required.
'action': [
'<(DEPTH)/build/android/prepare_library_for_apk',
'<(android_strip)',
'<(RULE_INPUT_PATH)',
'<(stripped_library_path)',
'<(link_dir)',
],
},
],
'actions': [
{
'action_name': 'ant_<(package_name)_apk',
@ -72,7 +103,7 @@
'<(DEPTH)/build/android/ant/chromium-apk.xml',
'<(DEPTH)/build/android/ant/common.xml',
'<(DEPTH)/build/android/ant/sdk-targets.xml',
# If there is a separate find for additonal_src_dirs, it will find the
# If there is a separate find for additional_src_dirs, it will find the
# wrong .java files when additional_src_dirs is empty.
'>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")',
'<!@(find <(java_in_dir)/<(resource_dir) -name "*")',

@ -51,26 +51,13 @@
'variables': {
'package_name': 'chromium_testshell',
'apk_name': 'ChromiumTestShell',
'manifest_package_name': 'org.chromium.chrome.testshell',
'java_in_dir': 'android/testshell/java',
'resource_dir': '../res',
'asset_location': '<(ant_build_out)/../assets/chrome',
'native_libs_paths': [ '<(PRODUCT_DIR)/chromium_testshell/libs/<(android_app_abi)/libchromiumtestshell.so', ],
'native_libs_paths': [ '<(SHARED_LIB_DIR)/libchromiumtestshell.so', ],
'additional_input_paths': [ '<@(chrome_android_pak_output_resources)', ],
},
'actions': [
{
'action_name': 'copy_and_strip_so',
'inputs': ['<(SHARED_LIB_DIR)/libchromiumtestshell.so'],
'outputs': ['<(PRODUCT_DIR)/chromium_testshell/libs/<(android_app_abi)/libchromiumtestshell.so'],
'action': [
'<(android_strip)',
'--strip-unneeded',
'<@(_inputs)',
'-o',
'<@(_outputs)',
],
},
],
'includes': [ '../build/java_apk.gypi', ],
},
{

@ -650,27 +650,14 @@
'variables': {
'package_name': 'content_shell',
'apk_name': 'ContentShell',
'manifest_package_name': 'org.chromium.content_shell',
'java_in_dir': 'shell/android/java',
# TODO(cjhopman): The resource directory of all apks should be in
# <java_in_dir>/res.
'resource_dir': '../res',
'native_libs_paths': ['<(PRODUCT_DIR)/content_shell/libs/<(android_app_abi)/libcontent_shell_content_view.so'],
'native_libs_paths': ['<(SHARED_LIB_DIR)/libcontent_shell_content_view.so'],
'additional_input_paths': ['<(PRODUCT_DIR)/content_shell/assets/content_shell.pak'],
},
'actions': [
{
'action_name': 'copy_and_strip_so',
'inputs': ['<(SHARED_LIB_DIR)/libcontent_shell_content_view.so'],
'outputs': ['<(PRODUCT_DIR)/content_shell/libs/<(android_app_abi)/libcontent_shell_content_view.so'],
'action': [
'<(android_strip)',
'--strip-unneeded', # All symbols not needed for relocation.
'<@(_inputs)',
'-o',
'<@(_outputs)',
],
},
],
'includes': [ '../build/java_apk.gypi' ],
},
],