Commit ca9c3412 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Android: Never use --release when dexing library targets

In order to:
1) not require recompiles when toggling is_java_debug,
2) allow incremental_install=1 to still have local variable
   information even when is_java_debug=false.

Bug: None
Change-Id: I0cd458d4445a925f02034907dc5673585e87c78e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2155206
Commit-Queue: Peter Wen <wnwen@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760503}
parent 75bbd63e
......@@ -1150,6 +1150,7 @@ if (enable_java_templates) {
_proguard_enabled =
defined(invoker.proguard_enabled) && invoker.proguard_enabled
_is_dex_merging = defined(invoker.input_dex_filearg)
_proguarding_with_r8 =
_proguard_enabled && !defined(invoker.proguard_jar_path)
_enable_multidex =
......@@ -1166,7 +1167,7 @@ if (enable_java_templates) {
# For D8's backported method desugaring to work properly, the dex merge step
# must not be set to a higher minSdkVersion than it was for the libraries.
if (_enable_desugar && defined(invoker.input_dex_filearg)) {
if (_enable_desugar && _is_dex_merging) {
_min_sdk_version = default_min_sdk_version
}
......@@ -1175,6 +1176,10 @@ if (enable_java_templates) {
defined(invoker.input_class_jars)),
"Cannot explicitly set inputs when proguarding a dex.")
# Dex merging should not also be dexing.
assert(!(_is_dex_merging && defined(invoker.input_classes_filearg)))
assert(!(_is_dex_merging && defined(invoker.input_class_jars)))
assert(!(defined(invoker.apply_mapping) && !_proguard_enabled),
"apply_mapping can only be specified if proguard is enabled.")
......@@ -1362,8 +1367,8 @@ if (enable_java_templates) {
])
script = "//build/android/gyp/dex.py"
depfile = "$target_gen_dir/$target_name.d"
inputs = []
outputs = [ invoker.output ]
inputs = [ _r8_path ]
args = [
"--depfile",
......@@ -1371,6 +1376,8 @@ if (enable_java_templates) {
"--output",
rebase_path(outputs[0], root_build_dir),
"--min-api=$_min_sdk_version",
"--r8-jar-path",
rebase_path(_r8_path, root_build_dir),
]
if (_proguard_enabled) {
......@@ -1440,7 +1447,11 @@ if (enable_java_templates) {
}
}
if (!is_java_debug) {
# Never compile intemediates with --release in order to:
# 1) not require recompiles when toggling is_java_debug,
# 2) allow incremental_install=1 to still have local variable
# information even when is_java_debug=false.
if (!is_java_debug && _is_dex_merging) {
args += [ "--release" ]
}
......@@ -1463,12 +1474,6 @@ if (enable_java_templates) {
}
}
inputs += [ _r8_path ]
args += [
"--r8-jar-path",
rebase_path(_r8_path, root_build_dir),
]
_enable_assert = is_java_debug || dcheck_always_on
if (_enable_assert) {
# The default for generating dex file format is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment