Loading android/config.go +9 −0 Original line number Diff line number Diff line Loading @@ -1564,6 +1564,15 @@ func (l *ConfiguredJarList) containsApexJarPair(apex, jar string) bool { return false } // ApexOfJar returns the apex component of the first pair with the given jar name on the list, or // an empty string if not found. func (l *ConfiguredJarList) ApexOfJar(jar string) string { if idx := IndexList(jar, l.jars); idx != -1 { return l.Apex(IndexList(jar, l.jars)) } return "" } // IndexOfJar returns the first pair with the given jar name on the list, or -1 // if not found. func (l *ConfiguredJarList) IndexOfJar(jar string) int { Loading apex/apex.go +5 −0 Original line number Diff line number Diff line Loading @@ -2102,6 +2102,11 @@ func apexBootclasspathFragmentFiles(ctx android.ModuleContext, module blueprint. } } // Add classpaths.proto config. classpathProtoOutput := bootclasspathFragmentInfo.ClasspathFragmentProtoOutput classpathProto := newApexFile(ctx, classpathProtoOutput, classpathProtoOutput.Base(), bootclasspathFragmentInfo.ClasspathFragmentProtoInstallDir.Rel(), etc, nil) filesToAdd = append(filesToAdd, classpathProto) return filesToAdd } Loading apex/bootclasspath_fragment_test.go +2 −0 Original line number Diff line number Diff line Loading @@ -279,6 +279,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { ).RunTest(t) ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ "etc/classpaths/mybootclasspathfragment.pb", "javalib/arm/boot.art", "javalib/arm/boot.oat", "javalib/arm/boot.vdex", Loading Loading @@ -481,6 +482,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) { ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ // This does not include art, oat or vdex files as they are only included for the art boot // image. "etc/classpaths/mybootclasspathfragment.pb", "javalib/bar.jar", "javalib/foo.jar", }) Loading java/bootclasspath_fragment.go +49 −13 Original line number Diff line number Diff line Loading @@ -109,6 +109,8 @@ type BootclasspathFragmentModule struct { android.ModuleBase android.ApexModuleBase android.SdkBase ClasspathFragmentBase properties bootclasspathFragmentProperties } Loading @@ -117,6 +119,7 @@ func bootclasspathFragmentFactory() android.Module { m.AddProperties(&m.properties) android.InitApexModule(m) android.InitSdkAwareModule(m) initClasspathFragment(m, BOOTCLASSPATH) android.InitAndroidArchModule(m, android.HostAndDeviceSupported, android.MultilibCommon) android.AddLoadHook(m, func(ctx android.LoadHookContext) { Loading Loading @@ -242,6 +245,22 @@ var BootclasspathFragmentApexContentInfoProvider = blueprint.NewProvider(Bootcla // BootclasspathFragmentApexContentInfo contains the bootclasspath_fragments contributions to the // apex contents. type BootclasspathFragmentApexContentInfo struct { // ClasspathFragmentProtoOutput is an output path for the generated classpaths.proto config of this module. // // The file should be copied to a relevant place on device, see ClasspathFragmentProtoInstallDir // for more details. ClasspathFragmentProtoOutput android.OutputPath // ClasspathFragmentProtoInstallDir contains information about on device location for the generated classpaths.proto file. // // The path encodes expected sub-location within partitions, i.e. etc/classpaths/<proto-file>, // for ClasspathFragmentProtoOutput. To get sub-location, instead of the full output / make path // use android.InstallPath#Rel(). // // This is only relevant for APEX modules as they perform their own installation; while regular // system files are installed via ClasspathFragmentBase#androidMkEntries(). ClasspathFragmentProtoInstallDir android.InstallPath // The image config, internal to this module (and the dex_bootjars singleton). // // Will be nil if the BootclasspathFragmentApexContentInfo has not been provided for a specific module. That can occur Loading Loading @@ -339,30 +358,47 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo b.bootclasspathImageNameContentsConsistencyCheck(ctx) } // Generate classpaths.proto config b.generateClasspathProtoBuildActions(ctx) // Perform hidden API processing. b.generateHiddenAPIBuildActions(ctx) // Nothing to do if skipping the dexpreopt of boot image jars. if SkipDexpreoptBootJars(ctx) { return // Construct the boot image info from the config. info := BootclasspathFragmentApexContentInfo{ ClasspathFragmentProtoInstallDir: b.classpathFragmentBase().installDirPath, ClasspathFragmentProtoOutput: b.classpathFragmentBase().outputFilepath, imageConfig: nil, } if !SkipDexpreoptBootJars(ctx) { // Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars // GenerateSingletonBuildActions method as it cannot create it for itself. dexpreopt.GetGlobalSoongConfig(ctx) imageConfig := b.getImageConfig(ctx) if imageConfig == nil { return info.imageConfig = b.getImageConfig(ctx) } // Construct the boot image info from the config. info := BootclasspathFragmentApexContentInfo{imageConfig: imageConfig} // Make it available for other modules. ctx.SetProvider(BootclasspathFragmentApexContentInfoProvider, info) } // generateClasspathProtoBuildActions generates all required build actions for classpath.proto config func (b *BootclasspathFragmentModule) generateClasspathProtoBuildActions(ctx android.ModuleContext) { var classpathJars []classpathJar if "art" == proptools.String(b.properties.Image_name) { // ART and platform boot jars must have a corresponding entry in DEX2OATBOOTCLASSPATH classpathJars = configuredJarListToClasspathJars(ctx, b.ClasspathFragmentToConfiguredJarList(ctx), BOOTCLASSPATH, DEX2OATBOOTCLASSPATH) } else { classpathJars = configuredJarListToClasspathJars(ctx, b.ClasspathFragmentToConfiguredJarList(ctx), b.classpathType) } b.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, classpathJars) } func (b *BootclasspathFragmentModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList { // TODO(satayev): populate with actual content return android.EmptyConfiguredJarList() } func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig { // Get a map of the image configs that are supported. imageConfigs := genBootImageConfigs(ctx) Loading java/classpath_fragment.go +2 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,8 @@ func writeClasspathsJson(ctx android.ModuleContext, output android.WritablePath, android.WriteFileRule(ctx, output, content.String()) } // Returns AndroidMkEntries objects to install generated classpath.proto. // Do not use this to install into APEXes as the injection of the generated files happen separately for APEXes. func (c *ClasspathFragmentBase) androidMkEntries() []android.AndroidMkEntries { return []android.AndroidMkEntries{{ Class: "ETC", Loading Loading
android/config.go +9 −0 Original line number Diff line number Diff line Loading @@ -1564,6 +1564,15 @@ func (l *ConfiguredJarList) containsApexJarPair(apex, jar string) bool { return false } // ApexOfJar returns the apex component of the first pair with the given jar name on the list, or // an empty string if not found. func (l *ConfiguredJarList) ApexOfJar(jar string) string { if idx := IndexList(jar, l.jars); idx != -1 { return l.Apex(IndexList(jar, l.jars)) } return "" } // IndexOfJar returns the first pair with the given jar name on the list, or -1 // if not found. func (l *ConfiguredJarList) IndexOfJar(jar string) int { Loading
apex/apex.go +5 −0 Original line number Diff line number Diff line Loading @@ -2102,6 +2102,11 @@ func apexBootclasspathFragmentFiles(ctx android.ModuleContext, module blueprint. } } // Add classpaths.proto config. classpathProtoOutput := bootclasspathFragmentInfo.ClasspathFragmentProtoOutput classpathProto := newApexFile(ctx, classpathProtoOutput, classpathProtoOutput.Base(), bootclasspathFragmentInfo.ClasspathFragmentProtoInstallDir.Rel(), etc, nil) filesToAdd = append(filesToAdd, classpathProto) return filesToAdd } Loading
apex/bootclasspath_fragment_test.go +2 −0 Original line number Diff line number Diff line Loading @@ -279,6 +279,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { ).RunTest(t) ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ "etc/classpaths/mybootclasspathfragment.pb", "javalib/arm/boot.art", "javalib/arm/boot.oat", "javalib/arm/boot.vdex", Loading Loading @@ -481,6 +482,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) { ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ // This does not include art, oat or vdex files as they are only included for the art boot // image. "etc/classpaths/mybootclasspathfragment.pb", "javalib/bar.jar", "javalib/foo.jar", }) Loading
java/bootclasspath_fragment.go +49 −13 Original line number Diff line number Diff line Loading @@ -109,6 +109,8 @@ type BootclasspathFragmentModule struct { android.ModuleBase android.ApexModuleBase android.SdkBase ClasspathFragmentBase properties bootclasspathFragmentProperties } Loading @@ -117,6 +119,7 @@ func bootclasspathFragmentFactory() android.Module { m.AddProperties(&m.properties) android.InitApexModule(m) android.InitSdkAwareModule(m) initClasspathFragment(m, BOOTCLASSPATH) android.InitAndroidArchModule(m, android.HostAndDeviceSupported, android.MultilibCommon) android.AddLoadHook(m, func(ctx android.LoadHookContext) { Loading Loading @@ -242,6 +245,22 @@ var BootclasspathFragmentApexContentInfoProvider = blueprint.NewProvider(Bootcla // BootclasspathFragmentApexContentInfo contains the bootclasspath_fragments contributions to the // apex contents. type BootclasspathFragmentApexContentInfo struct { // ClasspathFragmentProtoOutput is an output path for the generated classpaths.proto config of this module. // // The file should be copied to a relevant place on device, see ClasspathFragmentProtoInstallDir // for more details. ClasspathFragmentProtoOutput android.OutputPath // ClasspathFragmentProtoInstallDir contains information about on device location for the generated classpaths.proto file. // // The path encodes expected sub-location within partitions, i.e. etc/classpaths/<proto-file>, // for ClasspathFragmentProtoOutput. To get sub-location, instead of the full output / make path // use android.InstallPath#Rel(). // // This is only relevant for APEX modules as they perform their own installation; while regular // system files are installed via ClasspathFragmentBase#androidMkEntries(). ClasspathFragmentProtoInstallDir android.InstallPath // The image config, internal to this module (and the dex_bootjars singleton). // // Will be nil if the BootclasspathFragmentApexContentInfo has not been provided for a specific module. That can occur Loading Loading @@ -339,30 +358,47 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo b.bootclasspathImageNameContentsConsistencyCheck(ctx) } // Generate classpaths.proto config b.generateClasspathProtoBuildActions(ctx) // Perform hidden API processing. b.generateHiddenAPIBuildActions(ctx) // Nothing to do if skipping the dexpreopt of boot image jars. if SkipDexpreoptBootJars(ctx) { return // Construct the boot image info from the config. info := BootclasspathFragmentApexContentInfo{ ClasspathFragmentProtoInstallDir: b.classpathFragmentBase().installDirPath, ClasspathFragmentProtoOutput: b.classpathFragmentBase().outputFilepath, imageConfig: nil, } if !SkipDexpreoptBootJars(ctx) { // Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars // GenerateSingletonBuildActions method as it cannot create it for itself. dexpreopt.GetGlobalSoongConfig(ctx) imageConfig := b.getImageConfig(ctx) if imageConfig == nil { return info.imageConfig = b.getImageConfig(ctx) } // Construct the boot image info from the config. info := BootclasspathFragmentApexContentInfo{imageConfig: imageConfig} // Make it available for other modules. ctx.SetProvider(BootclasspathFragmentApexContentInfoProvider, info) } // generateClasspathProtoBuildActions generates all required build actions for classpath.proto config func (b *BootclasspathFragmentModule) generateClasspathProtoBuildActions(ctx android.ModuleContext) { var classpathJars []classpathJar if "art" == proptools.String(b.properties.Image_name) { // ART and platform boot jars must have a corresponding entry in DEX2OATBOOTCLASSPATH classpathJars = configuredJarListToClasspathJars(ctx, b.ClasspathFragmentToConfiguredJarList(ctx), BOOTCLASSPATH, DEX2OATBOOTCLASSPATH) } else { classpathJars = configuredJarListToClasspathJars(ctx, b.ClasspathFragmentToConfiguredJarList(ctx), b.classpathType) } b.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, classpathJars) } func (b *BootclasspathFragmentModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList { // TODO(satayev): populate with actual content return android.EmptyConfiguredJarList() } func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig { // Get a map of the image configs that are supported. imageConfigs := genBootImageConfigs(ctx) Loading
java/classpath_fragment.go +2 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,8 @@ func writeClasspathsJson(ctx android.ModuleContext, output android.WritablePath, android.WriteFileRule(ctx, output, content.String()) } // Returns AndroidMkEntries objects to install generated classpath.proto. // Do not use this to install into APEXes as the injection of the generated files happen separately for APEXes. func (c *ClasspathFragmentBase) androidMkEntries() []android.AndroidMkEntries { return []android.AndroidMkEntries{{ Class: "ETC", Loading