summaryrefslogtreecommitdiff
path: root/mk2rbc/variable.go
AgeCommit message (Collapse)Author
2023-10-09Remove ?= assignements to product variables Cole Faust
In make, all product variables are assigned to an empty string before including the product config makefiles. In starlark, we don't do that just so the memory usage is smaller. This means that in make, using ?= to assign a product config variable has no effect. Replicate this behavior in starlark by not emitting any code for ?= assignments of product variables. Fixes: 304324003 Test: go test Change-Id: Id31531506ac9e372a1bea92ce9ae8e17ae0ca70c
2022-04-07Move variable assignment handling to generation context Cole Faust
This allows the parsing code to be cleaner, as it doesn't have to care about variable assignments. Bug: 228518745 Test: go test Change-Id: I33425c2fb51acab4901bfa82a53d337b75210f8e
2022-03-18Replace $(call my-dir) with a string literal Cole Faust
This is so that we can set LOCAL_PATH to the result of my-dir, as LOCAL_PATH can only be set to a string literal of the exact value of LOCAL_PATH. It's probably also the correct choice to start phasing out LOCAL_PATH. Bug: 214405650 Test: go test Change-Id: Ia97d7fedf4ce62643921d90a176e65edd4e2fce6
2022-03-16Merge "Add type hints to mk2rbc" Treehugger Robot
2022-03-15Add type hints to mk2rbc Cole Faust
Type hints have the format #RBC# type_hint MY_VAR list and must be specified at the top of the Makefile. Setting one will cause that variable to have that type for the remainder of the Makefile. This can be used where mk2rbc's type inference detects the wrong type and it must be manually changed. Bug: 224601891 Test: go test Change-Id: I6db2c50056d0298227e1d2801a522adf8bbd1df8
2022-03-10Simplify and correct variable assignments Cole Faust
- Remove asgnMaybeAppend, it was only used to indicate that the asignment needs a setDefault. But really, all types of variable assignments need setDefault if they're self-referential. - Remove local_append/local_set_default because there was no implementation for them written in product_config.rbc anyways. - Correct productConfigVariable.emitDefined using the global variables instead of the product config variables. - Emit setDefaults for all types of assignments if they're self referential. Bug: 222737841 Test: go test Change-Id: I06a0f90f16d5900049d473281e6d5ef5e93e67da
2022-03-08Merge "Call rblf.setDefault() when appending to a variable without +=" Cole Faust
2022-03-08Call rblf.setDefault() when appending to a variable without += Cole Faust
Bug: 222737841 Test: go test Change-Id: I10e9e994fb1979e2e06ad30bbe66a21657d1e3db
2022-03-07Support variables with dashes in their names Cole Faust
Bug: 221946551 Test: go test Change-Id: I085fc35159c4f3afe53868fbc731fcaeac3a69a8
2021-12-22Fix "unknown binary op: string + list" errors Cole Faust
Convert lists to strings when adding them to a string. Bug: 201700692 Test: go test Change-Id: Iefb68f48191136e7115a6d6bfa0608c73d5afdac
2021-11-18Generate runtime conversion diagnostics Sasha Smundak
Instead of inserting a comment with error description into the generated code, generate a call to a function that will print out a conversion error when executed. Do not print generic "partially converted" message anymore. Remove --verbose and --no_warnings options. Bug: 204062171 Test: internal Change-Id: Ib126e16dc76f49635e4939e670922f2561781049
2021-11-05Handle ifdef for local variables. Sasha Smundak
Fixes: 205337522 Test: internal Change-Id: Ib29654e76e8dc7c0982bfe0b471a1aca33935117
2021-09-02Additional heuristics: variables with names ending with _LIST are lists Sasha Smundak
Bug: 193540681 Test: internal Change-Id: Ic23bf0f0eadb159285650f0b7e20307788c12387
2021-08-02Allow dynamically calculated inherit-product path Sasha Smundak
Bug: 193566316 Test: internal Change-Id: Iaa7b68cf459f9a694ae9d37a32c9372cf8a8335a
2021-07-26Emit mksubst call for $(subst ...) Sasha Smundak
Bug: 172923994 Test: internal Change-Id: I7994bee61f6f8bdee6eac50ecb8a6064830447a4
2021-07-14Product config makefiles to Starlark converter Sasha Smundak
Test: treehugger; internal tests in mk2rbc_test.go Bug: 172923994 Change-Id: I43120b9c181ef2b8d9453e743233811b0fec268b