Allow DIST_DIR to be read via dumpvars
DIST_DIR is controlled by soong_ui, and the make dumpvars code no longer has access to it. So instead, handle some dumpvar requests inside soong_ui itself. Test: get_build_var DIST_DIR Test: get_build_var OUT_DIR Test: get_build_var BUILD_SYSTEM Test: build/soong/soong_ui.bash --dumpvars-mode --vars="DIST_DIR BUILD_SYSTEM" Change-Id: Id3bcb8b0748db67c83d0e42d1ae5be564c5eb2f7
This commit is contained in:
parent
2d31a44b8a
commit
6f03752422
|
@ -32,8 +32,40 @@ import (
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
|
//
|
||||||
|
// variables controlled by soong_ui directly are now returned without needing
|
||||||
|
// to call into make, to retain compatibility.
|
||||||
func DumpMakeVars(ctx Context, config Config, goals, 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)
|
soongUiVars := map[string]func() string{
|
||||||
|
"OUT_DIR": func() string { return config.OutDir() },
|
||||||
|
"DIST_DIR": func() string { return config.DistDir() },
|
||||||
|
}
|
||||||
|
|
||||||
|
makeVars := make([]string, 0, len(vars))
|
||||||
|
for _, v := range vars {
|
||||||
|
if _, ok := soongUiVars[v]; !ok {
|
||||||
|
makeVars = append(makeVars, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var ret map[string]string
|
||||||
|
if len(makeVars) > 0 {
|
||||||
|
var err error
|
||||||
|
ret, err = dumpMakeVars(ctx, config, goals, makeVars, false)
|
||||||
|
if err != nil {
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = make(map[string]string)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range vars {
|
||||||
|
if f, ok := soongUiVars[v]; ok {
|
||||||
|
ret[v] = f()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func dumpMakeVars(ctx Context, config Config, goals, vars []string, write_soong_vars bool) (map[string]string, error) {
|
func dumpMakeVars(ctx Context, config Config, goals, vars []string, write_soong_vars bool) (map[string]string, error) {
|
||||||
|
|
Loading…
Reference in New Issue