Add a function to log the invocation of tools run from the Android
build environment. This enables analyzing and optimizing developer
flows.
Note that there are no tools currently leveraging the logging
facility. Logging is also disabled by default and not configured to
use any particular logger.
Test: atest run_tool_with_logging_test
bug: 331638854
Change-Id: I001ba3c6c30b3ffc95d0fdb30ea7178a991c680f
Because we've introduced bugs before where b doesn't exit with the
correct status code when bazel fails.
Bug: 289436072
Test: ./build/make/tests/b_tests.sh
Change-Id: Ia9cb990c627f7b68636e6277a7c637d62312826d
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
Using -- to indicate the end of arguments has caused issues multiple
times in the past.
Test: ./build/make/tests/roboleaf_tests.sh
Change-Id: I4aef2f1672b917587dd9a2dbe15934db0b0ae0cd
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
We recently had an issue where the bazel server
couldn't be shutdown/restart because it was being
run in a docker container with a PID 1 that wasn't
capable of reaping zombie processes.
Bug: 234449134
Test: abtd run of this test because it's not run on presubmit
Change-Id: I1e179902364ea84fd55003389f3045de2e998991
lunch is required to set up PATH to access build/bazel/bin/b as b.
Test: run the test
Bug: 255711288
Fixes: 255711288
Change-Id: Ie5bad8ffdacc3d59114f70d7f533486ebd12f778
This benefits interactive workflows of folks who are used to typing just
module names on the command line, and lowers the cognitive load to find
the package name, and can be used to check if a module is converted.
Can be used as :
$ bmod libaapt2
//frameworks/base/tools/aapt2:libaapt2
$ b build $(bmod aapt2)
If the mod is not in the bp2build metrics file, it returns:
$ bmod nonexistent
nonexistent is not converted to Bazel.
Test: build/make/core/tests/b_tests.sh
Change-Id: I245665a393621a47598e6743c0fedcd87ac33631
zsh command was not found on the build server. Remove it from this test.
Bug: 249559295
Test: build/make/tests/roboleaf_tests.sh
Change-Id: I7a79b183d9fd40829ab03bc54ce899efaa974a60
Zsh has some incompatibilties that we've been trying to work around in
the b command. Hopefully this prevents future issues.
Bug: 242759256
Test: build/make/tests/roboleaf_tests.sh
Change-Id: I5e887932e943112377d38e77a77a0f294b43d9b6
When I enabled the envsetup_tests target on CI, this script was failing.
Rather than break the build again by enabling CI on a potentially
failing script, let's just disable this for now, enable the CI target,
and then this script can be enabled and tested in presubmits before
submitting.
Bug: 244771601
Test: build/make/tests/roboleaf_tests.sh
Change-Id: I7c3469b49258e37c0ff9b49dd8805031216a7570
Ensuring that the b command works properly cross-terminal has been a
little tricky, so some test commands would help in testing changes.
Test: build/make/tests/roboleaf_tests.sh
Change-Id: Iecff678fbba6e81c211aadd3665839c1c21acc8c
This is in preparation to add some more tests to this file.
Test: build/make/tests/envsetup_tests.sh
Change-Id: Ic32115d2a6073f3265b84846f489f3acb8bfad88
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
List variables needed to be percolated in the order of inherit() calls.
children.keys() was in that order, due to starlark dictionaries being
iterable in the order of insertion, but the previous cl broke that
behavior by sorting them. Instead, only sort the children for
single value variables.
Fixes: 226206409
Fixes: 228044099
Test: ./out/rbcrun ./build/make/tests/run.rbc and testing aosp_arm64
Change-Id: I5b91514e87b158b615e4d4ec7868fccb0248379b
This reverts commit 670c587c09.
Reason for revert: Breaks RBC product config for more products than it fixes: b/228044099
Change-Id: I614663311f67b3631a0cee427453c550fc426c8b
The children to inherit from were not sorted. This
wasn't a problem for list variables, because all those
inheritances get merged together based on the @inherit/
values in the list variables. But for single value variables
it made a difference.
Bug: 226206409
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: Ib56bbb91a79fe8c7cb780c253f5bd8d6c0e87765
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