Commit 2052bd1d authored by Peter Wen's avatar Peter Wen Committed by Chromium LUCI CQ

Android: Filter unnecessary java deps in tests

Shared library targets do not depend on any java targets.

Bug: 1154302
Change-Id: I1db77363da2c6b33e9151f4aa8dbda4fb49a221d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2570197
Commit-Queue: Peter Wen <wnwen@chromium.org>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833410}
parent fc7f19fe
......@@ -77,8 +77,9 @@ _java_library_patterns = [
"//android_webview/glue:glue",
]
# These identify all non-leaf targets that have .build_config files.
_java_target_patterns = _java_library_patterns + _java_resource_patterns
# These identify all non-leaf targets that have .build_config files. This is the
# set of patterns that other targets can use to filter out java targets.
java_target_patterns = _java_library_patterns + _java_resource_patterns
_r8_path = "//third_party/r8/lib/r8.jar"
_desugar_jdk_libs_json = "//third_party/r8/desugar_jdk_libs.json"
......@@ -168,7 +169,7 @@ template("write_build_config") {
assert(false, "Invalid java library target name: $_target_label")
}
} else if (_type == "group") {
if (filter_exclude([ _target_label ], _java_target_patterns) != []) {
if (filter_exclude([ _target_label ], java_target_patterns) != []) {
assert(false, "Invalid java target name: $_target_label")
}
} else if (filter_exclude([ _type ], _java_leaf_types) != []) {
......@@ -204,7 +205,7 @@ template("write_build_config") {
if (defined(invoker.possible_config_deps)) {
foreach(_possible_dep, invoker.possible_config_deps) {
_dep_label = get_label_info(_possible_dep, "label_no_toolchain")
if (filter_exclude([ _dep_label ], _java_target_patterns) == []) {
if (filter_exclude([ _dep_label ], java_target_patterns) == []) {
# Put the bug number in the target name so that false-positives
# have a hint in the error message about non-existent dependencies.
deps += [ "$_dep_label$build_config_target_suffix" ]
......
......@@ -136,11 +136,24 @@ template("test") {
configs = [] # Prevent list overwriting warning.
configs = invoker.configs
deps = []
forward_variables_from(
invoker,
"*",
_apk_specific_vars + _wrapper_script_vars + TESTONLY_AND_VISIBILITY)
[ "deps" ] + _apk_specific_vars + _wrapper_script_vars +
TESTONLY_AND_VISIBILITY)
# Native targets do not need to depend on java targets. Filter them out
# so that the shared library can be built without needing to wait for
# dependent java targets.
deps = []
if (defined(invoker.deps)) {
foreach(_dep, invoker.deps) {
_target_label = get_label_info(_dep, "label_no_toolchain")
if (filter_exclude([ _target_label ], java_target_patterns) != []) {
deps += [ _dep ]
}
}
}
if (!defined(invoker.use_default_launcher) ||
invoker.use_default_launcher) {
......
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