Switch product configs from make to ckati
This speeds up dumping make variables from ~380ms using make to ~220ms using ckati. It also means that we're consistently using the same parser for builds (with the same .KATI_READONLY/etc extensions). envsetup.sh (lunch) / other scripts still use make, changing those to go through soong_ui will be a future change. Test: m clean; m nothing Test: USE_GOMA=true m nothing Test: m PRODUCT-aosp_x86-sdk Test: m APP-Calculator Test: build/soong/build_test.bash -only-config (on AOSP and internal master) Change-Id: I6ca554de8de4955fb869001d06d29969b75751cc
This commit is contained in:
parent
432a2d4033
commit
b2e6c2e571
|
@ -223,7 +223,7 @@ func main() {
|
|||
trace.SetOutput(filepath.Join(config.OutDir(), "build.trace"))
|
||||
}
|
||||
|
||||
vars, err := build.DumpMakeVars(buildCtx, config, nil, nil, []string{"all_named_products"})
|
||||
vars, err := build.DumpMakeVars(buildCtx, config, nil, []string{"all_named_products"})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ bootstrap_go_package {
|
|||
"cleanbuild.go",
|
||||
"config.go",
|
||||
"context.go",
|
||||
"dumpvars.go",
|
||||
"environment.go",
|
||||
"exec.go",
|
||||
"finder.go",
|
||||
"kati.go",
|
||||
"make.go",
|
||||
"ninja.go",
|
||||
"proc_sync.go",
|
||||
"signal.go",
|
||||
|
|
|
@ -104,7 +104,7 @@ func checkCaseSensitivity(ctx Context, config Config) {
|
|||
|
||||
func help(ctx Context, config Config, what int) {
|
||||
cmd := Command(ctx, config, "help.sh", "build/make/help.sh")
|
||||
cmd.Sandbox = makeSandbox
|
||||
cmd.Sandbox = dumpvarsSandbox
|
||||
cmd.Stdout = ctx.Stdout()
|
||||
cmd.Stderr = ctx.Stderr()
|
||||
cmd.RunOrFatal()
|
||||
|
|
|
@ -16,7 +16,6 @@ package build
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -28,27 +27,29 @@ import (
|
|||
// Make without actually building them. So all the variables based on
|
||||
// MAKECMDGOALS can be read.
|
||||
//
|
||||
// extra_targets adds real arguments to the make command, in case other targets
|
||||
// actually need to be run (like the Soong config generator).
|
||||
//
|
||||
// vars is the list of variables to read. The values will be put in the
|
||||
// returned map.
|
||||
func DumpMakeVars(ctx Context, config Config, goals, extra_targets, vars []string) (map[string]string, error) {
|
||||
func DumpMakeVars(ctx Context, config Config, goals, vars []string) (map[string]string, error) {
|
||||
return dumpMakeVars(ctx, config, goals, vars, false)
|
||||
}
|
||||
|
||||
func dumpMakeVars(ctx Context, config Config, goals, vars []string, write_soong_vars bool) (map[string]string, error) {
|
||||
ctx.BeginTrace("dumpvars")
|
||||
defer ctx.EndTrace()
|
||||
|
||||
cmd := Command(ctx, config, "make",
|
||||
"make",
|
||||
"--no-print-directory",
|
||||
"-f", "build/core/config.mk",
|
||||
cmd := Command(ctx, config, "dumpvars",
|
||||
config.PrebuiltBuildTool("ckati"),
|
||||
"-f", "build/make/core/config.mk",
|
||||
"--color_warnings",
|
||||
"dump-many-vars",
|
||||
"CALLED_FROM_SETUP=true",
|
||||
"BUILD_SYSTEM=build/core",
|
||||
"MAKECMDGOALS="+strings.Join(goals, " "),
|
||||
"DUMP_MANY_VARS="+strings.Join(vars, " "),
|
||||
"OUT_DIR="+config.OutDir())
|
||||
cmd.Args = append(cmd.Args, extra_targets...)
|
||||
cmd.Sandbox = makeSandbox
|
||||
"MAKECMDGOALS="+strings.Join(goals, " "))
|
||||
cmd.Environment.Set("CALLED_FROM_SETUP", "true")
|
||||
cmd.Environment.Set("BUILD_SYSTEM", "build/make/core")
|
||||
if write_soong_vars {
|
||||
cmd.Environment.Set("WRITE_SOONG_VARIABLES", "true")
|
||||
}
|
||||
cmd.Environment.Set("DUMP_MANY_VARS", strings.Join(vars, " "))
|
||||
cmd.Sandbox = dumpvarsSandbox
|
||||
// TODO: error out when Stderr contains any content
|
||||
cmd.Stderr = ctx.Stderr()
|
||||
output, err := cmd.Output()
|
||||
|
@ -136,9 +137,7 @@ func runMakeProductConfig(ctx Context, config Config) {
|
|||
"TARGET_DEVICE",
|
||||
}, exportEnvVars...), bannerVars...)
|
||||
|
||||
make_vars, err := DumpMakeVars(ctx, config, config.Arguments(), []string{
|
||||
filepath.Join(config.SoongOutDir(), "soong.variables"),
|
||||
}, allVars)
|
||||
make_vars, err := dumpMakeVars(ctx, config, config.Arguments(), allVars, true)
|
||||
if err != nil {
|
||||
ctx.Fatalln("Error dumping make vars:", err)
|
||||
}
|
|
@ -77,7 +77,7 @@ func runKati(ctx Context, config Config) {
|
|||
"--color_warnings",
|
||||
"--gen_all_targets",
|
||||
"--werror_find_emulator",
|
||||
"-f", "build/core/main.mk",
|
||||
"-f", "build/make/core/main.mk",
|
||||
}
|
||||
|
||||
if !config.Environment().IsFalse("KATI_EMULATE_FIND") {
|
||||
|
|
|
@ -24,7 +24,7 @@ type Sandbox string
|
|||
const (
|
||||
noSandbox = ""
|
||||
globalSandbox = "build/soong/ui/build/sandbox/darwin/global.sb"
|
||||
makeSandbox = globalSandbox
|
||||
dumpvarsSandbox = globalSandbox
|
||||
soongSandbox = globalSandbox
|
||||
katiSandbox = globalSandbox
|
||||
katiCleanSpecSandbox = globalSandbox
|
||||
|
|
|
@ -19,7 +19,7 @@ type Sandbox bool
|
|||
const (
|
||||
noSandbox = false
|
||||
globalSandbox = false
|
||||
makeSandbox = false
|
||||
dumpvarsSandbox = false
|
||||
soongSandbox = false
|
||||
katiSandbox = false
|
||||
katiCleanSpecSandbox = false
|
||||
|
|
Loading…
Reference in New Issue