71514c07d2
VariableDefinedExpr was under-developed, and would not take into account if a variable was from the globals or product config dictionary. It also always emitted `g.get("VARIABLE") != None`, which is not correct behavior. In this example makefile: ``` MY_VAR := ifdef MY_VAR $(info MY_VAR is defined) else $(info MY_VAR is not defined) endif ifdef MY_UNDEFINED_VAR $(info MY_UNDEFINED_VAR is defined) else $(info MY_UNDEFINED_VAR is not defined) endif MY_VAR ?= true MY_UNDEFINED_VAR ?= true $(info MY_VAR after ?= is $(MY_VAR)) $(info MY_UNDEFINED_VAR after ?= is $(MY_UNDEFINED_VAR)) .PHONY: all all: @: ``` We get the output: MY_VAR is not defined MY_UNDEFINED_VAR is not defined MY_VAR after ?= is MY_UNDEFINED_VAR after ?= is true So we can see that even if a variable was set, it's considered not defined if it was set to an empty value. However, ?= works differently, and does require the != None, so that was left as is. Just use a variableRefExpr and rely on the fact that variables will be truthy if they're defined. Fixes: 216700361 Test: go test Change-Id: If8944da2579e8658e3fc4f666b1f3b2815f8c8b1 |
||
---|---|---|
.. | ||
cmd | ||
test | ||
Android.bp | ||
android_products.go | ||
android_products_test.go | ||
config_variables.go | ||
config_variables_test.go | ||
expr.go | ||
find_mockfs.go | ||
mk2rbc.go | ||
mk2rbc_test.go | ||
node.go | ||
soong_variables.go | ||
soong_variables_test.go | ||
TODO | ||
types.go | ||
variable.go |