Merge "Extract sdk registration code into function for reuse"

This commit is contained in:
Paul Duffin
2021-03-10 17:31:26 +00:00
committed by Gerrit Code Review
3 changed files with 16 additions and 12 deletions

View File

@@ -17,8 +17,12 @@ package sdk
import "android/soong/android"
func init() {
android.RegisterModuleType("module_exports", ModuleExportsFactory)
android.RegisterModuleType("module_exports_snapshot", ModuleExportsSnapshotsFactory)
registerModuleExportsBuildComponents(android.InitRegistrationContext)
}
func registerModuleExportsBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("module_exports", ModuleExportsFactory)
ctx.RegisterModuleType("module_exports_snapshot", ModuleExportsSnapshotsFactory)
}
// module_exports defines the exports of a mainline module. The exports are Soong modules

View File

@@ -33,10 +33,14 @@ func init() {
pctx.Import("android/soong/android")
pctx.Import("android/soong/java/config")
android.RegisterModuleType("sdk", SdkModuleFactory)
android.RegisterModuleType("sdk_snapshot", SnapshotModuleFactory)
android.PreDepsMutators(RegisterPreDepsMutators)
android.PostDepsMutators(RegisterPostDepsMutators)
registerSdkBuildComponents(android.InitRegistrationContext)
}
func registerSdkBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("sdk", SdkModuleFactory)
ctx.RegisterModuleType("sdk_snapshot", SnapshotModuleFactory)
ctx.PreDepsMutators(RegisterPreDepsMutators)
ctx.PostDepsMutators(RegisterPostDepsMutators)
}
type sdk struct {

View File

@@ -122,12 +122,8 @@ func testSdkContext(bp string, fs map[string][]byte, extraOsTypes []android.OsTy
ctx.PostDepsMutators(apex.RegisterPostDepsMutators)
// from this package
ctx.RegisterModuleType("sdk", SdkModuleFactory)
ctx.RegisterModuleType("sdk_snapshot", SnapshotModuleFactory)
ctx.RegisterModuleType("module_exports", ModuleExportsFactory)
ctx.RegisterModuleType("module_exports_snapshot", ModuleExportsSnapshotsFactory)
ctx.PreDepsMutators(RegisterPreDepsMutators)
ctx.PostDepsMutators(RegisterPostDepsMutators)
registerModuleExportsBuildComponents(ctx)
registerSdkBuildComponents(ctx)
ctx.Register()