Use both module name and stem name to filter updatable boot jars
Sometimes the stem property is set to change both the installed file name and the name use to filter the configured module list, e.g. when adding a test library to replace the standard library, e.g. test_foo instead of foo. Sometimes it is used just to change the installed file name. This change uses both to filter the updatable boot jars and not just the stem. Bug: 180105615 Test: m nothing Merged-In: I6c459fc3597b1e4f062bc9a4e52843305b538c5f Change-Id: I6c459fc3597b1e4f062bc9a4e52843305b538c5f (cherry picked from commit 56c93e899a355311463d41e988c9ba511af14278)
This commit is contained in:
parent
7609182dda
commit
aba5275676
|
@ -525,27 +525,18 @@ func (b *BootclasspathFragmentModule) ClasspathFragmentToConfiguredJarList(ctx a
|
||||||
|
|
||||||
global := dexpreopt.GetGlobalConfig(ctx)
|
global := dexpreopt.GetGlobalConfig(ctx)
|
||||||
|
|
||||||
// Convert content names to their appropriate stems, in case a test library is overriding an actual boot jar
|
possibleUpdatableModules := gatherPossibleUpdatableModuleNamesAndStems(ctx, b.properties.Contents, bootclasspathFragmentContentDepTag)
|
||||||
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
|
// 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
|
// platform_bootclasspath's classpath proto config to guarantee that they come before any
|
||||||
// updatable jars at runtime.
|
// updatable jars at runtime.
|
||||||
jars := global.UpdatableBootJars.Filter(stems)
|
jars := global.UpdatableBootJars.Filter(possibleUpdatableModules)
|
||||||
|
|
||||||
// TODO(satayev): for apex_test we want to include all contents unconditionally to classpaths
|
// TODO(satayev): for apex_test we want to include all contents unconditionally to classpaths
|
||||||
// config. However, any test specific jars would not be present in UpdatableBootJars. Instead,
|
// config. However, any test specific jars would not be present in UpdatableBootJars. Instead,
|
||||||
// we should check if we are creating a config for apex_test via ApexInfo and amend the values.
|
// we should check if we are creating a config for apex_test via ApexInfo and amend the values.
|
||||||
// This is an exception to support end-to-end test for SdkExtensions, until such support exists.
|
// This is an exception to support end-to-end test for SdkExtensions, until such support exists.
|
||||||
if android.InList("test_framework-sdkextensions", stems) {
|
if android.InList("test_framework-sdkextensions", possibleUpdatableModules) {
|
||||||
jars = jars.Append("com.android.sdkext", "test_framework-sdkextensions")
|
jars = jars.Append("com.android.sdkext", "test_framework-sdkextensions")
|
||||||
}
|
}
|
||||||
return jars
|
return jars
|
||||||
|
|
|
@ -89,6 +89,29 @@ type classpathJar struct {
|
||||||
maxSdkVersion int32
|
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.
|
// Converts android.ConfiguredJarList into a list of classpathJars for each given classpathType.
|
||||||
func configuredJarListToClasspathJars(ctx android.ModuleContext, configuredJars android.ConfiguredJarList, classpaths ...classpathType) []classpathJar {
|
func configuredJarListToClasspathJars(ctx android.ModuleContext, configuredJars android.ConfiguredJarList, classpaths ...classpathType) []classpathJar {
|
||||||
paths := configuredJars.DevicePaths(ctx.Config(), android.Android)
|
paths := configuredJars.DevicePaths(ctx.Config(), android.Android)
|
||||||
|
|
|
@ -98,21 +98,12 @@ func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.Mo
|
||||||
func (s *SystemServerClasspathModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList {
|
func (s *SystemServerClasspathModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList {
|
||||||
global := dexpreopt.GetGlobalConfig(ctx)
|
global := dexpreopt.GetGlobalConfig(ctx)
|
||||||
|
|
||||||
// Convert content names to their appropriate stems, in case a test library is overriding an actual boot jar
|
possibleUpdatableModules := gatherPossibleUpdatableModuleNamesAndStems(ctx, s.properties.Contents, systemServerClasspathFragmentContentDepTag)
|
||||||
var stems []string
|
|
||||||
for _, name := range s.properties.Contents {
|
|
||||||
dep := ctx.GetDirectDepWithTag(name, systemServerClasspathFragmentContentDepTag)
|
|
||||||
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 system server jars must be part of the
|
// Only create configs for updatable boot jars. Non-updatable system server jars must be part of the
|
||||||
// platform_systemserverclasspath's classpath proto config to guarantee that they come before any
|
// platform_systemserverclasspath's classpath proto config to guarantee that they come before any
|
||||||
// updatable jars at runtime.
|
// updatable jars at runtime.
|
||||||
return global.UpdatableSystemServerJars.Filter(stems)
|
return global.UpdatableSystemServerJars.Filter(possibleUpdatableModules)
|
||||||
}
|
}
|
||||||
|
|
||||||
type systemServerClasspathFragmentContentDependencyTag struct {
|
type systemServerClasspathFragmentContentDependencyTag struct {
|
||||||
|
|
Loading…
Reference in New Issue