Remove pre singletons
They're no longer used.
Test: m nothing --no-skip-soong-tests
Change-Id: I8984164cfc1a062c428ea7f1a4dd5b8940bee84b
diff --git a/android/register.go b/android/register.go
index 6182159..de31353 100644
--- a/android/register.go
+++ b/android/register.go
@@ -22,6 +22,7 @@
"regexp"
"android/soong/shared"
+
"github.com/google/blueprint"
)
@@ -66,9 +67,6 @@
var moduleTypeByFactory = map[reflect.Value]string{}
type singleton struct {
- // True if this should be registered as a pre-singleton, false otherwise.
- pre bool
-
// True if this should be registered as a parallel singleton.
parallel bool
@@ -77,11 +75,7 @@
}
func newSingleton(name string, factory SingletonFactory, parallel bool) singleton {
- return singleton{pre: false, parallel: parallel, name: name, factory: factory}
-}
-
-func newPreSingleton(name string, factory SingletonFactory) singleton {
- return singleton{pre: true, parallel: false, name: name, factory: factory}
+ return singleton{parallel: parallel, name: name, factory: factory}
}
func (s singleton) componentName() string {
@@ -90,17 +84,12 @@
func (s singleton) register(ctx *Context) {
adaptor := SingletonFactoryAdaptor(ctx, s.factory)
- if s.pre {
- ctx.RegisterPreSingletonType(s.name, adaptor)
- } else {
- ctx.RegisterSingletonType(s.name, adaptor, s.parallel)
- }
+ ctx.RegisterSingletonType(s.name, adaptor, s.parallel)
}
var _ sortableComponent = singleton{}
var singletons sortableComponents
-var preSingletons sortableComponents
type mutator struct {
name string
@@ -164,10 +153,6 @@
registerSingletonType(name, factory, true)
}
-func RegisterPreSingletonType(name string, factory SingletonFactory) {
- preSingletons = append(preSingletons, newPreSingleton(name, factory))
-}
-
type Context struct {
*blueprint.Context
config Config
@@ -253,8 +238,6 @@
// Register the pipeline of singletons, module types, and mutators for
// generating build.ninja and other files for Kati, from Android.bp files.
func (ctx *Context) Register() {
- preSingletons.registerAll(ctx)
-
for _, t := range moduleTypes {
t.register(ctx)
}
@@ -277,17 +260,17 @@
func collateGloballyRegisteredSingletons() sortableComponents {
allSingletons := append(sortableComponents(nil), singletons...)
allSingletons = append(allSingletons,
- singleton{pre: false, parallel: true, name: "bazeldeps", factory: BazelSingleton},
+ singleton{parallel: true, name: "bazeldeps", factory: BazelSingleton},
// Register phony just before makevars so it can write out its phony rules as Make rules
- singleton{pre: false, parallel: false, name: "phony", factory: phonySingletonFactory},
+ singleton{parallel: false, name: "phony", factory: phonySingletonFactory},
// Register makevars after other singletons so they can export values through makevars
- singleton{pre: false, parallel: false, name: "makevars", factory: makeVarsSingletonFunc},
+ singleton{parallel: false, name: "makevars", factory: makeVarsSingletonFunc},
// Register env and ninjadeps last so that they can track all used environment variables and
// Ninja file dependencies stored in the config.
- singleton{pre: false, parallel: false, name: "ninjadeps", factory: ninjaDepsSingletonFactory},
+ singleton{parallel: false, name: "ninjadeps", factory: ninjaDepsSingletonFactory},
)
return allSingletons
@@ -317,7 +300,6 @@
RegisterModuleType(name string, factory ModuleFactory)
RegisterSingletonModuleType(name string, factory SingletonModuleFactory)
RegisterParallelSingletonModuleType(name string, factory SingletonModuleFactory)
- RegisterPreSingletonType(name string, factory SingletonFactory)
RegisterParallelSingletonType(name string, factory SingletonFactory)
RegisterSingletonType(name string, factory SingletonFactory)
PreArchMutators(f RegisterMutatorFunc)
@@ -349,9 +331,8 @@
// ctx := android.NewTestContext(config)
// RegisterBuildComponents(ctx)
var InitRegistrationContext RegistrationContext = &initRegistrationContext{
- moduleTypes: make(map[string]ModuleFactory),
- singletonTypes: make(map[string]SingletonFactory),
- preSingletonTypes: make(map[string]SingletonFactory),
+ moduleTypes: make(map[string]ModuleFactory),
+ singletonTypes: make(map[string]SingletonFactory),
}
// Make sure the TestContext implements RegistrationContext.
@@ -360,7 +341,6 @@
type initRegistrationContext struct {
moduleTypes map[string]ModuleFactory
singletonTypes map[string]SingletonFactory
- preSingletonTypes map[string]SingletonFactory
moduleTypesForDocs map[string]reflect.Value
}
@@ -406,14 +386,6 @@
ctx.registerSingletonType(name, factory, true)
}
-func (ctx *initRegistrationContext) RegisterPreSingletonType(name string, factory SingletonFactory) {
- if _, present := ctx.preSingletonTypes[name]; present {
- panic(fmt.Sprintf("pre singleton type %q is already registered", name))
- }
- ctx.preSingletonTypes[name] = factory
- RegisterPreSingletonType(name, factory)
-}
-
func (ctx *initRegistrationContext) PreArchMutators(f RegisterMutatorFunc) {
PreArchMutators(f)
}