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")) 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 { if err != nil {
log.Fatal(err) log.Fatal(err)
} }

View file

@ -27,11 +27,11 @@ bootstrap_go_package {
"cleanbuild.go", "cleanbuild.go",
"config.go", "config.go",
"context.go", "context.go",
"dumpvars.go",
"environment.go", "environment.go",
"exec.go", "exec.go",
"finder.go", "finder.go",
"kati.go", "kati.go",
"make.go",
"ninja.go", "ninja.go",
"proc_sync.go", "proc_sync.go",
"signal.go", "signal.go",

View file

@ -104,7 +104,7 @@ func checkCaseSensitivity(ctx Context, config Config) {
func help(ctx Context, config Config, what int) { func help(ctx Context, config Config, what int) {
cmd := Command(ctx, config, "help.sh", "build/make/help.sh") cmd := Command(ctx, config, "help.sh", "build/make/help.sh")
cmd.Sandbox = makeSandbox cmd.Sandbox = dumpvarsSandbox
cmd.Stdout = ctx.Stdout() cmd.Stdout = ctx.Stdout()
cmd.Stderr = ctx.Stderr() cmd.Stderr = ctx.Stderr()
cmd.RunOrFatal() cmd.RunOrFatal()

View file

@ -16,7 +16,6 @@ package build
import ( import (
"fmt" "fmt"
"path/filepath"
"strings" "strings"
) )
@ -28,27 +27,29 @@ import (
// Make without actually building them. So all the variables based on // Make without actually building them. So all the variables based on
// MAKECMDGOALS can be read. // 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 // vars is the list of variables to read. The values will be put in the
// returned map. // 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") ctx.BeginTrace("dumpvars")
defer ctx.EndTrace() defer ctx.EndTrace()
cmd := Command(ctx, config, "make", cmd := Command(ctx, config, "dumpvars",
"make", config.PrebuiltBuildTool("ckati"),
"--no-print-directory", "-f", "build/make/core/config.mk",
"-f", "build/core/config.mk", "--color_warnings",
"dump-many-vars", "dump-many-vars",
"CALLED_FROM_SETUP=true", "MAKECMDGOALS="+strings.Join(goals, " "))
"BUILD_SYSTEM=build/core", cmd.Environment.Set("CALLED_FROM_SETUP", "true")
"MAKECMDGOALS="+strings.Join(goals, " "), cmd.Environment.Set("BUILD_SYSTEM", "build/make/core")
"DUMP_MANY_VARS="+strings.Join(vars, " "), if write_soong_vars {
"OUT_DIR="+config.OutDir()) cmd.Environment.Set("WRITE_SOONG_VARIABLES", "true")
cmd.Args = append(cmd.Args, extra_targets...) }
cmd.Sandbox = makeSandbox cmd.Environment.Set("DUMP_MANY_VARS", strings.Join(vars, " "))
cmd.Sandbox = dumpvarsSandbox
// TODO: error out when Stderr contains any content // TODO: error out when Stderr contains any content
cmd.Stderr = ctx.Stderr() cmd.Stderr = ctx.Stderr()
output, err := cmd.Output() output, err := cmd.Output()
@ -136,9 +137,7 @@ func runMakeProductConfig(ctx Context, config Config) {
"TARGET_DEVICE", "TARGET_DEVICE",
}, exportEnvVars...), bannerVars...) }, exportEnvVars...), bannerVars...)
make_vars, err := DumpMakeVars(ctx, config, config.Arguments(), []string{ make_vars, err := dumpMakeVars(ctx, config, config.Arguments(), allVars, true)
filepath.Join(config.SoongOutDir(), "soong.variables"),
}, allVars)
if err != nil { if err != nil {
ctx.Fatalln("Error dumping make vars:", err) ctx.Fatalln("Error dumping make vars:", err)
} }

View file

@ -77,7 +77,7 @@ func runKati(ctx Context, config Config) {
"--color_warnings", "--color_warnings",
"--gen_all_targets", "--gen_all_targets",
"--werror_find_emulator", "--werror_find_emulator",
"-f", "build/core/main.mk", "-f", "build/make/core/main.mk",
} }
if !config.Environment().IsFalse("KATI_EMULATE_FIND") { if !config.Environment().IsFalse("KATI_EMULATE_FIND") {

View file

@ -24,7 +24,7 @@ type Sandbox string
const ( const (
noSandbox = "" noSandbox = ""
globalSandbox = "build/soong/ui/build/sandbox/darwin/global.sb" globalSandbox = "build/soong/ui/build/sandbox/darwin/global.sb"
makeSandbox = globalSandbox dumpvarsSandbox = globalSandbox
soongSandbox = globalSandbox soongSandbox = globalSandbox
katiSandbox = globalSandbox katiSandbox = globalSandbox
katiCleanSpecSandbox = globalSandbox katiCleanSpecSandbox = globalSandbox

View file

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