Clean up unnecessary dependencies
Other than cleaning up the code, the only change in behavior is to run the docs build in parallel with the primary builder, saving about a second on a Soong bootstrap (10s -> 9s). Change-Id: Iaff51d6d1a37af842f294f12db11d5774d48d440
This commit is contained in:
parent
b6d88a4f0a
commit
460c80eb12
3 changed files with 16 additions and 54 deletions
|
@ -53,10 +53,10 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build minibp and the primary build.ninja
|
# 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
|
# 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.
|
# SKIP_NINJA can be used by wrappers that wish to run ninja themselves.
|
||||||
if [ -z "$SKIP_NINJA" ]; then
|
if [ -z "$SKIP_NINJA" ]; then
|
||||||
|
|
|
@ -596,10 +596,6 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
|
||||||
// creating the binary that we'll use to generate the non-bootstrap
|
// creating the binary that we'll use to generate the non-bootstrap
|
||||||
// build.ninja file.
|
// build.ninja file.
|
||||||
var primaryBuilders []*goBinary
|
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
|
// blueprintTools contains blueprint go binaries that will be built in StageMain
|
||||||
var blueprintTools []string
|
var blueprintTools []string
|
||||||
ctx.VisitAllModulesIf(isBootstrapBinaryModule,
|
ctx.VisitAllModulesIf(isBootstrapBinaryModule,
|
||||||
|
@ -608,12 +604,7 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
|
||||||
binaryModuleName := ctx.ModuleName(binaryModule)
|
binaryModuleName := ctx.ModuleName(binaryModule)
|
||||||
installPath := filepath.Join(binaryModule.InstallPath(), binaryModuleName)
|
installPath := filepath.Join(binaryModule.InstallPath(), binaryModuleName)
|
||||||
|
|
||||||
switch binaryModule.BuildStage() {
|
if binaryModule.BuildStage() == StageMain {
|
||||||
case StageBootstrap:
|
|
||||||
bootstrapDeps = append(bootstrapDeps, installPath)
|
|
||||||
case StagePrimary:
|
|
||||||
primaryBootstrapDeps = append(primaryBootstrapDeps, installPath)
|
|
||||||
case StageMain:
|
|
||||||
blueprintTools = append(blueprintTools, installPath)
|
blueprintTools = append(blueprintTools, installPath)
|
||||||
}
|
}
|
||||||
if binaryModule.properties.PrimaryBuilder {
|
if binaryModule.properties.PrimaryBuilder {
|
||||||
|
@ -653,35 +644,12 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
|
||||||
topLevelBlueprints := filepath.Join("$srcDir",
|
topLevelBlueprints := filepath.Join("$srcDir",
|
||||||
filepath.Base(s.config.topLevelBlueprintsFile))
|
filepath.Base(s.config.topLevelBlueprintsFile))
|
||||||
|
|
||||||
bootstrapDeps = append(bootstrapDeps, topLevelBlueprints)
|
|
||||||
|
|
||||||
mainNinjaFile := filepath.Join("$buildDir", "build.ninja")
|
mainNinjaFile := filepath.Join("$buildDir", "build.ninja")
|
||||||
primaryBuilderNinjaFile := filepath.Join(bootstrapDir, "build.ninja")
|
primaryBuilderNinjaFile := filepath.Join(bootstrapDir, "build.ninja")
|
||||||
bootstrapNinjaFileTemplate := filepath.Join(miniBootstrapDir, "build.ninja.in")
|
bootstrapNinjaFileTemplate := filepath.Join(miniBootstrapDir, "build.ninja.in")
|
||||||
bootstrapNinjaFile := filepath.Join(miniBootstrapDir, "build.ninja")
|
bootstrapNinjaFile := filepath.Join(miniBootstrapDir, "build.ninja")
|
||||||
docsFile := filepath.Join(docsDir, primaryBuilderName+".html")
|
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 {
|
switch s.config.stage {
|
||||||
case StageBootstrap:
|
case StageBootstrap:
|
||||||
// We're generating a bootstrapper Ninja file, so we need to set things
|
// 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.
|
// Generate the Ninja file to build the primary builder.
|
||||||
ctx.Build(pctx, blueprint.BuildParams{
|
ctx.Build(pctx, blueprint.BuildParams{
|
||||||
Rule: generateBuildNinja,
|
Rule: generateBuildNinja,
|
||||||
Outputs: []string{primaryBuilderNinjaFile},
|
Outputs: []string{primaryBuilderNinjaFile},
|
||||||
Inputs: []string{topLevelBlueprints},
|
Inputs: []string{topLevelBlueprints},
|
||||||
Implicits: bootstrapDeps,
|
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"builder": minibpFile,
|
"builder": minibpFile,
|
||||||
"extra": "--build-primary" + extraTestFlags,
|
"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
|
// Add a way to rebuild the primary build.ninja so that globs works
|
||||||
ctx.Build(pctx, blueprint.BuildParams{
|
ctx.Build(pctx, blueprint.BuildParams{
|
||||||
Rule: generateBuildNinja,
|
Rule: generateBuildNinja,
|
||||||
Outputs: []string{primaryBuilderNinjaFile},
|
Outputs: []string{primaryBuilderNinjaFile},
|
||||||
Inputs: []string{topLevelBlueprints},
|
Inputs: []string{topLevelBlueprints},
|
||||||
Implicits: bootstrapDeps,
|
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"builder": minibpFile,
|
"builder": minibpFile,
|
||||||
"extra": "--build-primary" + extraTestFlags,
|
"extra": "--build-primary" + extraTestFlags,
|
||||||
|
@ -743,10 +709,9 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
|
||||||
|
|
||||||
// Build the main build.ninja
|
// Build the main build.ninja
|
||||||
ctx.Build(pctx, blueprint.BuildParams{
|
ctx.Build(pctx, blueprint.BuildParams{
|
||||||
Rule: generateBuildNinja,
|
Rule: generateBuildNinja,
|
||||||
Outputs: []string{mainNinjaFile},
|
Outputs: []string{mainNinjaFile},
|
||||||
Inputs: []string{topLevelBlueprints},
|
Inputs: []string{topLevelBlueprints},
|
||||||
Implicits: primaryBootstrapDeps,
|
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"builder": primaryBuilderFile,
|
"builder": primaryBuilderFile,
|
||||||
"extra": primaryBuilderExtraFlags,
|
"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
|
// 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)
|
// it will depend on itself. (In Android, globs with soong_glob)
|
||||||
ctx.Build(pctx, blueprint.BuildParams{
|
ctx.Build(pctx, blueprint.BuildParams{
|
||||||
Rule: generateBuildNinja,
|
Rule: generateBuildNinja,
|
||||||
Outputs: []string{mainNinjaFile},
|
Outputs: []string{mainNinjaFile},
|
||||||
Inputs: []string{topLevelBlueprints},
|
Inputs: []string{topLevelBlueprints},
|
||||||
Implicits: primaryBootstrapDeps,
|
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"builder": primaryBuilderFile,
|
"builder": primaryBuilderFile,
|
||||||
"extra": primaryBuilderExtraFlags,
|
"extra": primaryBuilderExtraFlags,
|
||||||
|
|
|
@ -270,9 +270,7 @@ default ${g.bootstrap.BinDir}/minibp
|
||||||
# Factory: github.com/google/blueprint/bootstrap.newSingletonFactory.func1
|
# Factory: github.com/google/blueprint/bootstrap.newSingletonFactory.func1
|
||||||
|
|
||||||
build ${g.bootstrap.buildDir}/.bootstrap/build.ninja: g.bootstrap.build.ninja $
|
build ${g.bootstrap.buildDir}/.bootstrap/build.ninja: g.bootstrap.build.ninja $
|
||||||
${g.bootstrap.srcDir}/Blueprints | ${builder} $
|
${g.bootstrap.srcDir}/Blueprints | ${builder}
|
||||||
${g.bootstrap.BinDir}/gotestmain ${g.bootstrap.BinDir}/gotestrunner $
|
|
||||||
${g.bootstrap.BinDir}/minibp ${g.bootstrap.srcDir}/Blueprints
|
|
||||||
builder = ${g.bootstrap.BinDir}/minibp
|
builder = ${g.bootstrap.BinDir}/minibp
|
||||||
extra = --build-primary
|
extra = --build-primary
|
||||||
default ${g.bootstrap.buildDir}/.bootstrap/build.ninja
|
default ${g.bootstrap.buildDir}/.bootstrap/build.ninja
|
||||||
|
|
Loading…
Reference in a new issue