diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2023-11-02 18:20:14 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-11-02 18:20:14 +0000 |
commit | 90d740b3cb1ffd4ba812c60e00822ddeefd44407 (patch) | |
tree | 0530337fca59a057e69e9a25457d3d0b6bbb0320 | |
parent | 94bbe04b4c19ac7d17a2681bb4432be2c5ab6671 (diff) | |
parent | 228915b2f1d81fdadf9ed6d1f65814703da5936c (diff) | |
download | blueprint-90d740b3cb1ffd4ba812c60e00822ddeefd44407.tar.gz |
Merge "Remove pre singletons" into main am: 228915b2f1
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2814612
Change-Id: I94b057984594b70f513cb314c21924c9a2be0748
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | context.go | 33 | ||||
-rw-r--r-- | module_ctx_test.go | 13 |
2 files changed, 2 insertions, 44 deletions
@@ -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) } |