platform_build_soong/mk2rbc
Cole Faust 71514c07d2 Remove variableDefinedExpr
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
2022-01-28 19:47:34 +00:00
..
cmd Support passing input variables to the product configuration 2021-12-02 16:19:19 -08:00
test Share version settings with product config makefile. 2021-09-13 09:23:05 -07:00
Android.bp Support passing input variables to the product configuration 2021-12-02 16:19:19 -08:00
android_products.go AndroidProducts.mk file reader 2021-07-12 09:40:18 -07:00
android_products_test.go AndroidProducts.mk file reader 2021-07-12 09:40:18 -07:00
config_variables.go Config variables reader 2021-07-12 09:40:18 -07:00
config_variables_test.go Config variables reader 2021-07-12 09:40:18 -07:00
expr.go Remove variableDefinedExpr 2022-01-28 19:47:34 +00:00
find_mockfs.go Allow dynamically calculated inherit-product path 2021-08-02 14:35:45 -07:00
mk2rbc.go Remove variableDefinedExpr 2022-01-28 19:47:34 +00:00
mk2rbc_test.go Remove variableDefinedExpr 2022-01-28 19:47:34 +00:00
node.go Check missing uncoditionally loaded missing modules at runtime 2022-01-10 19:58:14 -08:00
soong_variables.go Soong variables reader 2021-07-12 09:40:18 -07:00
soong_variables_test.go Soong variables reader 2021-07-12 09:40:18 -07:00
TODO Product config makefiles to Starlark converter 2021-07-14 09:51:10 -07:00
types.go Make a pass over our codebase cleaning up non-precise / non-inclusive language. 2021-10-28 10:32:07 -07:00
variable.go Fix "unknown binary op: string + list" errors 2021-12-22 14:08:08 -08:00