Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8dc8b0a0 authored by Usta Shrestha's avatar Usta Shrestha
Browse files

SOONG_NINJA_ARGS to pass ninja args to soong_ui

Cf soong_build, allow soong_ui to support additional
ninja arguments

Test: NINJA_ARGS='-d explain' nothing
Bug: N/A
Change-Id: I42827fb817bed432251e9b0b94b15a4f6f78cb03
parent 88b3ba2a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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...)