Parse environment options from the command line
Make supports specifying all types of variables on the command line
(using =, :=, +=, and other variable references. When running soong_ui
through make/makeparallel these all effectively become environment
variables.
So in preparation to remove the Make wrapper, support a simplified form
of this syntax, roughly equivalent to what the shell supports if
specified before the command (<NAME>=<VALUE>).
Test: m -j blueprint_tools
Change-Id: I08fa2b86710f282e619b0cc324a3e5bbaf62d26e
diff --git a/ui/build/config.go b/ui/build/config.go
index 925b153..a451cfe 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -176,6 +176,8 @@
} else {
ctx.Fatalln("Unknown option:", arg)
}
+ } else if k, v, ok := decodeKeyValue(arg); ok && len(k) > 0 {
+ c.environ.Set(k, v)
} else {
c.arguments = append(c.arguments, arg)
}