Commit 21d05eb3 authored by Peter Wen's avatar Peter Wen Committed by Chromium LUCI CQ

Android: Reduce deps for prebuilts (reland)

Prebuilt jars do not need the full classpath since they are either jars
ready to be passed to ijar, or they just need a dep on a non-java target
to unzip the jar from its aar.

Previously header jars could depend on impl jars due to passing the full
classpath for prebuilt jars, but this should not happen as it defeats
the purpose of header jars being fast to compile. Added a regression
test to ensure chrome_java__header doesn't depend on base_java__impl.

Original CL: https://crrev.com/c/2567618

Fixed:
 - Added back missing transitive header deps.

Tbr: cduvall@chromium.org
Bug: 1154302
Change-Id: Ib1810ee0c4646d14e8e75372427594c456be8366
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567628Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832551}
parent fcc7bd6d
......@@ -3151,6 +3151,12 @@ if (enable_java_templates) {
} else {
script = "//build/android/gyp/compile_java.py"
}
if (target_name == "chrome_java__header") {
# Regression test for: https://crbug.com/1154302
assert_no_deps = [ "//base:base_java__impl" ]
}
depfile = "$target_gen_dir/$target_name.d"
deps = _srcjar_deps
if (defined(invoker.deps)) {
......@@ -3921,7 +3927,7 @@ if (enable_java_templates) {
} # _has_sources
if (_is_prebuilt || _build_device_jar || _build_host_jar) {
_unprocessed_jar_deps = _full_classpath_deps
_unprocessed_jar_deps = []
if (_has_sources) {
_unprocessed_jar_deps += [ ":$_compile_java_target" ]
}
......@@ -3959,10 +3965,8 @@ if (enable_java_templates) {
"--output-jar",
rebase_path(_rewritten_jar, root_build_dir),
]
deps = _unprocessed_jar_deps + [
":$_build_config_target_name",
invoker.bytecode_rewriter_target,
]
deps = _unprocessed_jar_deps + _full_classpath_deps +
[ invoker.bytecode_rewriter_target ]
}
_unprocessed_jar_deps = []
......@@ -3978,12 +3982,12 @@ if (enable_java_templates) {
input_jar = _unprocessed_jar_path
output_jar = _final_ijar_path
# ijar does not require classpath, but must declare these as deps so
# that they are transitive deps for targets that depend on this
# target. If we can change compile & desugar steps to use direct
# interface classpath rather than full interface classpath, then this
# could just be _non_java_deps.
deps = _unprocessed_jar_deps
# Normally ijar does not require any deps, but:
# 1 - Some jars are bytecode rewritten by _unprocessed_jar_deps.
# 2 - Other jars need to be unzipped by _non_java_deps.
# 3 - It is expected that depending on a header target implies depending
# on its transitive header target deps via _java_header_deps.
deps = _unprocessed_jar_deps + _non_java_deps + _java_header_deps
}
_public_deps += [ ":$_header_target_name" ]
}
......@@ -3999,7 +4003,7 @@ if (enable_java_templates) {
build_config = _build_config
build_config_dep = ":$_build_config_target_name"
input_jar_path = _unprocessed_jar_path
jar_deps = _unprocessed_jar_deps
jar_deps = _unprocessed_jar_deps + _full_classpath_deps
if (_build_host_jar) {
host_jar_path = _host_processed_jar_path
}
......@@ -4045,7 +4049,8 @@ if (enable_java_templates) {
_bytecode_checks_target = "${target_name}__validate_classpath"
bytecode_processor(_bytecode_checks_target) {
forward_variables_from(invoker, [ "missing_classes_allowlist" ])
deps = _unprocessed_jar_deps + [ ":$_build_config_target_name" ]
deps = _unprocessed_jar_deps + _full_classpath_deps +
[ ":$_build_config_target_name" ]
requires_android = _requires_android
target_label =
get_label_info(":${invoker.target_name}", "label_no_toolchain")
......
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