Add defaults support for bootclasspath_fragment module type

This change transforms the bootclsspath_fragment module into a
defaultable module, in order to modify the "art-bootclasspath-fragment"
module definition based on the build flag in
https://r.android.com/2897389

Test: m nothing
Bug: 315027929
Change-Id: I01ba7b15e4fcdea9bd31c369110a3c9ee38bc9f6
This commit is contained in:
Jihoon Kang
2024-01-12 00:08:30 +00:00
parent d06bdb0310
commit 9272dccb1e
2 changed files with 9 additions and 0 deletions

View File

@@ -229,6 +229,7 @@ type SourceOnlyBootclasspathProperties struct {
type BootclasspathFragmentModule struct { type BootclasspathFragmentModule struct {
android.ModuleBase android.ModuleBase
android.DefaultableModuleBase
android.ApexModuleBase android.ApexModuleBase
ClasspathFragmentBase ClasspathFragmentBase
@@ -267,6 +268,7 @@ func bootclasspathFragmentFactory() android.Module {
android.InitApexModule(m) android.InitApexModule(m)
initClasspathFragment(m, BOOTCLASSPATH) initClasspathFragment(m, BOOTCLASSPATH)
android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(m)
android.AddLoadHook(m, func(ctx android.LoadHookContext) { android.AddLoadHook(m, func(ctx android.LoadHookContext) {
// If code coverage has been enabled for the framework then append the properties with // If code coverage has been enabled for the framework then append the properties with
@@ -399,6 +401,11 @@ func (i BootclasspathFragmentApexContentInfo) ProfileInstallPathInApex() string
func (b *BootclasspathFragmentModule) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (b *BootclasspathFragmentModule) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
tag := ctx.OtherModuleDependencyTag(dep) tag := ctx.OtherModuleDependencyTag(dep)
// If the module is a default module, do not check the tag
if _, ok := dep.(*Defaults); ok {
return true
}
if IsBootclasspathFragmentContentDepTag(tag) { if IsBootclasspathFragmentContentDepTag(tag) {
// Boot image contents are automatically added to apex. // Boot image contents are automatically added to apex.
return true return true

View File

@@ -2726,6 +2726,8 @@ func DefaultsFactory() android.Module {
&LintProperties{}, &LintProperties{},
&appTestHelperAppProperties{}, &appTestHelperAppProperties{},
&JavaApiLibraryProperties{}, &JavaApiLibraryProperties{},
&bootclasspathFragmentProperties{},
&SourceOnlyBootclasspathProperties{},
) )
android.InitDefaultsModule(module) android.InitDefaultsModule(module)