In make, soong_config_set uses an $(eval) to set it's value, expanding
the value of the soong config variable _before_ evaluating the value.
Because of this, make will strip trailing whitespace like it does on
regular assignments.
Make rbcrun match this behavior.
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: I907e85cdf50f6fac54331c0d1044f0d53bec22ed
words() attempts to join all the elements of a list
and then resplit them to more closely match make.
But sometimes, like when calling words() on a product
variable, not all of the elements are strings. In
that case, just return the list unchanged.
Bug: 267407943
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: I738d0c86c8935f446807cc79623f796e8cae3c01
Inherit references (@inherit in make, 1-tuples in starlark)
usually appear in list product variables, where they're
evaluated before printing. But sometimes they can be copied
into a regular global variable, in which case they won't
be evaluated before printing. The 1-tuples were failing to
print, so adapt them to their make representation before
printing.
Fixes: 264554449
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: I5ac6eb996c25ee5e77aa26ed5c4b6b6cc31819d1
Make's clear-var-list causes the variables to exist as empty strings.
Mimic that functionality in starlark for the variable diff and ?=.
Bug: 262303006
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: I5f9c8cf342d875b1022c5c74906e59fa68fcd6c9
realpath doesn't return a path if the file doesn't exist,
but $(abspath) in make does.
Bug: 229132189
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: Ief7f634024cc52a9e8c5e478666b15512512f0d8
We pass the filename without the extension to
rblf.inherit(). Removing the extension changes the
sort order when one file's name is a prefix of another:
```
>>> sorted(["base", "base-secondary"])
['base', 'base-secondary']
>>> sorted(["base.mk", "base-secondary.mk"])
['base-secondary.mk', 'base.mk']
```
Correct the sort order so that global variables get
their correct ordering.
Bug: 229132189
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: I22367eb49b33956b71ac1b966fe78c1308b94257
When an intermediate product is evaluated, it needs to
act as if it's the only product being evaulated. However,
currently, if it inherited a makefile that was also being
inherited by the overall top level product via a different
path, it would not get the values from that makefile.
Copy the configs dictionary before evaluating each product
that needs artifact path requirements, and create seperate
postfix orders for all of them that don't contain any products
that they don't inherit from.
Bug: 221312707
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: I235ad78d587a2e315ba446b5e126d8f6d0fbbea7
As a first step to making .rbc files compatible with bazel,
remove regex support since bazel doesn't have it.
Fixes: 227384703
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: I8b946c20cc42897a47a5516a167732f4e16b6158
Single-value product variables resolve to the first
instance of that variable in prefix order. What we
have right now is taking the value from the current
makefile if it's set, but if it's not, we take it
from the last child, not the first.
Fixes: 226206409
Test: Manually
Change-Id: Id23f7c269ff9a352bf0b67cb57156b72449f978e
Passing variables via a makefile instead of
rblf_cli / rblf_env allows us to give them correct
types while converting the makefile to starlark,
as opposed to the variables always being strings
when given via rblf_cli / rblf_env.
This also allows us to remove some hand-converted
starlark code.
Bug: 201700692
Test: ./out/soong/rbcrun ./build/make/tests/run.rbc
Change-Id: I58c4f20b29171c14e5ae759beb26a849426f6961
dict(**h[0]) was only copying the top level dictionary
object, but not any other dictionaries/lists inside of
it. This was causing us to not find all the changes to
variables the board configuration was making, and so
some variables were not included in the output.
Bug: 201700692
Test: ./build/bazel/ci/rbc_regression_test.sh mainline_system_x86_64-userdebug
Test: ./out/soong/rbcrun ./build/make/tests/run.rbc
Change-Id: I4467eead7e597f6f49119a8c4832126f39d646e7
mk2rbc would already translate notdir calls,
but since there was no implementation it would
fail at runtime.
Bug: 201700692
Test: m rbcrun; rbcrun build/make/tests/run.rbc
Change-Id: Ie0f4e7b65448e612fa56f87b0bc138648cc0ad58
Having a function to get soong config variables
makes it easier to convert to starlark.
Bug: 201700692
Test: m RBC_PRODUCT_CONFIG=1 RBC_BOARD_CONFIG=1 nothing and check output files
Change-Id: I8627555df10d3f66f6154c00be9f0565076f1f94
Includes:
* Defining namespace again should have no effect
* Allow appending to a variable defined in a namespace
* Consistent naming
* Print namespace variable assignments even if they are empty
Bug: 200297238
Test: rbcrun make/build/tests/run.rbc
Change-Id: I64aa22c4498ae89e4bc3a077d6206ad37d5c7c38
Starlark-based product configuration can now share version settings
with makefile product config (mk2rbc converts version_defaults.mk into
version_defaults.rbc which is consumed by runtime initialization).
Bug: 198995713
Test: rbcrun build/make/tests/run.rbc
Change-Id: I1d3ddfed3b15d346b3e10714a195a9f0a3a55a56
Also, fix __mk2regex bug: the returned pattern should end with $.
Bug: 193540681
Test: internal
Change-Id: Ia56856826c6b05ccf857ae5ab7a70609bf4f1e1d
Change-Id: Ie2a9bf62ee48824ce7cd5fe9e9ec2f55311473e3
It has to copy all the files into the same directory, stripping the
relative path from the source file.
Bug: 193540681
Test: rbcrun build/make/tests/run.rbc
Change-Id: I2d61d966ad94d73131c7ad6016ce319f8d2ae509
The macro find-and-copy finds all the files in the given source tree that
match the given filename patten and create <source>:<dest> pair with the
same relative path in the destination tree.
Bug: 193540681
Test: rbcrun build/make/tests/run.rbc
Change-Id: Ic4315ce2fab7a7791ab55dd9eed039205a1c721a