Remove some unnecessary arguments from Blueprint. am: ce41c169b5
am: f05ce1b487
am: 40c2cd13a5
am: 9da7aa7843
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1814158 Change-Id: Ie2bf9bb4a32c62643e9c53086b86a29dbf1a5314
This commit is contained in:
commit
28dc7366e1
3 changed files with 51 additions and 74 deletions
|
@ -735,45 +735,41 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
|
|||
ctx.AddSubninja(subninja)
|
||||
}
|
||||
|
||||
if s.config.stage == StagePrimary {
|
||||
for _, i := range s.config.primaryBuilderInvocations {
|
||||
flags := make([]string, 0)
|
||||
flags = append(flags, primaryBuilderCmdlinePrefix...)
|
||||
flags = append(flags, i.Args...)
|
||||
for _, i := range s.config.primaryBuilderInvocations {
|
||||
flags := make([]string, 0)
|
||||
flags = append(flags, primaryBuilderCmdlinePrefix...)
|
||||
flags = append(flags, i.Args...)
|
||||
|
||||
// Build the main build.ninja
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: generateBuildNinja,
|
||||
Outputs: i.Outputs,
|
||||
Inputs: i.Inputs,
|
||||
Args: map[string]string{
|
||||
"builder": primaryBuilderFile,
|
||||
"extra": strings.Join(flags, " "),
|
||||
},
|
||||
// soong_ui explicitly requests what it wants to be build. This is
|
||||
// because the same Ninja file contains instructions to run
|
||||
// soong_build, run bp2build and to generate the JSON module graph.
|
||||
Optional: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if s.config.stage == StageMain {
|
||||
// Add a phony target for building various tools that are part of blueprint
|
||||
// Build the main build.ninja
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: blueprint.Phony,
|
||||
Outputs: []string{"blueprint_tools"},
|
||||
Inputs: blueprintTools,
|
||||
})
|
||||
|
||||
// Add a phony target for running go tests
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: blueprint.Phony,
|
||||
Outputs: []string{"blueprint_go_packages"},
|
||||
Inputs: blueprintGoPackages,
|
||||
Rule: generateBuildNinja,
|
||||
Outputs: i.Outputs,
|
||||
Inputs: i.Inputs,
|
||||
Args: map[string]string{
|
||||
"builder": primaryBuilderFile,
|
||||
"extra": strings.Join(flags, " "),
|
||||
},
|
||||
// soong_ui explicitly requests what it wants to be build. This is
|
||||
// because the same Ninja file contains instructions to run
|
||||
// soong_build, run bp2build and to generate the JSON module graph.
|
||||
Optional: true,
|
||||
})
|
||||
}
|
||||
|
||||
// Add a phony target for building various tools that are part of blueprint
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: blueprint.Phony,
|
||||
Outputs: []string{"blueprint_tools"},
|
||||
Inputs: blueprintTools,
|
||||
})
|
||||
|
||||
// Add a phony target for running go tests
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: blueprint.Phony,
|
||||
Outputs: []string{"blueprint_go_packages"},
|
||||
Inputs: blueprintGoPackages,
|
||||
Optional: true,
|
||||
})
|
||||
}
|
||||
|
||||
// packageRoot returns the module-specific package root directory path. This
|
||||
|
|
|
@ -30,24 +30,24 @@ import (
|
|||
)
|
||||
|
||||
type Args struct {
|
||||
OutFile string
|
||||
Subninjas []string
|
||||
Cpuprofile string
|
||||
Memprofile string
|
||||
DelveListen string
|
||||
DelvePath string
|
||||
TraceFile string
|
||||
RunGoTests bool
|
||||
UseValidations bool
|
||||
NoGC bool
|
||||
EmptyNinjaFile bool
|
||||
BuildDir string
|
||||
ModuleListFile string
|
||||
NinjaBuildDir string
|
||||
TopFile string
|
||||
GeneratingPrimaryBuilder bool
|
||||
ModuleListFile string
|
||||
OutDir string
|
||||
SoongOutDir string
|
||||
|
||||
OutFile string
|
||||
Subninjas []string
|
||||
PrimaryBuilderInvocations []PrimaryBuilderInvocation
|
||||
|
||||
RunGoTests bool
|
||||
UseValidations bool
|
||||
EmptyNinjaFile bool
|
||||
|
||||
NoGC bool
|
||||
Cpuprofile string
|
||||
Memprofile string
|
||||
DelveListen string
|
||||
DelvePath string
|
||||
TraceFile string
|
||||
}
|
||||
|
||||
func PrimaryBuilderExtraFlags(args Args, mainNinjaFile string) []string {
|
||||
|
@ -105,7 +105,7 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin
|
|||
defer trace.Stop()
|
||||
}
|
||||
|
||||
srcDir := filepath.Dir(args.TopFile)
|
||||
srcDir := "."
|
||||
|
||||
ninjaDeps := make([]string, 0)
|
||||
|
||||
|
@ -122,11 +122,6 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin
|
|||
|
||||
soongOutDir := config.(BootstrapConfig).SoongOutDir()
|
||||
|
||||
stage := StageMain
|
||||
if args.GeneratingPrimaryBuilder {
|
||||
stage = StagePrimary
|
||||
}
|
||||
|
||||
mainNinjaFile := filepath.Join("$soongOutDir", "build.ninja")
|
||||
|
||||
var invocations []PrimaryBuilderInvocation
|
||||
|
@ -135,19 +130,15 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin
|
|||
invocations = args.PrimaryBuilderInvocations
|
||||
} else {
|
||||
primaryBuilderArgs := PrimaryBuilderExtraFlags(args, mainNinjaFile)
|
||||
primaryBuilderArgs = append(primaryBuilderArgs, args.TopFile)
|
||||
|
||||
invocations = []PrimaryBuilderInvocation{{
|
||||
Inputs: []string{args.TopFile},
|
||||
Inputs: []string{},
|
||||
Outputs: []string{mainNinjaFile},
|
||||
Args: primaryBuilderArgs,
|
||||
}}
|
||||
}
|
||||
|
||||
bootstrapConfig := &Config{
|
||||
stage: stage,
|
||||
|
||||
topLevelBlueprintsFile: args.TopFile,
|
||||
subninjas: args.Subninjas,
|
||||
runGoTests: args.RunGoTests,
|
||||
useValidations: args.UseValidations,
|
||||
|
@ -160,7 +151,7 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin
|
|||
ctx.RegisterModuleType("blueprint_go_binary", newGoBinaryModuleFactory(bootstrapConfig, true))
|
||||
ctx.RegisterSingletonType("bootstrap", newSingletonFactory(bootstrapConfig))
|
||||
|
||||
blueprintFiles, errs := ctx.ParseFileList(filepath.Dir(args.TopFile), filesToParse, config)
|
||||
blueprintFiles, errs := ctx.ParseFileList(".", filesToParse, config)
|
||||
if len(errs) > 0 {
|
||||
fatalErrors(errs)
|
||||
}
|
||||
|
@ -203,7 +194,7 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin
|
|||
}
|
||||
}
|
||||
|
||||
if stage != StageMain || !args.EmptyNinjaFile {
|
||||
if !args.EmptyNinjaFile {
|
||||
f, err = os.OpenFile(joinPath(ctx.SrcDir(), args.OutFile), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, outFilePermissions)
|
||||
if err != nil {
|
||||
fatalf("error opening Ninja file: %s", err)
|
||||
|
|
|
@ -113,13 +113,6 @@ type ConfigStopBefore interface {
|
|||
StopBefore() StopBefore
|
||||
}
|
||||
|
||||
type Stage int
|
||||
|
||||
const (
|
||||
StagePrimary Stage = iota
|
||||
StageMain
|
||||
)
|
||||
|
||||
type PrimaryBuilderInvocation struct {
|
||||
Inputs []string
|
||||
Outputs []string
|
||||
|
@ -127,10 +120,7 @@ type PrimaryBuilderInvocation struct {
|
|||
}
|
||||
|
||||
type Config struct {
|
||||
stage Stage
|
||||
|
||||
topLevelBlueprintsFile string
|
||||
subninjas []string
|
||||
subninjas []string
|
||||
|
||||
runGoTests bool
|
||||
useValidations bool
|
||||
|
|
Loading…
Reference in a new issue