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

Unified Diff: build/android/gyp/configure_multidex.py

Issue 1590243003: [Android] Rework multidex and enable multidex for unit_tests_apk. (RELAND) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: build/android/gyp/configure_multidex.py
diff --git a/build/android/gyp/configure_multidex.py b/build/android/gyp/configure_multidex.py
index aa85d2ffb165546577e8464e20a2134cdd5bf191..9f3b7360f7132bfd7281f4881f497c620ecc4502 100755
--- a/build/android/gyp/configure_multidex.py
+++ b/build/android/gyp/configure_multidex.py
@@ -6,23 +6,33 @@
import argparse
import json
+import os
import sys
from util import build_utils
+_GCC_PREPROCESS_PATH = os.path.join(
+ os.path.dirname(__file__), 'gcc_preprocess.py')
+
+
def ParseArgs():
parser = argparse.ArgumentParser()
parser.add_argument('--configuration-name', required=True,
help='The build CONFIGURATION_NAME.')
+ parser.add_argument('--enable-multidex', action='store_true', default=False,
+ help='If passed, multidex may be enabled.')
parser.add_argument('--enabled-configurations', default=[],
help='The configuration(s) for which multidex should be '
'enabled. If not specified and --enable-multidex is '
'passed, multidex will be enabled for all '
- 'configurations.')
+ 'configurations.')
parser.add_argument('--multidex-configuration-path', required=True,
help='The path to which the multidex configuration JSON '
'should be saved.')
+ parser.add_argument('--multidex-config-java-file', required=True)
+ parser.add_argument('--multidex-config-java-stamp', required=True)
+ parser.add_argument('--multidex-config-java-template', required=True)
args = parser.parse_args()
@@ -33,20 +43,42 @@ def ParseArgs():
return args
-def main():
- args = ParseArgs()
-
- multidex_enabled = (
- (not args.enabled_configurations
- or args.configuration_name in args.enabled_configurations))
-
+def _WriteConfigJson(multidex_enabled, multidex_configuration_path):
config = {
'enabled': multidex_enabled,
}
- with open(args.multidex_configuration_path, 'w') as f:
+ with open(multidex_configuration_path, 'w') as f:
f.write(json.dumps(config))
+
+def _GenerateMultidexConfigJava(multidex_enabled, args):
+ gcc_preprocess_cmd = [
+ sys.executable, _GCC_PREPROCESS_PATH,
+ '--include-path=',
+ '--template', args.multidex_config_java_template,
+ '--stamp', args.multidex_config_java_stamp,
+ '--output', args.multidex_config_java_file,
+ ]
+ if multidex_enabled:
+ gcc_preprocess_cmd += [
+ '--defines', 'ENABLE_MULTIDEX',
+ ]
+
+ build_utils.CheckOutput(gcc_preprocess_cmd)
+
+
+def main():
+ args = ParseArgs()
+
+ multidex_enabled = (
+ args.enable_multidex
+ and (not args.enabled_configurations
+ or args.configuration_name in args.enabled_configurations))
+
+ _WriteConfigJson(multidex_enabled, args.multidex_configuration_path)
+ _GenerateMultidexConfigJava(multidex_enabled, args)
+
return 0

Powered by Google App Engine
This is Rietveld 408576698