Merge "Switch product configs from make to ckati"

This commit is contained in:
Dan Willemsen 2017-10-13 23:22:00 +00:00 committed by Gerrit Code Review
commit 37cba1471f
7 changed files with 24 additions and 25 deletions

View file

@ -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)
}

View file

@ -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",

View file

@ -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()

View file

@ -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)
}

View file

@ -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") {

View file

@ -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

View file

@ -19,7 +19,7 @@ type Sandbox bool
const (
noSandbox = false
globalSandbox = false
makeSandbox = false
dumpvarsSandbox = false
soongSandbox = false
katiSandbox = false
katiCleanSpecSandbox = false