diff options
| author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-09-01 20:37:56 +0000 |
|---|---|---|
| committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-09-01 20:37:56 +0000 |
| commit | 2eceb5b404f99b025e5d14f3c64e89bad2aec1df (patch) | |
| tree | 481f60ecefb06b7decc9c9f51717244adedced86 | |
| parent | e8957990f9cdea27cea23b7c813bbdf8c39764bd (diff) | |
| parent | ceb3c43f65e70b9be653122e9dfa0d5c1b380e78 (diff) | |
| download | platform_build_blueprint-build-tools-release.tar.gz platform_build_blueprint-build-tools-release.tar.bz2 platform_build_blueprint-build-tools-release.zip | |
Snap for 7694993 from ceb3c43f65e70b9be653122e9dfa0d5c1b380e78 to build-tools-releasebuild-tools-release
Change-Id: I90f4355e18ea055cf1ab68c42eefe611ed6b0f87
| -rw-r--r-- | Blueprints | 8 | ||||
| -rw-r--r-- | bootstrap/bootstrap.go | 53 | ||||
| -rw-r--r-- | bootstrap/command.go | 1 | ||||
| -rw-r--r-- | bootstrap/config.go | 10 | ||||
| -rw-r--r-- | bootstrap/glob.go | 4 |
5 files changed, 23 insertions, 53 deletions
@@ -140,7 +140,7 @@ bootstrap_go_package { ], } -bootstrap_go_binary { +blueprint_go_binary { name: "bpglob", deps: ["blueprint-pathtools"], srcs: ["bootstrap/bpglob/bpglob.go"], @@ -158,7 +158,7 @@ blueprint_go_binary { srcs: ["bpmodify/bpmodify.go"], } -bootstrap_go_binary { +blueprint_go_binary { name: "gotestmain", srcs: ["gotestmain/gotestmain.go"], } @@ -176,12 +176,12 @@ bootstrap_go_package { ], } -bootstrap_go_binary { +blueprint_go_binary { name: "gotestrunner", srcs: ["gotestrunner/gotestrunner.go"], } -bootstrap_go_binary { +blueprint_go_binary { name: "loadplugins", srcs: ["loadplugins/loadplugins.go"], } diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index 035e884..65d0147 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -25,14 +25,12 @@ import ( "github.com/google/blueprint/pathtools" ) -const bootstrapSubDir = ".bootstrap" - var ( pctx = blueprint.NewPackageContext("github.com/google/blueprint/bootstrap") - goTestMainCmd = pctx.StaticVariable("goTestMainCmd", filepath.Join(bootstrapDir, "bin", "gotestmain")) - goTestRunnerCmd = pctx.StaticVariable("goTestRunnerCmd", filepath.Join(bootstrapDir, "bin", "gotestrunner")) - pluginGenSrcCmd = pctx.StaticVariable("pluginGenSrcCmd", filepath.Join(bootstrapDir, "bin", "loadplugins")) + goTestMainCmd = pctx.StaticVariable("goTestMainCmd", filepath.Join("$ToolDir", "gotestmain")) + goTestRunnerCmd = pctx.StaticVariable("goTestRunnerCmd", filepath.Join("$ToolDir", "gotestrunner")) + pluginGenSrcCmd = pctx.StaticVariable("pluginGenSrcCmd", filepath.Join("$ToolDir", "loadplugins")) parallelCompile = pctx.StaticVariable("parallelCompile", func() string { // Parallel compilation is only supported on >= go1.9 @@ -151,15 +149,9 @@ var ( }, "depfile") - _ = pctx.VariableFunc("BinDir", func(config interface{}) (string, error) { - return bootstrapBinDir(config), nil - }) - _ = pctx.VariableFunc("ToolDir", func(config interface{}) (string, error) { - return toolDir(config), nil + return config.(BootstrapConfig).HostToolDir(), nil }) - - bootstrapDir = filepath.Join("$soongOutDir", bootstrapSubDir) ) type GoBinaryTool interface { @@ -169,17 +161,6 @@ type GoBinaryTool interface { isGoBinary() } -func bootstrapBinDir(config interface{}) string { - return filepath.Join(config.(BootstrapConfig).SoongOutDir(), bootstrapSubDir, "bin") -} - -func toolDir(config interface{}) string { - if c, ok := config.(ConfigBlueprintToolLocation); ok { - return filepath.Join(c.BlueprintToolLocation()) - } - return filepath.Join(config.(BootstrapConfig).SoongOutDir(), "bin") -} - func pluginDeps(ctx blueprint.BottomUpMutatorContext) { if pkg, ok := ctx.Module().(*goPackage); ok { if ctx.PrimaryModule() == ctx.Module() { @@ -444,13 +425,7 @@ func (g *goBinary) GenerateBuildActions(ctx blueprint.ModuleContext) { genSrcs = []string{} ) - if g.properties.Tool_dir { - g.installPath = filepath.Join(toolDir(ctx.Config()), name) - } else { - soongOutDir := ctx.Config().(BootstrapConfig).SoongOutDir() - g.installPath = filepath.Join(soongOutDir, bootstrapSubDir, "bin", name) - } - + g.installPath = filepath.Join(ctx.Config().(BootstrapConfig).HostToolDir(), name) ctx.VisitDepsDepthFirstIf(isGoPluginFor(name), func(module blueprint.Module) { hasPlugins = true }) if hasPlugins { @@ -728,7 +703,7 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { primaryBuilderName = ctx.ModuleName(primaryBuilders[0]) } - primaryBuilderFile := filepath.Join("$BinDir", primaryBuilderName) + primaryBuilderFile := filepath.Join("$ToolDir", primaryBuilderName) ctx.SetOutDir(pctx, "${outDir}") for _, subninja := range s.config.subninjas { @@ -776,16 +751,16 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { // directory is where the final package .a files are output and where dependant // modules search for this package via -I arguments. func packageRoot(ctx blueprint.ModuleContext) string { - soongOutDir := ctx.Config().(BootstrapConfig).SoongOutDir() - return filepath.Join(soongOutDir, bootstrapSubDir, ctx.ModuleName(), "pkg") + toolDir := ctx.Config().(BootstrapConfig).HostToolDir() + return filepath.Join(toolDir, "go", ctx.ModuleName(), "pkg") } // testRoot returns the module-specific package root directory path used for // building tests. The .a files generated here will include everything from // packageRoot, plus the test-only code. func testRoot(ctx blueprint.ModuleContext) string { - soongOutDir := ctx.Config().(BootstrapConfig).SoongOutDir() - return filepath.Join(soongOutDir, bootstrapSubDir, ctx.ModuleName(), "test") + toolDir := ctx.Config().(BootstrapConfig).HostToolDir() + return filepath.Join(toolDir, "go", ctx.ModuleName(), "test") } // moduleSrcDir returns the path of the directory that all source file paths are @@ -796,12 +771,12 @@ func moduleSrcDir(ctx blueprint.ModuleContext) string { // moduleObjDir returns the module-specific object directory path. func moduleObjDir(ctx blueprint.ModuleContext) string { - soongOutDir := ctx.Config().(BootstrapConfig).SoongOutDir() - return filepath.Join(soongOutDir, bootstrapSubDir, ctx.ModuleName(), "obj") + toolDir := ctx.Config().(BootstrapConfig).HostToolDir() + return filepath.Join(toolDir, "go", ctx.ModuleName(), "obj") } // moduleGenSrcDir returns the module-specific generated sources path. func moduleGenSrcDir(ctx blueprint.ModuleContext) string { - soongOutDir := ctx.Config().(BootstrapConfig).SoongOutDir() - return filepath.Join(soongOutDir, bootstrapSubDir, ctx.ModuleName(), "gen") + toolDir := ctx.Config().(BootstrapConfig).HostToolDir() + return filepath.Join(toolDir, "go", ctx.ModuleName(), "gen") } diff --git a/bootstrap/command.go b/bootstrap/command.go index 228a0cc..f4eddc2 100644 --- a/bootstrap/command.go +++ b/bootstrap/command.go @@ -147,7 +147,6 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin ctx.RegisterBottomUpMutator("bootstrap_plugin_deps", pluginDeps) ctx.RegisterModuleType("bootstrap_go_package", newGoPackageModuleFactory(bootstrapConfig)) - ctx.RegisterModuleType("bootstrap_go_binary", newGoBinaryModuleFactory(bootstrapConfig, false)) ctx.RegisterModuleType("blueprint_go_binary", newGoBinaryModuleFactory(bootstrapConfig, true)) ctx.RegisterSingletonType("bootstrap", newSingletonFactory(bootstrapConfig)) diff --git a/bootstrap/config.go b/bootstrap/config.go index 3706fbe..31d2f57 100644 --- a/bootstrap/config.go +++ b/bootstrap/config.go @@ -76,6 +76,9 @@ var ( ) type BootstrapConfig interface { + // The directory where tools run during the build are located. + HostToolDir() string + // The directory where files emitted during bootstrapping are located. // Usually OutDir() + "/soong". SoongOutDir() string @@ -95,13 +98,6 @@ type ConfigRemoveAbandonedFilesUnder interface { RemoveAbandonedFilesUnder(buildDir string) (under, except []string) } -type ConfigBlueprintToolLocation interface { - // BlueprintToolLocation can return a path name to install blueprint tools - // designed for end users (bpfmt, bpmodify, and anything else using - // blueprint_go_binary). - BlueprintToolLocation() string -} - type StopBefore int const ( diff --git a/bootstrap/glob.go b/bootstrap/glob.go index 0e8caca..9c80025 100644 --- a/bootstrap/glob.go +++ b/bootstrap/glob.go @@ -44,7 +44,7 @@ import ( // in a build failure with a "missing and no known rule to make it" error. var ( - globCmd = filepath.Join(bootstrapDir, "bpglob") + globCmd = 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 @@ -168,7 +168,7 @@ func globBucketName(globDir string, globBucket int) string { // Returns the directory where glob list files live func GlobDirectory(buildDir, globListDir string) string { - return filepath.Join(buildDir, bootstrapSubDir, globListDir) + return filepath.Join(buildDir, "globs", globListDir) } func (s *GlobSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) { |
