summaryrefslogtreecommitdiff
path: root/java/classpath_fragment.go
diff options
context:
space:
mode:
authorHaamed Gheibi <haamed@google.com>2021-07-12 20:47:16 +0000
committerHaamed Gheibi <haamed@google.com>2021-07-12 20:47:16 +0000
commitd4fd974eb42fa9bc991011d544a48157aa8e95a7 (patch)
tree50a8f5955925465dbbf85d20ac51ff553b16557d /java/classpath_fragment.go
parentef25c8777180f88650dad8bd2499e8c8c9d174b7 (diff)
parent74d33e1a724ff26b5e9175fed9664b5387c7744f (diff)
Merge SP1A.210709.002
Change-Id: I875d10af6b1546ee1b90ad5880874f8ef01f7ed3
Diffstat (limited to 'java/classpath_fragment.go')
-rw-r--r--java/classpath_fragment.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go
index 0e14d24f2..ecfdfb7e5 100644
--- a/java/classpath_fragment.go
+++ b/java/classpath_fragment.go
@@ -89,6 +89,29 @@ type classpathJar struct {
maxSdkVersion int32
}
+// gatherPossibleUpdatableModuleNamesAndStems returns a set of module and stem names from the
+// supplied contents that may be in the updatable boot jars.
+//
+// The module names are included because sometimes the stem is set to just change the name of
+// the installed file and it expects the configuration to still use the actual module name.
+//
+// The stem names are included because sometimes the stem is set to change the effective name of the
+// module that is used in the configuration as well,e .g. when a test library is overriding an
+// actual boot jar
+func gatherPossibleUpdatableModuleNamesAndStems(ctx android.ModuleContext, contents []string, tag blueprint.DependencyTag) []string {
+ set := map[string]struct{}{}
+ for _, name := range contents {
+ dep := ctx.GetDirectDepWithTag(name, tag)
+ set[name] = struct{}{}
+ if m, ok := dep.(ModuleWithStem); ok {
+ set[m.Stem()] = struct{}{}
+ } else {
+ ctx.PropertyErrorf("contents", "%v is not a ModuleWithStem", name)
+ }
+ }
+ return android.SortedStringKeys(set)
+}
+
// Converts android.ConfiguredJarList into a list of classpathJars for each given classpathType.
func configuredJarListToClasspathJars(ctx android.ModuleContext, configuredJars android.ConfiguredJarList, classpaths ...classpathType) []classpathJar {
paths := configuredJars.DevicePaths(ctx.Config(), android.Android)