summaryrefslogtreecommitdiff
path: root/api/api.go
diff options
context:
space:
mode:
author Harshit Mahajan <harshitmahajan@google.com> 2023-12-15 21:56:42 +0000
committer Harshit Mahajan <harshitmahajan@google.com> 2024-01-10 20:50:12 +0000
commitb52adbcd8bf41f4cd4e061b3ae853b49cbb1c678 (patch)
treef526f1bf38bfaba6a56ad09d8e25ef6e6c070b5f /api/api.go
parent2ab8f35e511712b6ce1edb4a87a87d426dcd7ac1 (diff)
Add combined_api_defaults module type
Allow specifying default combined api properties. This would be currently used to control the enablement of new mainline modules Bug:b/289203818 Test: verified locally Change-Id: I9415140453ce04efd5461cb8684c70e987810ecc
Diffstat (limited to 'api/api.go')
-rw-r--r--api/api.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/api/api.go b/api/api.go
index 2668999c572e..43713aad0e1e 100644
--- a/api/api.go
+++ b/api/api.go
@@ -64,6 +64,7 @@ type CombinedApisProperties struct {
type CombinedApis struct {
android.ModuleBase
+ android.DefaultableModuleBase
properties CombinedApisProperties
}
@@ -74,6 +75,7 @@ func init() {
func registerBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("combined_apis", combinedApisModuleFactory)
+ ctx.RegisterModuleType("combined_apis_defaults", CombinedApisModuleDefaultsFactory)
}
var PrepareForCombinedApisTest = android.FixtureRegisterWithContext(registerBuildComponents)
@@ -409,6 +411,7 @@ func combinedApisModuleFactory() android.Module {
module := &CombinedApis{}
module.AddProperties(&module.properties)
android.InitAndroidModule(module)
+ android.InitDefaultableModule(module)
android.AddLoadHook(module, func(ctx android.LoadHookContext) { module.createInternalModules(ctx) })
return module
}
@@ -445,3 +448,16 @@ func remove(s []string, v string) []string {
}
return s2
}
+
+// Defaults
+type CombinedApisModuleDefaults struct {
+ android.ModuleBase
+ android.DefaultsModuleBase
+}
+
+func CombinedApisModuleDefaultsFactory() android.Module {
+ module := &CombinedApisModuleDefaults{}
+ module.AddProperties(&CombinedApisProperties{})
+ android.InitDefaultsModule(module)
+ return module
+}