Add new properties to aid in removing the 1-variant fallback
These new properties are essentially methods to specify "outgoing
transitions" in blueprint files. There are lots of host tests
that want to include apps built for device in their data, so they
need a property that adds dependencies based on the device variants
instead of copying the same host variants.
After this cl is submitted, I'll do an LSC to update all the usages
that are relying on the 1-variant fallback to use these properties
instead.
Bug: 372091092
Test: m nothing --no-skip-soong-tests
Change-Id: I45b8fb024da120ad61606e3a21de86e4392be2a4
diff --git a/java/base.go b/java/base.go
index a9399cb..efc6a74 100644
--- a/java/base.go
+++ b/java/base.go
@@ -71,6 +71,15 @@
// list of files that should be excluded from java_resources and java_resource_dirs
Exclude_java_resources []string `android:"path,arch_variant"`
+ // Same as java_resources, but modules added here will use the device variant. Can be useful
+ // for making a host test that tests the contents of a device built app.
+ Device_common_java_resources []string `android:"path_device_common"`
+
+ // Same as java_resources, but modules added here will use the device's os variant and the
+ // device's first architecture variant. Can be useful for making a host test that tests the
+ // contents of a native device built app.
+ Device_first_java_resources []string `android:"path_device_first"`
+
// list of module-specific flags that will be used for javac compiles
Javacflags []string `android:"arch_variant"`
@@ -1482,6 +1491,10 @@
dirArgs, dirDeps := ResourceDirsToJarArgs(ctx, j.properties.Java_resource_dirs,
j.properties.Exclude_java_resource_dirs, j.properties.Exclude_java_resources)
fileArgs, fileDeps := ResourceFilesToJarArgs(ctx, j.properties.Java_resources, j.properties.Exclude_java_resources)
+ fileArgs2, fileDeps2 := ResourceFilesToJarArgs(ctx, j.properties.Device_common_java_resources, nil)
+ fileArgs3, fileDeps3 := ResourceFilesToJarArgs(ctx, j.properties.Device_first_java_resources, nil)
+ fileArgs = slices.Concat(fileArgs, fileArgs2, fileArgs3)
+ fileDeps = slices.Concat(fileDeps, fileDeps2, fileDeps3)
extraArgs, extraDeps := resourcePathsToJarArgs(j.extraResources), j.extraResources
var resArgs []string