Merge "Build boot images in bootclasspath_fragment/platform_bootclasspath"
This commit is contained in:
@@ -478,6 +478,10 @@ func (b *BootclasspathFragmentModule) generateBootImageBuildActions(ctx android.
|
|||||||
|
|
||||||
// Copy the dex jars of this fragment's content modules to their predefined locations.
|
// Copy the dex jars of this fragment's content modules to their predefined locations.
|
||||||
copyBootJarsToPredefinedLocations(ctx, contents, imageConfig.modules, imageConfig.dexPaths)
|
copyBootJarsToPredefinedLocations(ctx, contents, imageConfig.modules, imageConfig.dexPaths)
|
||||||
|
|
||||||
|
// Build a profile for the image config and then use that to build the boot image.
|
||||||
|
profile := bootImageProfileRule(ctx, imageConfig)
|
||||||
|
buildBootImage(ctx, imageConfig, profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
type bootclasspathFragmentMemberType struct {
|
type bootclasspathFragmentMemberType struct {
|
||||||
|
@@ -427,19 +427,10 @@ func (d *dexpreoptBootJars) GenerateSingletonBuildActions(ctx android.SingletonC
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate the profile rule from the default boot image.
|
|
||||||
defaultImageConfig := defaultBootImageConfig(ctx)
|
defaultImageConfig := defaultBootImageConfig(ctx)
|
||||||
profile := bootImageProfileRule(ctx, defaultImageConfig)
|
|
||||||
|
|
||||||
d.defaultBootImage = defaultImageConfig
|
d.defaultBootImage = defaultImageConfig
|
||||||
artBootImageConfig := artBootImageConfig(ctx)
|
artBootImageConfig := artBootImageConfig(ctx)
|
||||||
d.otherImages = []*bootImageConfig{artBootImageConfig}
|
d.otherImages = []*bootImageConfig{artBootImageConfig}
|
||||||
|
|
||||||
// Create the default boot image (build artifacts are accessed via the global boot image config).
|
|
||||||
buildBootImage(ctx, defaultImageConfig, profile)
|
|
||||||
|
|
||||||
// Create boot image for the ART apex (build artifacts are accessed via the global boot image config).
|
|
||||||
buildBootImage(ctx, artBootImageConfig, profile)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// shouldBuildBootImages determines whether boot images should be built.
|
// shouldBuildBootImages determines whether boot images should be built.
|
||||||
@@ -507,7 +498,7 @@ func copyBootJarsToPredefinedLocations(ctx android.ModuleContext, bootModules []
|
|||||||
}
|
}
|
||||||
|
|
||||||
// buildBootImage takes a bootImageConfig, creates rules to build it, and returns the image.
|
// buildBootImage takes a bootImageConfig, creates rules to build it, and returns the image.
|
||||||
func buildBootImage(ctx android.SingletonContext, image *bootImageConfig, profile android.WritablePath) {
|
func buildBootImage(ctx android.ModuleContext, image *bootImageConfig, profile android.WritablePath) {
|
||||||
var zipFiles android.Paths
|
var zipFiles android.Paths
|
||||||
for _, variant := range image.variants {
|
for _, variant := range image.variants {
|
||||||
files := buildBootImageVariant(ctx, variant, profile)
|
files := buildBootImageVariant(ctx, variant, profile)
|
||||||
@@ -529,7 +520,7 @@ func buildBootImage(ctx android.SingletonContext, image *bootImageConfig, profil
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate boot image build rules for a specific target.
|
// Generate boot image build rules for a specific target.
|
||||||
func buildBootImageVariant(ctx android.SingletonContext, image *bootImageVariant, profile android.Path) android.WritablePaths {
|
func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, profile android.Path) android.WritablePaths {
|
||||||
|
|
||||||
globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
|
globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
|
||||||
global := dexpreopt.GetGlobalConfig(ctx)
|
global := dexpreopt.GetGlobalConfig(ctx)
|
||||||
@@ -679,7 +670,7 @@ const failureMessage = `ERROR: Dex2oat failed to compile a boot image.
|
|||||||
It is likely that the boot classpath is inconsistent.
|
It is likely that the boot classpath is inconsistent.
|
||||||
Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors.`
|
Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors.`
|
||||||
|
|
||||||
func bootImageProfileRule(ctx android.SingletonContext, image *bootImageConfig) android.WritablePath {
|
func bootImageProfileRule(ctx android.ModuleContext, image *bootImageConfig) android.WritablePath {
|
||||||
globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
|
globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
|
||||||
global := dexpreopt.GetGlobalConfig(ctx)
|
global := dexpreopt.GetGlobalConfig(ctx)
|
||||||
|
|
||||||
|
@@ -20,7 +20,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/dexpreopt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOutputs []string) {
|
func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOutputs []string) {
|
||||||
@@ -42,17 +41,21 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu
|
|||||||
name: "baz",
|
name: "baz",
|
||||||
jars: ["a.jar"],
|
jars: ["a.jar"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform_bootclasspath {
|
||||||
|
name: "platform-bootclasspath",
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
result := android.GroupFixturePreparers(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForJavaTest,
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
dexpreopt.FixtureSetBootJars("platform:foo", "system_ext:bar", "platform:baz"),
|
FixtureConfigureBootJars("platform:foo", "system_ext:bar", "platform:baz"),
|
||||||
).RunTestWithBp(t, bp)
|
).RunTestWithBp(t, bp)
|
||||||
|
|
||||||
dexpreoptBootJars := result.SingletonForTests("dex_bootjars")
|
platformBootclasspath := result.ModuleForTests("platform-bootclasspath", "android_common")
|
||||||
rule := dexpreoptBootJars.Output(ruleFile)
|
rule := platformBootclasspath.Output(ruleFile)
|
||||||
|
|
||||||
for i := range expectedInputs {
|
for i := range expectedInputs {
|
||||||
expectedInputs[i] = filepath.Join("out/soong/test_device", expectedInputs[i])
|
expectedInputs[i] = filepath.Join("out/soong/test_device", expectedInputs[i])
|
||||||
|
@@ -458,5 +458,9 @@ func (b *platformBootclasspathModule) generateBootImageBuildActions(ctx android.
|
|||||||
config := GetUpdatableBootConfig(ctx)
|
config := GetUpdatableBootConfig(ctx)
|
||||||
copyBootJarsToPredefinedLocations(ctx, updatableModules, config.modules, config.dexPaths)
|
copyBootJarsToPredefinedLocations(ctx, updatableModules, config.modules, config.dexPaths)
|
||||||
|
|
||||||
|
// Build a profile for the image config and then use that to build the boot image.
|
||||||
|
profile := bootImageProfileRule(ctx, imageConfig)
|
||||||
|
buildBootImage(ctx, imageConfig, profile)
|
||||||
|
|
||||||
dumpOatRules(ctx, imageConfig)
|
dumpOatRules(ctx, imageConfig)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user