diff --git a/context.go b/context.go index 1c08a3b..a197858 100644 --- a/context.go +++ b/context.go @@ -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 { diff --git a/module_ctx_test.go b/module_ctx_test.go index d1477ff..7dc7dec 100644 --- a/module_ctx_test.go +++ b/module_ctx_test.go @@ -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) }