Merge "Remove bootstrap_go_binary ."

This commit is contained in:
Lukács T. Berki
2021-09-01 14:15:58 +00:00
committed by Gerrit Code Review
5 changed files with 27 additions and 9 deletions

View File

@@ -555,12 +555,10 @@ var _ bootstrap.ConfigStopBefore = (*config)(nil)
// BlueprintToolLocation returns the directory containing build system tools // BlueprintToolLocation returns the directory containing build system tools
// from Blueprint, like soong_zip and merge_zips. // from Blueprint, like soong_zip and merge_zips.
func (c *config) BlueprintToolLocation() string { func (c *config) HostToolDir() string {
return filepath.Join(c.soongOutDir, "host", c.PrebuiltOS(), "bin") return filepath.Join(c.soongOutDir, "host", c.PrebuiltOS(), "bin")
} }
var _ bootstrap.ConfigBlueprintToolLocation = (*config)(nil)
func (c *config) HostToolPath(ctx PathContext, tool string) Path { func (c *config) HostToolPath(ctx PathContext, tool string) Path {
return PathForOutput(ctx, "host", c.PrebuiltOS(), "bin", tool) return PathForOutput(ctx, "host", c.PrebuiltOS(), "bin", tool)
} }

View File

@@ -16,7 +16,7 @@ package {
default_applicable_licenses: ["Android-Apache-2.0"], default_applicable_licenses: ["Android-Apache-2.0"],
} }
bootstrap_go_binary { blueprint_go_binary {
name: "soong_build", name: "soong_build",
deps: [ deps: [
"blueprint", "blueprint",

View File

@@ -144,7 +144,7 @@ EOF
run_soong run_soong
local ninja_mtime1=$(stat -c "%y" out/soong/build.ninja) local ninja_mtime1=$(stat -c "%y" out/soong/build.ninja)
local glob_deps_file=out/soong/.bootstrap/globs/0.d local glob_deps_file=out/soong/globs/build/0.d
if [ -e "$glob_deps_file" ]; then if [ -e "$glob_deps_file" ]; then
fail "Glob deps file unexpectedly written on first build" fail "Glob deps file unexpectedly written on first build"

View File

@@ -739,6 +739,20 @@ func (c *configImpl) SoongOutDir() string {
return filepath.Join(c.OutDir(), "soong") return filepath.Join(c.OutDir(), "soong")
} }
func (c *configImpl) PrebuiltOS() string {
switch runtime.GOOS {
case "linux":
return "linux-x86"
case "darwin":
return "darwin-x86"
default:
panic("Unknown GOOS")
}
}
func (c *configImpl) HostToolDir() string {
return filepath.Join(c.SoongOutDir(), "host", c.PrebuiltOS(), "bin")
}
func (c *configImpl) MainNinjaFile() string { func (c *configImpl) MainNinjaFile() string {
return shared.JoinPath(c.SoongOutDir(), "build.ninja") return shared.JoinPath(c.SoongOutDir(), "build.ninja")
} }

View File

@@ -71,11 +71,16 @@ func writeEnvironmentFile(ctx Context, envFile string, envDeps map[string]string
// A tiny struct used to tell Blueprint that it's in bootstrap mode. It would // A tiny struct used to tell Blueprint that it's in bootstrap mode. It would
// probably be nicer to use a flag in bootstrap.Args instead. // probably be nicer to use a flag in bootstrap.Args instead.
type BlueprintConfig struct { type BlueprintConfig struct {
toolDir string
soongOutDir string soongOutDir string
outDir string outDir string
debugCompilation bool debugCompilation bool
} }
func (c BlueprintConfig) HostToolDir() string {
return c.toolDir
}
func (c BlueprintConfig) SoongOutDir() string { func (c BlueprintConfig) SoongOutDir() string {
return c.soongOutDir return c.soongOutDir
} }
@@ -151,7 +156,7 @@ func bootstrapBlueprint(ctx Context, config Config) {
} }
soongBuildArgs := []string{ soongBuildArgs := []string{
"--globListDir", "globs", "--globListDir", "build",
"--globFile", bootstrapGlobFile, "--globFile", bootstrapGlobFile,
} }
@@ -167,7 +172,7 @@ func bootstrapBlueprint(ctx Context, config Config) {
bp2buildArgs := []string{ bp2buildArgs := []string{
"--bp2build_marker", config.Bp2BuildMarkerFile(), "--bp2build_marker", config.Bp2BuildMarkerFile(),
"--globListDir", "globs.bp2build", "--globListDir", "bp2build",
"--globFile", bp2buildGlobFile, "--globFile", bp2buildGlobFile,
} }
@@ -183,7 +188,7 @@ func bootstrapBlueprint(ctx Context, config Config) {
moduleGraphArgs := []string{ moduleGraphArgs := []string{
"--module_graph_file", config.ModuleGraphFile(), "--module_graph_file", config.ModuleGraphFile(),
"--globListDir", "globs.modulegraph", "--globListDir", "modulegraph",
"--globFile", moduleGraphGlobFile, "--globFile", moduleGraphGlobFile,
} }
@@ -207,6 +212,7 @@ func bootstrapBlueprint(ctx Context, config Config) {
blueprintCtx.SetIgnoreUnknownModuleTypes(true) blueprintCtx.SetIgnoreUnknownModuleTypes(true)
blueprintConfig := BlueprintConfig{ blueprintConfig := BlueprintConfig{
soongOutDir: config.SoongOutDir(), soongOutDir: config.SoongOutDir(),
toolDir: config.HostToolDir(),
outDir: config.OutDir(), outDir: config.OutDir(),
debugCompilation: os.Getenv("SOONG_DELVE") != "", debugCompilation: os.Getenv("SOONG_DELVE") != "",
} }
@@ -282,7 +288,7 @@ func runSoong(ctx Context, config Config) {
} }
}() }()
runMicrofactory(ctx, config, ".bootstrap/bpglob", "github.com/google/blueprint/bootstrap/bpglob", runMicrofactory(ctx, config, filepath.Join(config.HostToolDir(), "bpglob"), "github.com/google/blueprint/bootstrap/bpglob",
map[string]string{"github.com/google/blueprint": "build/blueprint"}) map[string]string{"github.com/google/blueprint": "build/blueprint"})
ninja := func(name, ninjaFile string, targets ...string) { ninja := func(name, ninjaFile string, targets ...string) {