Add structured representation for colon-separated jar lists.
With the addition of apexes and /system_ext some of the bootclasspath and system server jars have moved from /system to the new locations. This has been implemented by using lists of colon-separated strings called "apex-jar pairs" (although "apex" was misleading as it could refer to "platform" or "system_ext", not necessarily a real apex). Using the colon-separated string representation is inconvenient, as it requires splitting and reassembling the list components many times, which harms performance and makes error handling difficult. Therefore this patch refactors the colon-separated lists into a struct that hides the implementation details. Test: lunch aosp_cf_x86_phone-userdebug && m Change-Id: Id248ce639a267076294f4d4d73971da2f2f77208
This commit is contained in:
@@ -5595,13 +5595,15 @@ func TestUpdatable_should_set_min_sdk_version(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNoUpdatableJarsInBootImage(t *testing.T) {
|
||||
|
||||
var err string
|
||||
var transform func(*dexpreopt.GlobalConfig)
|
||||
|
||||
config := android.TestArchConfig(buildDir, nil, "", nil)
|
||||
ctx := android.PathContextForTesting(config)
|
||||
|
||||
t.Run("updatable jar from ART apex in the ART boot image => ok", func(t *testing.T) {
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.ArtApexJars = []string{"com.android.art.something:some-art-lib"}
|
||||
config.ArtApexJars = android.CreateConfiguredJarList(ctx, []string{"com.android.art.something:some-art-lib"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, "", transform)
|
||||
})
|
||||
@@ -5609,7 +5611,7 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) {
|
||||
t.Run("updatable jar from ART apex in the framework boot image => error", func(t *testing.T) {
|
||||
err = "module 'some-art-lib' from updatable apex 'com.android.art.something' is not allowed in the framework boot image"
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.BootJars = []string{"com.android.art.something:some-art-lib"}
|
||||
config.BootJars = android.CreateConfiguredJarList(ctx, []string{"com.android.art.something:some-art-lib"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, err, transform)
|
||||
})
|
||||
@@ -5617,7 +5619,7 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) {
|
||||
t.Run("updatable jar from some other apex in the ART boot image => error", func(t *testing.T) {
|
||||
err = "module 'some-updatable-apex-lib' from updatable apex 'some-updatable-apex' is not allowed in the ART boot image"
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.ArtApexJars = []string{"some-updatable-apex:some-updatable-apex-lib"}
|
||||
config.ArtApexJars = android.CreateConfiguredJarList(ctx, []string{"some-updatable-apex:some-updatable-apex-lib"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, err, transform)
|
||||
})
|
||||
@@ -5625,7 +5627,7 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) {
|
||||
t.Run("non-updatable jar from some other apex in the ART boot image => error", func(t *testing.T) {
|
||||
err = "module 'some-non-updatable-apex-lib' is not allowed in the ART boot image"
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.ArtApexJars = []string{"some-non-updatable-apex:some-non-updatable-apex-lib"}
|
||||
config.ArtApexJars = android.CreateConfiguredJarList(ctx, []string{"some-non-updatable-apex:some-non-updatable-apex-lib"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, err, transform)
|
||||
})
|
||||
@@ -5633,14 +5635,14 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) {
|
||||
t.Run("updatable jar from some other apex in the framework boot image => error", func(t *testing.T) {
|
||||
err = "module 'some-updatable-apex-lib' from updatable apex 'some-updatable-apex' is not allowed in the framework boot image"
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.BootJars = []string{"some-updatable-apex:some-updatable-apex-lib"}
|
||||
config.BootJars = android.CreateConfiguredJarList(ctx, []string{"some-updatable-apex:some-updatable-apex-lib"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, err, transform)
|
||||
})
|
||||
|
||||
t.Run("non-updatable jar from some other apex in the framework boot image => ok", func(t *testing.T) {
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.BootJars = []string{"some-non-updatable-apex:some-non-updatable-apex-lib"}
|
||||
config.BootJars = android.CreateConfiguredJarList(ctx, []string{"some-non-updatable-apex:some-non-updatable-apex-lib"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, "", transform)
|
||||
})
|
||||
@@ -5648,7 +5650,7 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) {
|
||||
t.Run("nonexistent jar in the ART boot image => error", func(t *testing.T) {
|
||||
err = "failed to find a dex jar path for module 'nonexistent'"
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.ArtApexJars = []string{"platform:nonexistent"}
|
||||
config.ArtApexJars = android.CreateConfiguredJarList(ctx, []string{"platform:nonexistent"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, err, transform)
|
||||
})
|
||||
@@ -5656,7 +5658,7 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) {
|
||||
t.Run("nonexistent jar in the framework boot image => error", func(t *testing.T) {
|
||||
err = "failed to find a dex jar path for module 'nonexistent'"
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.BootJars = []string{"platform:nonexistent"}
|
||||
config.BootJars = android.CreateConfiguredJarList(ctx, []string{"platform:nonexistent"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, err, transform)
|
||||
})
|
||||
@@ -5664,14 +5666,14 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) {
|
||||
t.Run("platform jar in the ART boot image => error", func(t *testing.T) {
|
||||
err = "module 'some-platform-lib' is not allowed in the ART boot image"
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.ArtApexJars = []string{"platform:some-platform-lib"}
|
||||
config.ArtApexJars = android.CreateConfiguredJarList(ctx, []string{"platform:some-platform-lib"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, err, transform)
|
||||
})
|
||||
|
||||
t.Run("platform jar in the framework boot image => ok", func(t *testing.T) {
|
||||
transform = func(config *dexpreopt.GlobalConfig) {
|
||||
config.BootJars = []string{"platform:some-platform-lib"}
|
||||
config.BootJars = android.CreateConfiguredJarList(ctx, []string{"platform:some-platform-lib"})
|
||||
}
|
||||
testNoUpdatableJarsInBootImage(t, "", transform)
|
||||
})
|
||||
|
Reference in New Issue
Block a user