From 1e27a14545c916539001370bbe78d3e950aa240f Mon Sep 17 00:00:00 2001 From: Inseob Kim Date: Thu, 6 May 2021 11:46:11 +0000 Subject: [PATCH] Add prebuilt_defaults for prebuilt etc modules Bug: 33691272 Test: build Change-Id: I9af232e9ed9b0815c4cc70dfae2ec44e87b6d114 --- etc/prebuilt_etc.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go index de9dc4520..4dd383d77 100644 --- a/etc/prebuilt_etc.go +++ b/etc/prebuilt_etc.go @@ -55,6 +55,8 @@ func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) { ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory) ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory) ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory) + + ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory) } var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents) @@ -124,6 +126,7 @@ type PrebuiltEtcModule interface { type PrebuiltEtc struct { android.ModuleBase + android.DefaultableModuleBase properties prebuiltEtcProperties subdirProperties prebuiltSubdirProperties @@ -139,6 +142,11 @@ type PrebuiltEtc struct { additionalDependencies *android.Paths } +type Defaults struct { + android.ModuleBase + android.DefaultsModuleBase +} + func (p *PrebuiltEtc) inRamdisk() bool { return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk() } @@ -378,6 +386,25 @@ func PrebuiltEtcFactory() android.Module { InitPrebuiltEtcModule(module, "etc") // This module is device-only android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) + android.InitDefaultableModule(module) + return module +} + +func defaultsFactory() android.Module { + return DefaultsFactory() +} + +func DefaultsFactory(props ...interface{}) android.Module { + module := &Defaults{} + + module.AddProperties(props...) + module.AddProperties( + &prebuiltEtcProperties{}, + &prebuiltSubdirProperties{}, + ) + + android.InitDefaultsModule(module) + return module }