From 679147eead574d186ebf3069647b4c23e8ccace6 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Thu, 15 Aug 2013 21:46:11 +0200 Subject: Initial import. --- chromium/build/android/chrome_with_libs.gyp | 82 ++++++++++++++++++++++ chromium/build/android/cpufeatures.gypi | 31 ++++++++ .../android/create_standalone_apk_action.gypi | 41 +++++++++++ .../build/android/developer_recommended_flags.gypi | 61 ++++++++++++++++ chromium/build/android/dex_action.gypi | 61 ++++++++++++++++ chromium/build/android/finalize_apk_action.gypi | 46 ++++++++++++ chromium/build/android/java_cpp_template.gypi | 78 ++++++++++++++++++++ .../build/android/native_app_dependencies.gypi | 62 ++++++++++++++++ chromium/build/android/push_libraries.gypi | 45 ++++++++++++ chromium/build/android/setup.gyp | 82 ++++++++++++++++++++++ chromium/build/android/strip_native_libraries.gypi | 54 ++++++++++++++ .../multiple_proguards/multiple_proguards.gyp | 35 +++++++++ .../build/android/write_ordered_libraries.gypi | 42 +++++++++++ 13 files changed, 720 insertions(+) create mode 100644 chromium/build/android/chrome_with_libs.gyp create mode 100644 chromium/build/android/cpufeatures.gypi create mode 100644 chromium/build/android/create_standalone_apk_action.gypi create mode 100644 chromium/build/android/developer_recommended_flags.gypi create mode 100644 chromium/build/android/dex_action.gypi create mode 100644 chromium/build/android/finalize_apk_action.gypi create mode 100644 chromium/build/android/java_cpp_template.gypi create mode 100644 chromium/build/android/native_app_dependencies.gypi create mode 100644 chromium/build/android/push_libraries.gypi create mode 100644 chromium/build/android/setup.gyp create mode 100644 chromium/build/android/strip_native_libraries.gypi create mode 100644 chromium/build/android/tests/multiple_proguards/multiple_proguards.gyp create mode 100644 chromium/build/android/write_ordered_libraries.gypi (limited to 'chromium/build/android') diff --git a/chromium/build/android/chrome_with_libs.gyp b/chromium/build/android/chrome_with_libs.gyp new file mode 100644 index 00000000000..690be885f0a --- /dev/null +++ b/chromium/build/android/chrome_with_libs.gyp @@ -0,0 +1,82 @@ +# 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 add more loadable libs into Chrome_apk. +# +# This is useful when building Chrome_apk with some loadable modules which are +# not included in Chrome_apk. +# As an example, when building Chrome_apk with +# libpeer_target_type=loadable_module, +# the libpeerconnection.so is not included in Chrome_apk. To add the missing +# lib, follow the steps below: +# - Run gyp: +# GYP_DEFINES="$GYP_DEFINES libpeer_target_type=loadable_module" CHROMIUM_GYP_FILE="build/android/chrome_with_libs.gyp" build/gyp_chromium +# - Build chrome_with_libs: +# ninja (or make) chrome_with_libs +# +# This tool also allows replacing the loadable module with a new one via the +# following steps: +# - Build Chrome_apk with the gyp define: +# GYP_DEFINES="$GYP_DEFINES libpeer_target_type=loadable_module" build/gyp_chromium +# ninja (or make) Chrome_apk +# - Replace libpeerconnection.so with a new one: +# cp the_new_one path/to/libpeerconnection.so +# - Run gyp: +# GYP_DEFINES="$GYP_DEFINES libpeer_target_type=loadable_module" CHROMIUM_GYP_FILE="build/android/chrome_with_libs.gyp" build/gyp_chromium +# - Build chrome_with_libs: +# ninja (or make) chrome_with_libs +{ + 'targets': [ + { + # An "All" target is required for a top-level gyp-file. + 'target_name': 'All', + 'type': 'none', + 'dependencies': [ + 'chrome_with_libs', + ], + }, + { + 'target_name': 'chrome_with_libs', + 'type': 'none', + 'variables': { + 'intermediate_dir': '<(PRODUCT_DIR)/prebuilt_libs/', + 'chrome_unsigned_path': '<(PRODUCT_DIR)/chrome_apk/Chrome-unsigned.apk', + 'chrome_with_libs_unsigned': '<(intermediate_dir)/Chrome-with-libs-unsigned.apk', + 'chrome_with_libs_final': '<(PRODUCT_DIR)/apks/Chrome-with-libs.apk', + }, + 'dependencies': [ + '<(DEPTH)/clank/native/framework/clank.gyp:chrome_apk' + ], + 'copies': [ + { + 'destination': '<(intermediate_dir)/lib/<(android_app_abi)', + 'files': [ + '<(PRODUCT_DIR)/libpeerconnection.so', + ], + }, + ], + 'actions': [ + { + 'action_name': 'put_libs_in_chrome', + 'variables': { + 'inputs': [ + '<(intermediate_dir)/lib/<(android_app_abi)/libpeerconnection.so', + ], + 'input_apk_path': '<(chrome_unsigned_path)', + 'output_apk_path': '<(chrome_with_libs_unsigned)', + 'libraries_top_dir%': '<(intermediate_dir)', + }, + 'includes': [ 'create_standalone_apk_action.gypi' ], + }, + { + 'action_name': 'finalize_chrome_with_libs', + 'variables': { + 'input_apk_path': '<(chrome_with_libs_unsigned)', + 'output_apk_path': '<(chrome_with_libs_final)', + }, + 'includes': [ 'finalize_apk_action.gypi'], + }, + ], + }], +} diff --git a/chromium/build/android/cpufeatures.gypi b/chromium/build/android/cpufeatures.gypi new file mode 100644 index 00000000000..c08e95641a8 --- /dev/null +++ b/chromium/build/android/cpufeatures.gypi @@ -0,0 +1,31 @@ +# 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. + +# Depend on the Android NDK's cpu feature detection. The WebView build is part +# of the system and the library already exists; for the normal build there is a +# gyp file in the checked-in NDK to build it. +{ + 'conditions': [ + ['android_webview_build == 1', { + # This is specified twice intentionally: Android provides include paths + # to targets automatically if they depend on libraries, so we add this + # library to every target that includes this .gypi to make the headers + # available, then also add it to targets that link those targets via + # link_settings to ensure it ends up being linked even if the main target + # doesn't include this .gypi. + 'libraries': [ + 'cpufeatures.a', + ], + 'link_settings': { + 'libraries': [ + 'cpufeatures.a', + ], + }, + }, { + 'dependencies': [ + '<(android_ndk_root)/android_tools_ndk.gyp:cpu_features', + ], + }], + ], +} diff --git a/chromium/build/android/create_standalone_apk_action.gypi b/chromium/build/android/create_standalone_apk_action.gypi new file mode 100644 index 00000000000..d17af7c8e5d --- /dev/null +++ b/chromium/build/android/create_standalone_apk_action.gypi @@ -0,0 +1,41 @@ +# 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=<(input_apk_path)', + '--output-apk-path=<(output_apk_path)', + ], +} diff --git a/chromium/build/android/developer_recommended_flags.gypi b/chromium/build/android/developer_recommended_flags.gypi new file mode 100644 index 00000000000..28470963c24 --- /dev/null +++ b/chromium/build/android/developer_recommended_flags.gypi @@ -0,0 +1,61 @@ +# 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 is the set of recommended gyp variable settings for Chrome for Android development. +# +# These can be used by copying this file to $CHROME_SRC/chrome/supplement.gypi. +# +# Even better, create chrome/supplement.gypi containing the following: +# { +# 'includes': [ '../build/android/developer_recommended_flags.gypi' ] +# } +# and you'll get new settings automatically. +# When using this method, you can override individual settings by setting them unconditionally (with +# no %) in chrome/supplement.gypi. +# I.e. to disable optimize_jni_generation but use everything else: +# { +# 'variables': { +# 'optimize_jni_generation': 0, +# }, +# 'includes': [ '../build/android/developer_recommended_flags.gypi' ] +# } + +{ + 'variables': { + # When set to 1, only write jni generated files if they've changed. This can prevent unnecessary + # compiling/linking of native libraries when editing java files. + 'optimize_jni_generation%': 1, + + # Set component to 'shared_library' to enable the component build. This builds native code as + # many small shared libraries instead of one monolithic library. This slightly reduces the time + # required for incremental builds. + 'component%': 'shared_library', + + # When gyp_managed_install is set to 1, building an APK will install that APK on the connected + # device(/emulator). To install on multiple devices (or onto a new device), build the APK once + # 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). + # Some actions are always run (i.e. ninja will never say "no work to do"). + '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 + # set clang to 1, but Android stack traces will sometimes be incomplete. + #'clang%': 1, + + # Set fastbuild to 1 to build with less debugging information. This can greatly decrease linking + # time. The downside is that stack traces will be missing useful information (like line + # numbers). + #'fastbuild%': 1, + }, +} diff --git a/chromium/build/android/dex_action.gypi b/chromium/build/android/dex_action.gypi new file mode 100644 index 00000000000..ac956b6e343 --- /dev/null +++ b/chromium/build/android/dex_action.gypi @@ -0,0 +1,61 @@ +# 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 a rule that dexes +# compiled java files. If proguard_enabled == "true" and CONFIGURATION_NAME == +# "Release", then it will dex the proguard_enabled_input_path instead of the +# normal dex_input_paths/dex_generated_input_paths. +# +# To use this, create a gyp target with the following form: +# { +# 'action_name': 'some name for the action' +# 'actions': [ +# 'variables': { +# 'dex_input_paths': [ 'files to dex (when proguard is not used) and add to input paths' ], +# 'dex_generated_input_dirs': [ 'dirs that contain generated files to dex' ], +# 'input_paths': [ 'additional files to be added to the list of inputs' ], +# +# # For targets that use proguard: +# 'proguard_enabled': 'true', +# 'proguard_enabled_input_path': 'path to dex when using proguard', +# }, +# 'includes': [ 'relative/path/to/dex_action.gypi' ], +# ], +# }, +# + +{ + 'message': 'Creating dex file: <(output_path)', + 'variables': { + 'dex_input_paths': [], + 'dex_generated_input_dirs': [], + 'input_paths': [], + 'proguard_enabled%': 'false', + 'proguard_enabled_input_path%': '', + }, + 'inputs': [ + '<(DEPTH)/build/android/gyp/util/build_utils.py', + '<(DEPTH)/build/android/gyp/util/md5_check.py', + '<(DEPTH)/build/android/gyp/dex.py', + '>@(input_paths)', + '>@(dex_input_paths)', + ], + 'outputs': [ + '<(output_path)', + ], + 'action': [ + 'python', '<(DEPTH)/build/android/gyp/dex.py', + '--dex-path=<(output_path)', + '--android-sdk-tools=<(android_sdk_tools)', + '--configuration-name=<(CONFIGURATION_NAME)', + '--proguard-enabled=<(proguard_enabled)', + '--proguard-enabled-input-path=<(proguard_enabled_input_path)', + + # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. + '--ignore=>!(echo \'>(_inputs)\' | md5sum)', + + '>@(dex_input_paths)', + '>@(dex_generated_input_dirs)', + ] +} diff --git a/chromium/build/android/finalize_apk_action.gypi b/chromium/build/android/finalize_apk_action.gypi new file mode 100644 index 00000000000..5ee6043b4ec --- /dev/null +++ b/chromium/build/android/finalize_apk_action.gypi @@ -0,0 +1,46 @@ +# 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/chromium/build/android/java_cpp_template.gypi b/chromium/build/android/java_cpp_template.gypi new file mode 100644 index 00000000000..fe4238af84f --- /dev/null +++ b/chromium/build/android/java_cpp_template.gypi @@ -0,0 +1,78 @@ +# 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. + +# This file is meant to be included into a target to provide a rule +# to generate Java source files from templates that are processed +# through the host C pre-processor. +# +# To use this, create a gyp target with the following form: +# { +# 'target_name': 'android_net_java_constants', +# 'type': 'none', +# 'sources': [ +# 'net/android/NetError.template', +# ], +# 'variables': { +# 'package_name': 'org/chromium/net', +# 'template_deps': ['net/base/certificate_mime_type_list.h'], +# }, +# 'includes': [ '../build/android/java_cpp_template.gypi' ], +# }, +# +# The 'sources' entry should only list template file. The template file +# itself should use the 'ClassName.template' format, and will generate +# 'gen/templates//ClassName.java. The files which template +# dependents on and typically included by the template should be listed +# in template_deps variables. Any change to them will force a rebuild of +# the template, and hence of any source that depends on it. +# + +{ + # Location where all generated Java sources will be placed. + 'variables': { + 'include_path%': '<(DEPTH)', + 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/templates/<(package_name)', + }, + 'direct_dependent_settings': { + 'variables': { + # Ensure that the output directory is used in the class path + # when building targets that depend on this one. + 'generated_src_dirs': [ + '<(output_dir)/', + ], + # Ensure dependents are rebuilt when sources for this rule change. + 'additional_input_paths': [ + '<@(_sources)', + '<@(template_deps)', + ], + }, + }, + # Define a single rule that will be apply to each .template file + # listed in 'sources'. + 'rules': [ + { + 'rule_name': 'generate_java_constants', + 'extension': 'template', + # Set template_deps as additional dependencies. + 'variables': { + 'output_path': '<(output_dir)/<(RULE_INPUT_ROOT).java', + }, + 'inputs': [ + '<(DEPTH)/build/android/gyp/util/build_utils.py', + '<(DEPTH)/build/android/gyp/gcc_preprocess.py', + '<@(template_deps)' + ], + 'outputs': [ + '<(output_path)', + ], + 'action': [ + 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', + '--include-path=<(include_path)', + '--output=<(output_path)', + '--template=<(RULE_INPUT_PATH)', + ], + 'message': 'Generating Java from cpp template <(RULE_INPUT_PATH)', + } + ], +} diff --git a/chromium/build/android/native_app_dependencies.gypi b/chromium/build/android/native_app_dependencies.gypi new file mode 100644 index 00000000000..d9241cc3032 --- /dev/null +++ b/chromium/build/android/native_app_dependencies.gypi @@ -0,0 +1,62 @@ +# 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 a target to provide a rule +# to strip and place dependent shared libraries required by a native binary in a +# single folder that can later be pushed to the device. +# +# NOTE: consider packaging your binary as an apk instead of running a native +# library. +# +# To use this, create a gyp target with the following form: +# { +# 'target_name': 'target_that_depends_on_my_binary', +# 'type': 'none', +# 'dependencies': [ +# 'my_binary', +# ], +# 'variables': { +# 'native_binary': '<(PRODUCT_DIR)/my_binary', +# 'output_dir': 'location to place binary and dependent libraries' +# }, +# 'includes': [ '../../build/android/native_app_dependencies.gypi' ], +# }, +# + +{ + 'copies': [ + { + 'destination': '<(output_dir)', + 'files': [ '<(native_binary)' ], + } + ], + 'conditions': [ + ['component == "shared_library"', { + 'dependencies': [ + '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', + ], + 'variables': { + 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', + 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', + }, + 'actions': [ + { + 'variables': { + 'input_libraries': ['<(native_binary)'], + }, + 'includes': ['../../build/android/write_ordered_libraries.gypi'], + }, + { + 'action_name': 'stripping native libraries', + 'variables': { + 'stripped_libraries_dir%': '<(output_dir)', + 'input_paths': ['<(native_binary)'], + 'stamp': '<(intermediate_dir)/strip.stamp', + }, + 'includes': ['../../build/android/strip_native_libraries.gypi'], + }, + ], + }], + ], +} diff --git a/chromium/build/android/push_libraries.gypi b/chromium/build/android/push_libraries.gypi new file mode 100644 index 00000000000..1f17660c448 --- /dev/null +++ b/chromium/build/android/push_libraries.gypi @@ -0,0 +1,45 @@ +# 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 a rule that +# pushes stripped shared libraries to the attached Android device. This should +# only be used with the gyp_managed_install flag set. +# +# To use this, create a gyp target with the following form: +# { +# 'actions': [ +# 'variables': { +# 'ordered_libraries_file': 'file generated by write_ordered_libraries' +# 'strip_stamp': 'stamp from strip action to block on' +# 'libraries_source_dir': 'location where stripped libraries are stored' +# 'device_library_dir': 'location on the device where to put pushed libraries', +# 'push_stamp': 'file to touch when the action is complete' +# }, +# 'includes': [ '../../build/android/push_libraries.gypi' ], +# ], +# }, +# + +{ + 'action_name': 'push_libraries_<(_target_name)', + 'message': 'Pushing libraries to device for <(_target_name)', + 'inputs': [ + '<(DEPTH)/build/android/gyp/util/build_utils.py', + '<(DEPTH)/build/android/gyp/util/md5_check.py', + '<(DEPTH)/build/android/gyp/push_libraries.py', + '<(strip_stamp)', + '<(build_device_config_path)', + ], + 'outputs': [ + '<(push_stamp)', + ], + 'action': [ + 'python', '<(DEPTH)/build/android/gyp/push_libraries.py', + '--build-device-configuration=<(build_device_config_path)', + '--libraries-dir=<(libraries_source_dir)', + '--device-dir=<(device_library_dir)', + '--libraries-json=<(ordered_libraries_file)', + '--stamp=<(push_stamp)', + ], +} diff --git a/chromium/build/android/setup.gyp b/chromium/build/android/setup.gyp new file mode 100644 index 00000000000..7dce19de726 --- /dev/null +++ b/chromium/build/android/setup.gyp @@ -0,0 +1,82 @@ +# 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. +{ + 'conditions': [ + ['component == "shared_library"', { + 'targets': [ + { + # These libraries from the Android ndk are required to be packaged with + # any APK that is built with them. build/java_apk.gypi expects any + # libraries that should be packaged with the apk to be in + # <(SHARED_LIB_DIR) + 'target_name': 'copy_system_libraries', + 'type': 'none', + 'copies': [ + { + 'destination': '<(SHARED_LIB_DIR)/', + 'files': [ + '<(android_stlport_libs_dir)/libstlport_shared.so', + ], + }, + ], + }, + ], + }], + ], + 'targets': [ + { + 'target_name': 'get_build_device_configurations', + 'type': 'none', + 'actions': [ + { + 'action_name': 'get configurations', + 'inputs': [ + 'gyp/util/build_device.py', + 'gyp/get_device_configuration.py', + ], + 'outputs': [ + '<(build_device_config_path)', + '<(build_device_config_path).fake', + ], + 'action': [ + 'python', 'gyp/get_device_configuration.py', + '--output=<(build_device_config_path)', + ], + } + ], + }, + { + # Target for creating common output build directories. Creating output + # dirs beforehand ensures that build scripts can assume these folders to + # exist and there are no race conditions resulting from build scripts + # trying to create these directories. + # The build/java.gypi target depends on this target. + 'target_name': 'build_output_dirs', + 'type': 'none', + 'actions': [ + { + 'action_name': 'create_java_output_dirs', + 'variables' : { + 'output_dirs' : [ + '<(PRODUCT_DIR)/apks', + '<(PRODUCT_DIR)/lib.java', + '<(PRODUCT_DIR)/test.lib.java', + ] + }, + 'inputs' : [], + # By not specifying any outputs, we ensure that this command isn't + # re-run when the output directories are touched (i.e. apks are + # written to them). + 'outputs': [''], + 'action': [ + 'mkdir', + '-p', + '<@(output_dirs)', + ], + }, + ], + }, # build_output_dirs + ] +} + diff --git a/chromium/build/android/strip_native_libraries.gypi b/chromium/build/android/strip_native_libraries.gypi new file mode 100644 index 00000000000..57de0afd4f4 --- /dev/null +++ b/chromium/build/android/strip_native_libraries.gypi @@ -0,0 +1,54 @@ +# 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 a rule that strips +# native libraries. +# +# To use this, create a gyp target with the following form: +# { +# 'action_name': 'strip_native_libraries', +# 'actions': [ +# 'variables': { +# 'ordered_libraries_file': 'file generated by write_ordered_libraries' +# 'input_paths': 'files to be added to the list of inputs' +# 'stamp': 'file to touch when the action is complete' +# 'stripped_libraries_dir': 'directory to store stripped libraries', +# }, +# 'includes': [ '../../build/android/strip_native_libraries.gypi' ], +# ], +# }, +# + +{ + 'message': 'Stripping libraries for <(_target_name)', + 'variables': { + 'input_paths': [], + }, + 'inputs': [ + '<(DEPTH)/build/android/gyp/util/build_utils.py', + '<(DEPTH)/build/android/gyp/strip_library_for_device.py', + '<(ordered_libraries_file)', + '>@(input_paths)', + ], + 'outputs': [ + '<(stamp)', + ], + 'conditions': [ + ['component == "shared_library"', { + # Add a fake output to force the build to always re-run this step. This + # is required because the real inputs are not known at gyp-time and + # changing base.so may not trigger changes to dependent libraries. + 'outputs': [ '<(stamp).fake' ] + }], + ], + 'action': [ + 'python', '<(DEPTH)/build/android/gyp/strip_library_for_device.py', + '--android-strip=<(android_strip)', + '--android-strip-arg=--strip-unneeded', + '--stripped-libraries-dir=<(stripped_libraries_dir)', + '--libraries-dir=<(SHARED_LIB_DIR)', + '--libraries-file=<(ordered_libraries_file)', + '--stamp=<(stamp)', + ], +} diff --git a/chromium/build/android/tests/multiple_proguards/multiple_proguards.gyp b/chromium/build/android/tests/multiple_proguards/multiple_proguards.gyp new file mode 100644 index 00000000000..6e9c34cbc69 --- /dev/null +++ b/chromium/build/android/tests/multiple_proguards/multiple_proguards.gyp @@ -0,0 +1,35 @@ +# Copyright (c) 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. +{ + 'variables': { + 'chromium_code': 1, + 'package_name': 'multiple_proguard', + }, + 'targets': [ + { + 'target_name': 'multiple_proguards_test_apk', + 'type': 'none', + 'variables': { + 'app_manifest_version_name%': '<(android_app_version_name)', + 'java_in_dir': '.', + 'proguard_enabled': 'true', + 'proguard_flags_paths': [ + 'proguard1.flags', + 'proguard2.flags', + ], + 'R_package': 'dummy', + 'R_package_relpath': 'dummy', + 'apk_name': 'MultipleProguards', + # This is a build-only test. There's nothing to install. + 'gyp_managed_install': 0, + }, + 'dependencies': [ + # guava has references to objects using reflection which + # should be ignored in proguard step. + '../../../../third_party/guava/guava.gyp:guava_javalib', + ], + 'includes': [ '../../../../build/java_apk.gypi' ], + }, + ], +} diff --git a/chromium/build/android/write_ordered_libraries.gypi b/chromium/build/android/write_ordered_libraries.gypi new file mode 100644 index 00000000000..2b2450097de --- /dev/null +++ b/chromium/build/android/write_ordered_libraries.gypi @@ -0,0 +1,42 @@ +# 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 a rule that +# generates a json file with the list of dependent libraries needed for a given +# shared library or executable. +# +# To use this, create a gyp target with the following form: +# { +# 'actions': [ +# 'variables': { +# 'input_libraries': 'shared library or executable to process', +# 'ordered_libraries_file': 'file to generate' +# }, +# 'includes': [ '../../build/android/write_ordered_libraries.gypi' ], +# ], +# }, +# + +{ + 'action_name': 'ordered_libraries_<(_target_name)', + 'message': 'Writing dependency ordered libraries for <(_target_name).', + 'variables': { + 'input_libraries%': [], + }, + 'inputs': [ + '<(DEPTH)/build/android/gyp/util/build_utils.py', + '<(DEPTH)/build/android/gyp/write_ordered_libraries.py', + '<@(input_libraries)', + ], + 'outputs': [ + '<(ordered_libraries_file)', + ], + 'action': [ + 'python', '<(DEPTH)/build/android/gyp/write_ordered_libraries.py', + '--input-libraries=<(input_libraries)', + '--libraries-dir=<(SHARED_LIB_DIR)', + '--readelf=<(android_readelf)', + '--output=<(ordered_libraries_file)', + ], +} -- cgit v1.2.1