summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/android/dex_action.gypi61
-rwxr-xr-xbuild/android/gyp/dex.py10
-rw-r--r--build/java.gypi26
-rw-r--r--build/java_apk.gypi40
4 files changed, 84 insertions, 53 deletions
diff --git a/build/android/dex_action.gypi b/build/android/dex_action.gypi
new file mode 100644
index 0000000..c41effb
--- /dev/null
+++ b/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-root=<(android_sdk_root)',
+ '--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/build/android/gyp/dex.py b/build/android/gyp/dex.py
index 84a9c63..86f3878 100755
--- a/build/android/gyp/dex.py
+++ b/build/android/gyp/dex.py
@@ -31,6 +31,12 @@ def main(argv):
parser = optparse.OptionParser()
parser.add_option('--android-sdk-root', help='Android sdk root directory.')
parser.add_option('--dex-path', help='Dex output path.')
+ parser.add_option('--configuration-name',
+ help='The build CONFIGURATION_NAME.')
+ parser.add_option('--proguard-enabled',
+ help='"true" if proguard is enabled.')
+ parser.add_option('--proguard-enabled-input-path',
+ help='Path to dex in Release mode when proguard is enabled.')
parser.add_option('--stamp', help='Path to touch on success.')
# TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
@@ -38,6 +44,10 @@ def main(argv):
options, paths = parser.parse_args()
+ if (options.proguard_enabled == "true"
+ and options.configuration_name == "Release"):
+ paths = [options.proguard_enabled_input_path]
+
DoDex(options, paths)
if options.stamp:
diff --git a/build/java.gypi b/build/java.gypi
index 8256486..3fd6429 100644
--- a/build/java.gypi
+++ b/build/java.gypi
@@ -282,27 +282,11 @@
},
{
'action_name': 'dex_<(_target_name)',
- 'message': 'Dexing <(_target_name) jar',
- 'inputs': [
- '<(DEPTH)/build/android/gyp/util/build_utils.py',
- '<(DEPTH)/build/android/gyp/util/md5_check.py',
- '<(DEPTH)/build/android/gyp/dex.py',
- '<(jar_path)',
- ],
- 'outputs': [
- '<(dex_path)',
- ],
- 'action': [
- 'python', '<(DEPTH)/build/android/gyp/dex.py',
- '--dex-path=<(dex_path)',
- '--android-sdk-root=<(android_sdk_root)',
-
- # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
- '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
-
- '<(jar_path)',
- ]
+ 'variables': {
+ 'dex_input_paths': [ '<(jar_path)' ],
+ 'output_path': '<(dex_path)',
+ },
+ 'includes': [ 'android/dex_action.gypi' ],
},
-
],
}
diff --git a/build/java_apk.gypi b/build/java_apk.gypi
index 19f85bc..8c794f0 100644
--- a/build/java_apk.gypi
+++ b/build/java_apk.gypi
@@ -480,43 +480,19 @@
},
{
'action_name': 'dex_<(_target_name)',
- 'message': 'Dexing <(_target_name) jar',
'variables': {
'conditions': [
- ['proguard_enabled=="true" and CONFIGURATION_NAME=="Release"', {
- 'dex_inputs': [ '<(obfuscated_jar_path)' ],
- 'dex_generated_inputs': [],
- }, {
- 'dex_inputs': [
- '>@(library_dexed_jars_paths)',
- ],
- 'dex_generated_inputs': [
- '<(classes_dir)',
- ],
+ ['proguard_enabled == "true"', {
+ 'input_paths': [ '<(obfuscate_stamp)' ],
+ 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
}],
],
+ 'input_paths': [ '<(compile_stamp)' ],
+ 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ],
+ 'dex_generated_input_dirs': [ '<(classes_dir)' ],
+ 'output_path': '<(dex_path)',
},
- 'inputs': [
- '<(DEPTH)/build/android/gyp/util/build_utils.py',
- '<(DEPTH)/build/android/gyp/util/md5_check.py',
- '<(DEPTH)/build/android/gyp/dex.py',
- '<(compile_stamp)',
- '>@(dex_inputs)',
- ],
- 'outputs': [
- '<(dex_path)',
- ],
- 'action': [
- 'python', '<(DEPTH)/build/android/gyp/dex.py',
- '--dex-path=<(dex_path)',
- '--android-sdk-root=<(android_sdk_root)',
-
- # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
- '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
-
- '>@(dex_inputs)',
- '>@(dex_generated_inputs)',
- ]
+ 'includes': [ 'android/dex_action.gypi' ],
},
{
'action_name': 'ant package resources',