diff --git a/blueprint.bash b/blueprint.bash index d51f18c..924838c 100755 --- a/blueprint.bash +++ b/blueprint.bash @@ -53,10 +53,10 @@ else fi # Build minibp and the primary build.ninja -"${NINJA}" -w dupbuild=err -f "${BUILDDIR}/.minibootstrap/build.ninja" "${BUILDDIR}/.bootstrap/build.ninja" +"${NINJA}" -w dupbuild=err -f "${BUILDDIR}/.minibootstrap/build.ninja" # Build the primary builder and the main build.ninja -"${NINJA}" -w dupbuild=err -f "${BUILDDIR}/.bootstrap/build.ninja" "${BUILDDIR}/build.ninja" +"${NINJA}" -w dupbuild=err -f "${BUILDDIR}/.bootstrap/build.ninja" # SKIP_NINJA can be used by wrappers that wish to run ninja themselves. if [ -z "$SKIP_NINJA" ]; then diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index a46476b..981f647 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -596,10 +596,6 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { // creating the binary that we'll use to generate the non-bootstrap // build.ninja file. var primaryBuilders []*goBinary - // bootstrapDeps contains modules that will be built in StageBootstrap - var bootstrapDeps []string - // primaryBootstrapDeps contains modules that will be built in StagePrimary - var primaryBootstrapDeps []string // blueprintTools contains blueprint go binaries that will be built in StageMain var blueprintTools []string ctx.VisitAllModulesIf(isBootstrapBinaryModule, @@ -608,12 +604,7 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { binaryModuleName := ctx.ModuleName(binaryModule) installPath := filepath.Join(binaryModule.InstallPath(), binaryModuleName) - switch binaryModule.BuildStage() { - case StageBootstrap: - bootstrapDeps = append(bootstrapDeps, installPath) - case StagePrimary: - primaryBootstrapDeps = append(primaryBootstrapDeps, installPath) - case StageMain: + if binaryModule.BuildStage() == StageMain { blueprintTools = append(blueprintTools, installPath) } if binaryModule.properties.PrimaryBuilder { @@ -653,35 +644,12 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { topLevelBlueprints := filepath.Join("$srcDir", filepath.Base(s.config.topLevelBlueprintsFile)) - bootstrapDeps = append(bootstrapDeps, topLevelBlueprints) - mainNinjaFile := filepath.Join("$buildDir", "build.ninja") primaryBuilderNinjaFile := filepath.Join(bootstrapDir, "build.ninja") bootstrapNinjaFileTemplate := filepath.Join(miniBootstrapDir, "build.ninja.in") bootstrapNinjaFile := filepath.Join(miniBootstrapDir, "build.ninja") docsFile := filepath.Join(docsDir, primaryBuilderName+".html") - primaryBootstrapDeps = append(primaryBootstrapDeps, docsFile) - - // If the tests change, be sure to re-run them. These need to be - // dependencies for the ninja file so that it's updated after these - // run. - ctx.VisitAllModulesIf(isGoTestProducer, - func(module blueprint.Module) { - testModule := module.(goTestProducer) - target := testModule.GoTestTarget() - if target != "" { - switch testModule.BuildStage() { - case StageBootstrap: - bootstrapDeps = append(bootstrapDeps, target) - case StagePrimary: - primaryBootstrapDeps = append(primaryBootstrapDeps, target) - case StageMain: - blueprintTools = append(blueprintTools, target) - } - } - }) - switch s.config.stage { case StageBootstrap: // We're generating a bootstrapper Ninja file, so we need to set things @@ -693,10 +661,9 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { // Generate the Ninja file to build the primary builder. ctx.Build(pctx, blueprint.BuildParams{ - Rule: generateBuildNinja, - Outputs: []string{primaryBuilderNinjaFile}, - Inputs: []string{topLevelBlueprints}, - Implicits: bootstrapDeps, + Rule: generateBuildNinja, + Outputs: []string{primaryBuilderNinjaFile}, + Inputs: []string{topLevelBlueprints}, Args: map[string]string{ "builder": minibpFile, "extra": "--build-primary" + extraTestFlags, @@ -730,10 +697,9 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { // Add a way to rebuild the primary build.ninja so that globs works ctx.Build(pctx, blueprint.BuildParams{ - Rule: generateBuildNinja, - Outputs: []string{primaryBuilderNinjaFile}, - Inputs: []string{topLevelBlueprints}, - Implicits: bootstrapDeps, + Rule: generateBuildNinja, + Outputs: []string{primaryBuilderNinjaFile}, + Inputs: []string{topLevelBlueprints}, Args: map[string]string{ "builder": minibpFile, "extra": "--build-primary" + extraTestFlags, @@ -743,10 +709,9 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { // Build the main build.ninja ctx.Build(pctx, blueprint.BuildParams{ - Rule: generateBuildNinja, - Outputs: []string{mainNinjaFile}, - Inputs: []string{topLevelBlueprints}, - Implicits: primaryBootstrapDeps, + Rule: generateBuildNinja, + Outputs: []string{mainNinjaFile}, + Inputs: []string{topLevelBlueprints}, Args: map[string]string{ "builder": primaryBuilderFile, "extra": primaryBuilderExtraFlags, @@ -777,10 +742,9 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) { // Add a way to rebuild the main build.ninja in case it creates rules that // it will depend on itself. (In Android, globs with soong_glob) ctx.Build(pctx, blueprint.BuildParams{ - Rule: generateBuildNinja, - Outputs: []string{mainNinjaFile}, - Inputs: []string{topLevelBlueprints}, - Implicits: primaryBootstrapDeps, + Rule: generateBuildNinja, + Outputs: []string{mainNinjaFile}, + Inputs: []string{topLevelBlueprints}, Args: map[string]string{ "builder": primaryBuilderFile, "extra": primaryBuilderExtraFlags, diff --git a/build.ninja.in b/build.ninja.in index 368a1b9..8b3fe98 100644 --- a/build.ninja.in +++ b/build.ninja.in @@ -270,9 +270,7 @@ default ${g.bootstrap.BinDir}/minibp # Factory: github.com/google/blueprint/bootstrap.newSingletonFactory.func1 build ${g.bootstrap.buildDir}/.bootstrap/build.ninja: g.bootstrap.build.ninja $ - ${g.bootstrap.srcDir}/Blueprints | ${builder} $ - ${g.bootstrap.BinDir}/gotestmain ${g.bootstrap.BinDir}/gotestrunner $ - ${g.bootstrap.BinDir}/minibp ${g.bootstrap.srcDir}/Blueprints + ${g.bootstrap.srcDir}/Blueprints | ${builder} builder = ${g.bootstrap.BinDir}/minibp extra = --build-primary default ${g.bootstrap.buildDir}/.bootstrap/build.ninja