Index: build/config/android/internal_rules.gni |
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni |
index 6a7cda3bc6c150809c8e7defbf06f6d4f11a2d84..60ba966b100e70bee1d86a9edd438a864d3167d2 100644 |
--- a/build/config/android/internal_rules.gni |
+++ b/build/config/android/internal_rules.gni |
@@ -6,6 +6,7 @@ |
# Some projects (e.g. V8) do not have non-build directories DEPS'ed in. |
import("//build_overrides/build.gni") |
import("//build/config/android/config.gni") |
+import("//build/config/dcheck_always_on.gni") |
import("//build/config/sanitizers/sanitizers.gni") |
assert(is_android) |
@@ -1006,11 +1007,12 @@ if (enable_java_templates) { |
_rebased_build_config = rebase_path(_build_config, root_build_dir) |
assert(_rebased_build_config != "" || true) # Mark used. |
- _proguard_preprocess = |
- defined(invoker.proguard_preprocess) && invoker.proguard_preprocess |
_input_jar_path = invoker.input_jar_path |
_output_jar_path = invoker.output_jar_path |
+ _proguard_preprocess = |
+ defined(invoker.proguard_preprocess) && invoker.proguard_preprocess |
+ |
_jar_excluded_patterns = [] |
if (defined(invoker.jar_excluded_patterns)) { |
_jar_excluded_patterns = invoker.jar_excluded_patterns |
@@ -1019,24 +1021,15 @@ if (enable_java_templates) { |
invoker.strip_resource_classes |
_filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes |
+ _enable_assert = |
+ defined(invoker.supports_android) && invoker.supports_android && |
+ (is_java_debug || dcheck_always_on) |
+ assert(_enable_assert || true) # Mark used. |
+ |
if (_filter_jar) { |
_filter_target = "${target_name}__filter" |
- _output_jar_target = _filter_target |
- } |
- if (_proguard_preprocess) { |
- _proguard_target = "${target_name}__proguard_process" |
- _output_jar_target = _proguard_target |
- } |
- if (!_filter_jar && !_proguard_preprocess) { |
- _copy_target = "${target_name}__copy" |
- _output_jar_target = _copy_target |
- } |
- if (_filter_jar) { |
- _filtered_jar_path = _output_jar_path |
- if (_proguard_preprocess) { |
- _filtered_jar_path = "$target_out_dir/$target_name-filtered.jar" |
- } |
+ _filter_jar_path = "$target_out_dir/$target_name-filtered.jar" |
action(_filter_target) { |
script = "//build/android/gyp/jar.py" |
forward_variables_from(invoker, |
@@ -1049,13 +1042,13 @@ if (enable_java_templates) { |
_input_jar_path, |
] |
outputs = [ |
- _filtered_jar_path, |
+ _filter_jar_path, |
] |
args = [ |
"--input-jar", |
rebase_path(_input_jar_path, root_build_dir), |
"--jar-path", |
- rebase_path(_filtered_jar_path, root_build_dir), |
+ rebase_path(_filter_jar_path, root_build_dir), |
"--excluded-classes=$_jar_excluded_patterns", |
] |
if (_strip_resource_classes) { |
@@ -1065,31 +1058,34 @@ if (enable_java_templates) { |
} |
if (_proguard_preprocess) { |
+ _output_jar_target = "${target_name}__proguard_process" |
+ _proguard_output_jar = _output_jar_path |
_proguard_config_path = invoker.proguard_preprocess_config |
- proguard(_proguard_target) { |
+ proguard(_output_jar_target) { |
if (_filter_jar) { |
- _proguard_input_jar = _filtered_jar_path |
- public_deps = [ |
+ _proguard_input_jar = _filter_jar_path |
+ deps = [ |
":$_filter_target", |
] |
} else { |
_proguard_input_jar = _input_jar_path |
- public_deps = [] |
+ deps = [] |
} |
if (defined(invoker.deps)) { |
- deps = invoker.deps |
+ deps += invoker.deps |
} |
if (defined(invoker.public_deps)) { |
- public_deps += invoker.public_deps |
+ public_deps = invoker.public_deps |
} |
inputs = [ |
_build_config, |
_proguard_config_path, |
_proguard_input_jar, |
] |
- output_jar_path = _output_jar_path |
+ output_jar_path = _proguard_output_jar |
- _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] |
+ _rebased_input_paths = |
+ [ rebase_path(_proguard_input_jar, root_build_dir) ] |
_rebased_proguard_configs = |
[ rebase_path(_proguard_config_path, root_build_dir) ] |
args = [ |
@@ -1098,15 +1094,57 @@ if (enable_java_templates) { |
"--classpath=@FileArg($_rebased_build_config:javac:classpath)", |
] |
} |
- } else if (!_filter_jar) { |
- copy(_copy_target) { |
- forward_variables_from(invoker, |
- [ |
- "deps", |
- "public_deps", |
- ]) |
+ } else if (_enable_assert) { |
+ _output_jar_target = "${target_name}__assert" |
+ _assert_output_jar = _output_jar_path |
+ action(_output_jar_target) { |
+ script = "$root_out_dir/bin/helper/java_assertion_enabler" |
+ deps = [ |
+ "//build/android/java_assertion_enabler($default_toolchain)", |
+ ] |
+ if (_filter_jar) { |
+ _assert_input_jar = _filter_jar_path |
+ deps += [ ":$_filter_target" ] |
+ } else { |
+ _assert_input_jar = _input_jar_path |
+ } |
+ if (defined(invoker.deps)) { |
+ deps += invoker.deps |
+ } |
+ if (defined(invoker.public_deps)) { |
+ public_deps = invoker.public_deps |
+ } |
+ inputs = [ |
+ _assert_input_jar, |
+ ] |
+ outputs = [ |
+ _assert_output_jar, |
+ ] |
+ args = [ |
+ rebase_path(_assert_input_jar, root_build_dir), |
+ rebase_path(_assert_output_jar, root_build_dir), |
+ ] |
+ } |
+ } else { |
+ _output_jar_target = "${target_name}__copy" |
+ copy(_output_jar_target) { |
+ if (_filter_jar) { |
+ _copy_input_jar = _filter_jar_path |
+ public_deps = [ |
+ ":$_filter_target", |
+ ] |
+ } else { |
+ _copy_input_jar = _input_jar_path |
+ public_deps = [] |
+ } |
+ if (defined(invoker.deps)) { |
+ deps = invoker.deps |
+ } |
+ if (defined(invoker.public_deps)) { |
+ public_deps += invoker.public_deps |
+ } |
sources = [ |
- _input_jar_path, |
+ _copy_input_jar, |
] |
outputs = [ |
_output_jar_path, |
@@ -1802,6 +1840,7 @@ if (enable_java_templates) { |
visibility += [ ":$_dex_target_name" ] |
} |
+ supports_android = _supports_android |
build_config = _build_config |
input_jar_path = invoker.jar_path |
output_jar_path = _jar_path |
@@ -2093,6 +2132,7 @@ if (enable_java_templates) { |
"proguard_preprocess", |
"proguard_preprocess_config", |
]) |
+ supports_android = _supports_android |
build_config = _build_config |
input_jar_path = _javac_jar_path |
output_jar_path = _process_prebuilt_jar_path |