Merge "Add preparer for overlay pre-singleton registration"

This commit is contained in:
Paul Duffin 2021-03-23 07:21:30 +00:00 committed by Gerrit Code Review
commit e0998ab561
4 changed files with 10 additions and 4 deletions

View File

@ -263,8 +263,9 @@ type RegistrationContext interface {
// ctx := android.NewTestContext(config)
// RegisterBuildComponents(ctx)
var InitRegistrationContext RegistrationContext = &initRegistrationContext{
moduleTypes: make(map[string]ModuleFactory),
singletonTypes: make(map[string]SingletonFactory),
moduleTypes: make(map[string]ModuleFactory),
singletonTypes: make(map[string]SingletonFactory),
preSingletonTypes: make(map[string]SingletonFactory),
}
// Make sure the TestContext implements RegistrationContext.

View File

@ -22,8 +22,11 @@ import (
)
func init() {
android.RegisterPreSingletonType("overlay", OverlaySingletonFactory)
registerOverlayBuildComponents(android.InitRegistrationContext)
}
func registerOverlayBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterPreSingletonType("overlay", OverlaySingletonFactory)
}
var androidResourceIgnoreFilenames = []string{

View File

@ -71,11 +71,11 @@ var prepareForJavaTest = android.GroupFixturePreparers(
cc.PrepareForTestWithCcBuildComponents,
// Include all the default java modules.
PrepareForTestWithJavaDefaultModules,
PrepareForTestWithOverlayBuildComponents,
python.PrepareForTestWithPythonBuildComponents,
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
ctx.RegisterModuleType("java_plugin", PluginFactory)
ctx.RegisterPreSingletonType("overlay", OverlaySingletonFactory)
ctx.RegisterPreSingletonType("sdk_versions", sdkPreSingletonFactory)
}),
dexpreopt.PrepareForTestWithDexpreopt,

View File

@ -54,6 +54,8 @@ var PrepareForTestWithJavaDefaultModules = android.GroupFixturePreparers(
android.FixtureAddTextFile(defaultJavaDir+"/Android.bp", GatherRequiredDepsForTest()),
)
var PrepareForTestWithOverlayBuildComponents = android.FixtureRegisterWithContext(registerOverlayBuildComponents)
// Prepare a fixture to use all java module types, mutators and singletons fully.
//
// This should only be used by tests that want to run with as much of the build enabled as possible.