Remove pre singletons

They're no longer used.

Test: m nothing --no-skip-soong-tests
Change-Id: I6481381a2ac6bca4211c88173dd4275261123e86
This commit is contained in:
Cole Faust 2023-11-01 15:26:17 -07:00
parent 098c09334f
commit 41cbc49a25
2 changed files with 2 additions and 44 deletions

View file

@ -84,7 +84,6 @@ type Context struct {
moduleGroups []*moduleGroup
moduleInfo map[Module]*moduleInfo
modulesSorted []*moduleInfo
preSingletonInfo []*singletonInfo
singletonInfo []*singletonInfo
mutatorInfo []*mutatorInfo
variantMutatorNames []string
@ -594,29 +593,6 @@ func (c *Context) RegisterSingletonType(name string, factory SingletonFactory, p
})
}
// RegisterPreSingletonType registers a presingleton type that will be invoked to
// generate build actions before any Blueprint files have been read. Each registered
// presingleton type is instantiated and invoked exactly once at the beginning of the
// parse phase. Each registered presingleton is invoked in registration order.
//
// The presingleton type names given here must be unique for the context. The
// factory function should be a named function so that its package and name can
// be included in the generated Ninja file for debugging purposes.
func (c *Context) RegisterPreSingletonType(name string, factory SingletonFactory) {
for _, s := range c.preSingletonInfo {
if s.name == name {
panic(fmt.Errorf("presingleton %q is already registered", name))
}
}
c.preSingletonInfo = append(c.preSingletonInfo, &singletonInfo{
factory: factory,
singleton: factory(),
name: name,
parallel: false,
})
}
func (c *Context) SetNameInterface(i NameInterface) {
c.nameInterface = i
}
@ -1970,22 +1946,15 @@ func (c *Context) resolveDependencies(ctx context.Context, config interface{}) (
c.liveGlobals = newLiveTracker(c, config)
deps, errs = c.generateSingletonBuildActions(config, c.preSingletonInfo, c.liveGlobals)
if len(errs) > 0 {
return
}
errs = c.updateDependencies()
if len(errs) > 0 {
return
}
var mutatorDeps []string
mutatorDeps, errs = c.runMutators(ctx, config)
deps, errs = c.runMutators(ctx, config)
if len(errs) > 0 {
return
}
deps = append(deps, mutatorDeps...)
c.BeginEvent("clone_modules")
if !c.SkipCloneModulesAfterMutators {

View file

@ -556,16 +556,6 @@ func addNinjaDepsTestTopDownMutator(ctx TopDownMutatorContext) {
ctx.AddNinjaFileDeps("TopDownMutator")
}
type addNinjaDepsTestPreSingleton struct{}
func addNinjaDepsTestPreSingletonFactory() Singleton {
return &addNinjaDepsTestPreSingleton{}
}
func (s *addNinjaDepsTestPreSingleton) GenerateBuildActions(ctx SingletonContext) {
ctx.AddNinjaFileDeps("PreSingleton")
}
type addNinjaDepsTestSingleton struct{}
func addNinjaDepsTestSingletonFactory() Singleton {
@ -589,7 +579,6 @@ func TestAddNinjaFileDeps(t *testing.T) {
ctx.RegisterModuleType("test", addNinjaDepsTestModuleFactory)
ctx.RegisterBottomUpMutator("testBottomUpMutator", addNinjaDepsTestBottomUpMutator)
ctx.RegisterTopDownMutator("testTopDownMutator", addNinjaDepsTestTopDownMutator)
ctx.RegisterPreSingletonType("testPreSingleton", addNinjaDepsTestPreSingletonFactory)
ctx.RegisterSingletonType("testSingleton", addNinjaDepsTestSingletonFactory, false)
parseDeps, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) > 0 {
@ -622,7 +611,7 @@ func TestAddNinjaFileDeps(t *testing.T) {
t.Errorf("ParseBlueprintsFiles: wanted deps %q, got %q", w, g)
}
if g, w := resolveDeps, []string{"PreSingleton", "BottomUpMutator", "TopDownMutator"}; !reflect.DeepEqual(g, w) {
if g, w := resolveDeps, []string{"BottomUpMutator", "TopDownMutator"}; !reflect.DeepEqual(g, w) {
t.Errorf("ResolveDependencies: wanted deps %q, got %q", w, g)
}