Add all compile deps to module_bp_java_deps.json
`Dependencies` in module_bp_java_deps.json currently only contains the
`libs` and `static_libs` of the corresponding module. This is only a
subset of the dependencies which are required to compile the java
module. Most notably, the SDK deps (determined using `sdk_version`) are
missing.
This CL adds all the compile dependencies to the json file. Implementation
details:
1. Add a `compileDepNames` to java.Module in base.go. Almost all the
module types in java package are composed with the java.Module
struct.
2. Populate this property in java.Module.collectDeps. This function is
used by java.Module.compile to determine the classpath used for
compilation.
3. Return `compileDepNames` in java.Module.CompilerDeps.
Since `compileDepNames` is populated in `GenerateAndroidBuildActions`,
update existing unit tests that check for correctness of IDEInfo.Deps
Bug: 353811607
Test: m nothing --no-skip-soong-tests
Test: cat out/soong/module_bp_java_deps.json | jq '."DebuggingRestrictionController".dependencies'
[
"android_system_stubs_current", <-- missing previously
"core-lambda-stubs", <-- missing previously
"core-public-stubs-system-modules", <-- missing previously
"com.google.android.material_material",
...
...
]
Change-Id: I166c0eaf6e87ca7adc98bb4e21447cf82612d103
diff --git a/java/java.go b/java/java.go
index 498b539..3dae4e4 100644
--- a/java/java.go
+++ b/java/java.go
@@ -443,6 +443,30 @@
usesLibCompat30OptTag = makeUsesLibraryDependencyTag(30, true)
)
+// A list of tags for deps used for compiling a module.
+// Any dependency tags that modifies the following properties of `deps` in `Module.collectDeps` should be
+// added to this list:
+// - bootClasspath
+// - classpath
+// - java9Classpath
+// - systemModules
+// - kotlin deps...
+var (
+ compileDependencyTags = []blueprint.DependencyTag{
+ sdkLibTag,
+ libTag,
+ staticLibTag,
+ bootClasspathTag,
+ systemModulesTag,
+ java9LibTag,
+ kotlinStdlibTag,
+ kotlinAnnotationsTag,
+ kotlinPluginTag,
+ syspropPublicStubDepTag,
+ instrumentationForTag,
+ }
+)
+
func IsLibDepTag(depTag blueprint.DependencyTag) bool {
return depTag == libTag || depTag == sdkLibTag
}