Adding option for Proguard jar to be switched.

Additionally, adds the is_java_debug gn arg, which can now be set
separately from is_debug, which will control Java specific debug
features, such as Proguard, multidexing, and incremental dexing.

BUG=616831,615082,615083

Review-Url: https://codereview.chromium.org/2031033002
Cr-Original-Commit-Position: refs/heads/master@{#399172}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 6174a5f8b59fcfd3dbc7273faa27851cea6c9467
This commit is contained in:
smaier 2016-06-10 06:33:02 -07:00 коммит произвёл Commit bot
Родитель 08d8fd55be
Коммит f285625cfa
3 изменённых файлов: 26 добавлений и 8 удалений

Просмотреть файл

@ -96,6 +96,11 @@ if (is_android) {
# Enables verbose proguard output (summaries and unfiltered output).
proguard_verbose = false
# Java debug on Android. Having this on enables multidexing, and turning it
# off will enable proguard. To access this flag from within Java code, look
# at BuildConfig.IS_DEBUG, which is wired to this arg.
is_java_debug = is_debug
# Set to true to enable the Errorprone compiler
use_errorprone_java_compiler = false
@ -116,7 +121,7 @@ if (is_android) {
enable_incremental_javac = false
# Speed up dexing using dx --incremental.
enable_incremental_dx = is_debug
enable_incremental_dx = is_java_debug
# Neither of these should ever be used for release builds since they are
# somewhat experimental and dx --incremental is known to not produce

Просмотреть файл

@ -539,7 +539,11 @@ if (enable_java_templates) {
"testonly",
])
script = "//build/android/gyp/proguard.py"
_proguard_jar_path = "//third_party/proguard/lib/proguard.jar"
if (defined(invoker.proguard_jar_path)) {
_proguard_jar_path = invoker.proguard_jar_path
} else {
_proguard_jar_path = "//third_party/proguard/lib/proguard.jar"
}
_output_jar_path = invoker.output_jar_path
inputs = [
_proguard_jar_path,

Просмотреть файл

@ -1414,9 +1414,11 @@ if (enable_java_templates) {
# requires_sdk_api_level_23: If defined and true, the apk is intended for
# installation only on Android M or later. In these releases the system
# linker does relocation unpacking, so we can enable it unconditionally.
# secondary_native_libs: the path of native libraries for secondary app abi.
# secondary_native_libs: The path of native libraries for secondary app abi.
# run_findbugs_override: Forces run_findbugs on or off. If undefined, the
# default will use the build arg run_findbugs.
# proguard_jar_path: The path to proguard.jar you wish to use. If undefined,
# the proguard used will be the checked in one in //third_party/proguard.
#
# Example
# android_apk("foo_apk") {
@ -1574,7 +1576,7 @@ if (enable_java_templates) {
_proguard_enabled =
defined(invoker.proguard_enabled) && invoker.proguard_enabled
if (_proguard_enabled) {
_proguard_jar_path = "$base_path.proguard.jar"
_proguard_output_jar_path = "$base_path.proguard.jar"
}
_emma_never_instrument = defined(invoker.testonly) && invoker.testonly
@ -1609,7 +1611,7 @@ if (enable_java_templates) {
proguard_enabled = _proguard_enabled
if (_proguard_enabled) {
proguard_info = "$_proguard_jar_path.info"
proguard_info = "$_proguard_output_jar_path.info"
}
native_libs = _native_libs
@ -1695,6 +1697,9 @@ if (enable_java_templates) {
if (enable_multidex) {
defines += [ "ENABLE_MULTIDEX" ]
}
if (!is_java_debug) {
defines += [ "NDEBUG" ]
}
}
_srcjar_deps += [ ":${_template_name}__build_config_java" ]
}
@ -1766,7 +1771,11 @@ if (enable_java_templates) {
}
_proguard_target = "${_template_name}__proguard"
proguard(_proguard_target) {
forward_variables_from(invoker, [ "alternative_android_sdk_jar" ])
forward_variables_from(invoker,
[
"alternative_android_sdk_jar",
"proguard_jar_path",
])
deps = [
":$build_config_target",
":$java_target",
@ -1777,7 +1786,7 @@ if (enable_java_templates) {
_jar_path,
] + _proguard_configs
output_jar_path = _proguard_jar_path
output_jar_path = _proguard_output_jar_path
_rebased_proguard_configs =
rebase_path(_proguard_configs, root_build_dir)
args = [
@ -1797,7 +1806,7 @@ if (enable_java_templates) {
args += [ "--tested-apk-info=@FileArg($_rebased_apk_under_test_build_config:deps_info:proguard_info)" ]
}
}
_dex_sources = [ _proguard_jar_path ]
_dex_sources = [ _proguard_output_jar_path ]
_dex_deps = [ ":$_proguard_target" ]
} else {
if (enable_multidex) {