From 6fbc68d41d9c3d3a4cd57a8adfaf72f7b76f31be Mon Sep 17 00:00:00 2001 From: "Lukacs T. Berki" Date: Thu, 4 Nov 2021 09:56:07 +0100 Subject: [PATCH] Move bpglob to outside of the Ninja action graph. It's in reality built by Microfactory quite early in the build which takes care of incrementality in bpglob itself. Test: Presubmits. Change-Id: I066a6e85f48e9cfec4efd46cb1f615c68b806080 --- bootstrap/bootstrap.go | 14 -------------- bootstrap/glob.go | 12 ++++-------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index f68e5ef..13c6a0b 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -149,13 +149,6 @@ var ( }, "depfile") - noop = pctx.StaticRule("noop", - blueprint.RuleParams{ - Command: "true", - Description: "noop", - Restat: true, - }) - _ = pctx.VariableFunc("ToolDir", func(config interface{}) (string, error) { return config.(BootstrapConfig).HostToolDir(), nil }) @@ -716,13 +709,6 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { Inputs: blueprintGoPackages, Optional: true, }) - - // out/soong/bpglob is built by microfactory before any ninja runs, write a rule that - // convinces ninja that it has been built to avoid tripping Soong's dangling rules check. - ctx.Build(pctx, blueprint.BuildParams{ - Rule: noop, - Outputs: []string{"$bootstrapGlobCmd"}, - }) } // packageRoot returns the module-specific package root directory path. This diff --git a/bootstrap/glob.go b/bootstrap/glob.go index 7d2953f..70495dc 100644 --- a/bootstrap/glob.go +++ b/bootstrap/glob.go @@ -44,12 +44,10 @@ import ( // in a build failure with a "missing and no known rule to make it" error. var ( - _ = pctx.VariableFunc("bootstrapGlobCmd", func(config interface{}) (string, error) { + _ = pctx.VariableFunc("globCmd", func(config interface{}) (string, error) { return filepath.Join(config.(BootstrapConfig).SoongOutDir(), "bpglob"), nil }) - _ = pctx.StaticVariable("primaryBuilderGlobCmd", filepath.Join("$ToolDir", "bpglob")) - // globRule rule traverses directories to produce a list of files that match $glob // and writes it to $out if it has changed, and writes the directories to $out.d GlobRule = pctx.StaticRule("GlobRule", @@ -62,7 +60,7 @@ var ( Deps: blueprint.DepsGCC, Depfile: "$out.d", }, - "args", "globCmd") + "args") ) // GlobFileContext is the subset of ModuleContext and SingletonContext needed by GlobFile @@ -84,8 +82,7 @@ func GlobFile(ctx GlobFileContext, pattern string, excludes []string, fileListFi Rule: GlobRule, Outputs: []string{fileListFile}, Args: map[string]string{ - "args": args, - "globCmd": "$primaryBuilderGlobCmd", + "args": args, }, Description: "glob " + pattern, }) @@ -116,8 +113,7 @@ func multipleGlobFilesRule(ctx GlobFileContext, fileListFile string, shard int, Rule: GlobRule, Outputs: []string{fileListFile}, Args: map[string]string{ - "args": args.String(), - "globCmd": "$bootstrapGlobCmd", + "args": args.String(), }, Description: fmt.Sprintf("regenerate globs shard %d of %d", shard, numGlobBuckets), })