summaryrefslogtreecommitdiff
path: root/java/bootclasspath_fragment.go
diff options
context:
space:
mode:
author satayev <satayev@google.com> 2021-05-25 19:50:30 +0100
committer satayev <satayev@google.com> 2021-05-26 17:13:43 +0100
commit1c564cc9c95def02dde7448dacd2b1f8ad707a7f (patch)
treed0ef84be3d6f4db6c86c9a7a08b573b132014341 /java/bootclasspath_fragment.go
parentbcf5304eaba149419905b2c8b5e21f2c168bdbbd (diff)
Use stem when filtering boot jars.
For testing purposes, a boot jar may be provided by a test java_library that has a different content name, but sets "stem" property to match the original java_library. Given that Stem() returns either the property value or module name, it is safe to replace all content names by their stems. Bug: 180105615 Test: atest CtsClasspathsTestCases sdkextensions_e2e_tests Merged-In: Ic519ffa0c5b616abddf15b41c934421dfac2e78a Change-Id: Ic519ffa0c5b616abddf15b41c934421dfac2e78a
Diffstat (limited to 'java/bootclasspath_fragment.go')
-rw-r--r--java/bootclasspath_fragment.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index 188d36225..44803a9ec 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -496,10 +496,21 @@ func (b *BootclasspathFragmentModule) ClasspathFragmentToConfiguredJarList(ctx a
global := dexpreopt.GetGlobalConfig(ctx)
+ // Convert content names to their appropriate stems, in case a test library is overriding an actual boot jar
+ var stems []string
+ for _, name := range b.properties.Contents {
+ dep := ctx.GetDirectDepWithTag(name, bootclasspathFragmentContentDepTag)
+ if m, ok := dep.(ModuleWithStem); ok {
+ stems = append(stems, m.Stem())
+ } else {
+ ctx.PropertyErrorf("contents", "%v is not a ModuleWithStem", name)
+ }
+ }
+
// Only create configs for updatable boot jars. Non-updatable boot jars must be part of the
// platform_bootclasspath's classpath proto config to guarantee that they come before any
// updatable jars at runtime.
- return global.UpdatableBootJars.Filter(b.properties.Contents)
+ return global.UpdatableBootJars.Filter(stems)
}
func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {