Index: build/config/android/internal_rules.gni |
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni |
index 08b2ab6d6fb787279ec9967c4a0a71bc2b81936d..b1d456b4b77eb3dfd9d5538f4eed67c4a8b280fe 100644 |
--- a/build/config/android/internal_rules.gni |
+++ b/build/config/android/internal_rules.gni |
@@ -603,22 +603,30 @@ template("process_java_prebuilt") { |
if (defined(invoker.jar_excluded_patterns)) { |
_jar_excluded_patterns = invoker.jar_excluded_patterns |
} |
- |
_strip_resource_classes = |
defined(invoker.strip_resource_classes) && invoker.strip_resource_classes |
+ _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes |
- if (_jar_excluded_patterns != [] || _strip_resource_classes) { |
- _filter_class_files_input_file = _input_jar_path |
- if (_proguard_preprocess) { |
- _filter_class_files_input_file = |
- "$target_out_dir/$target_name-proguarded.jar" |
- } |
+ if (_filter_jar) { |
+ _filter_target = "${target_name}__filter" |
+ _output_jar_target = _filter_target |
} |
- |
if (_proguard_preprocess) { |
- _proguard_config_path = invoker.proguard_config |
_proguard_target = "${target_name}__proguard_process" |
- proguard(_proguard_target) { |
+ _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" |
+ } |
+ action(_filter_target) { |
+ script = "//build/android/gyp/jar.py" |
forward_variables_from(invoker, |
[ |
"deps", |
@@ -627,12 +635,47 @@ template("process_java_prebuilt") { |
inputs = [ |
_build_config, |
_input_jar_path, |
+ ] |
+ outputs = [ |
+ _filtered_jar_path, |
+ ] |
+ args = [ |
+ "--input-jar", |
+ rebase_path(_input_jar_path, root_build_dir), |
+ "--jar-path", |
+ rebase_path(_filtered_jar_path, root_build_dir), |
+ "--excluded-classes=$_jar_excluded_patterns", |
+ ] |
+ if (_strip_resource_classes) { |
+ args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_config:javac:resource_packages)" ] |
+ } |
+ } |
+ } |
+ |
+ if (_proguard_preprocess) { |
+ _proguard_config_path = invoker.proguard_config |
+ proguard(_proguard_target) { |
+ if (_filter_jar) { |
+ _proguard_input_jar = _filtered_jar_path |
+ public_deps = [ |
+ ":$_filter_target", |
+ ] |
+ } else { |
+ _proguard_input_jar = _input_jar_path |
+ public_deps = [] |
+ } |
+ if (defined(invoker.deps)) { |
+ deps = invoker.deps |
+ } |
+ if (defined(invoker.public_deps)) { |
+ public_deps += invoker.public_deps |
+ } |
+ inputs = [ |
+ _build_config, |
_proguard_config_path, |
+ _proguard_input_jar, |
] |
output_jar_path = _output_jar_path |
- if (defined(_filter_class_files_input_file)) { |
- output_jar_path = _filter_class_files_input_file |
- } |
_rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] |
_rebased_proguard_configs = |
@@ -643,9 +686,8 @@ template("process_java_prebuilt") { |
"--classpath=@FileArg($_rebased_build_config:javac:classpath)", |
] |
} |
- } else if (_jar_excluded_patterns == [] && !_strip_resource_classes) { |
- _output_jar_target = "${target_name}__copy_jar" |
- copy(_output_jar_target) { |
+ } else if (!_filter_jar) { |
+ copy(_copy_target) { |
forward_variables_from(invoker, |
[ |
"deps", |
@@ -660,42 +702,6 @@ template("process_java_prebuilt") { |
} |
} |
- if (_jar_excluded_patterns != [] || _strip_resource_classes) { |
- _output_jar_target = "${target_name}__filter" |
- action(_output_jar_target) { |
- script = "//build/android/gyp/jar.py" |
- if (_proguard_preprocess) { |
- deps = [ |
- ":$_proguard_target", |
- ] |
- } else { |
- forward_variables_from(invoker, |
- [ |
- "deps", |
- "public_deps", |
- ]) |
- } |
- inputs = [ |
- _filter_class_files_input_file, |
- ] |
- outputs = [ |
- _output_jar_path, |
- ] |
- args = [ |
- "--input-jar", |
- rebase_path(_filter_class_files_input_file, root_build_dir), |
- "--jar-path", |
- rebase_path(_output_jar_path, root_build_dir), |
- "--excluded-classes=$_jar_excluded_patterns", |
- ] |
- if (_strip_resource_classes) { |
- args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_config:javac:resource_packages)" ] |
- } |
- } |
- } else if (_proguard_preprocess) { |
- _output_jar_target = _proguard_target |
- } |
- |
group(target_name) { |
forward_variables_from(invoker, |
[ |
@@ -1615,6 +1621,9 @@ template("compile_java") { |
deps = [ |
":$_javac_target_name", |
] |
+ if (defined(invoker.deps)) { |
+ deps += invoker.deps |
+ } |
} |
emma_instr(_emma_instr_target_name) { |