Switch BootJars/UpdatableBootJars to ConfiguredJarList am: 69d1fb1e39 am: 769b1eab84

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1471779

Change-Id: Ia770a0b227d8a5ab0c88d56c7e6110c8b697381a
This commit is contained in:
Paul Duffin
2020-10-27 17:09:50 +00:00
committed by Automerger Merge Worker
4 changed files with 27 additions and 8 deletions

View File

@@ -1415,6 +1415,26 @@ func (l *ConfiguredJarList) BuildPaths(ctx PathContext, dir OutputPath) Writable
return paths return paths
} }
// Called when loading configuration from JSON into a configuration structure.
func (l *ConfiguredJarList) UnmarshalJSON(b []byte) error {
// Try and unmarshal into a []string each item of which contains a pair
// <apex>:<jar>.
var list []string
err := json.Unmarshal(b, &list)
if err != nil {
// Did not work so return
return err
}
apexes, jars, err := splitListOfPairsIntoPairOfLists(list)
if err != nil {
return err
}
l.apexes = apexes
l.jars = jars
return nil
}
func ModuleStem(module string) string { func ModuleStem(module string) string {
// b/139391334: the stem of framework-minus-apex is framework. This is hard coded here until we // b/139391334: the stem of framework-minus-apex is framework. This is hard coded here until we
// find a good way to query the stem of a module before any other mutators are run. // find a good way to query the stem of a module before any other mutators are run.
@@ -1494,9 +1514,8 @@ var earlyBootJarsKey = NewOnceKey("earlyBootJars")
func (c *config) BootJars() []string { func (c *config) BootJars() []string {
return c.Once(earlyBootJarsKey, func() interface{} { return c.Once(earlyBootJarsKey, func() interface{} {
ctx := NullPathContext{Config{c}} list := c.productVariables.BootJars.CopyOfJars()
list := CreateConfiguredJarList(ctx, list = append(list, c.productVariables.UpdatableBootJars.CopyOfJars()...)
append(CopyOf(c.productVariables.BootJars), c.productVariables.UpdatableBootJars...)) return list
return list.CopyOfJars()
}).([]string) }).([]string)
} }

View File

@@ -249,8 +249,8 @@ type productVariables struct {
UncompressPrivAppDex *bool `json:",omitempty"` UncompressPrivAppDex *bool `json:",omitempty"`
ModulesLoadedByPrivilegedModules []string `json:",omitempty"` ModulesLoadedByPrivilegedModules []string `json:",omitempty"`
BootJars []string `json:",omitempty"` BootJars ConfiguredJarList `json:",omitempty"`
UpdatableBootJars []string `json:",omitempty"` UpdatableBootJars ConfiguredJarList `json:",omitempty"`
IntegerOverflowExcludePaths []string `json:",omitempty"` IntegerOverflowExcludePaths []string `json:",omitempty"`

View File

@@ -5905,7 +5905,7 @@ func testApexPermittedPackagesRules(t *testing.T, errmsg, bp string, apexBootJar
for _, apexBootJar := range apexBootJars { for _, apexBootJar := range apexBootJars {
updatableBootJars = append(updatableBootJars, "myapex:"+apexBootJar) updatableBootJars = append(updatableBootJars, "myapex:"+apexBootJar)
} }
config.TestProductVariables.UpdatableBootJars = updatableBootJars config.TestProductVariables.UpdatableBootJars = android.CreateConfiguredJarList(nil, updatableBootJars)
ctx.Register(config) ctx.Register(config)

View File

@@ -25,7 +25,7 @@ import (
func testConfigWithBootJars(bp string, bootJars []string) android.Config { func testConfigWithBootJars(bp string, bootJars []string) android.Config {
config := testConfig(nil, bp, nil) config := testConfig(nil, bp, nil)
config.TestProductVariables.BootJars = bootJars config.TestProductVariables.BootJars = android.CreateConfiguredJarList(nil, bootJars)
return config return config
} }