Merge "SOONG_NINJA_ARGS to pass ninja args to soong_ui"

This commit is contained in:
Usta Shrestha 2022-08-20 00:42:48 +00:00 committed by Gerrit Code Review
commit 96f2534761

View file

@ -22,6 +22,7 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"android/soong/ui/metrics"
soong_metrics_proto "android/soong/ui/metrics/metrics_proto"
@ -445,6 +446,11 @@ func runSoong(ctx Context, config Config) {
"-f", filepath.Join(config.SoongOutDir(), ninjaFile),
}
if extra, ok := config.Environment().Get("SOONG_UI_NINJA_ARGS"); ok {
ctx.Printf(`CAUTION: arguments in $SOONG_UI_NINJA_ARGS=%q, e.g. "-n", can make soong_build FAIL or INCORRECT`, extra)
ninjaArgs = append(ninjaArgs, strings.Fields(extra)...)
}
ninjaArgs = append(ninjaArgs, targets...)
cmd := Command(ctx, config, "soong "+name,
config.PrebuiltBuildTool("ninja"), ninjaArgs...)