As part of the build team's effort to cleanup envseup.sh.
Remove the run_tool_with_logging rundtion from envsetup.sh and add it
as a standalone script under build/soong/bin
Test: atest run_tool_with_logging
Test: manually do source envsetup.sh and run adb devices -l and check
the event log is sent to clearcut, tested with both bash and zsh
Bug: 342066042
Change-Id: I9c23a1b0a4b5790fb32f5e84fd7421ee6b36bdb0
Fix the case when call a tool with run_tool_with_logging with a single
arg start with -- (e.g. adb --help), make sure when we pass that arg
to the logger, it treat it as the value for the --tool_args option
instead of a separate option
Test: atest run_tool_with_logging_test
Test: manually run source build/envsetup.sh and run adb --help and check
the event log is sent to clearcut. Tested with both bash and zsh
Bug: 341382247
Change-Id: I1e09907f267b453cb62876e171064daa021e3d91
Reduce the number of variables required to toggle logging. This simplifies configuration and usage.
Test: atest run_tool_with_logging_test
Bug: 331638854
Change-Id: I6f2a820b59a0d1f45aba9ffb3e33e7ace601e9c6
Add a test to verify that the parameters passed from the
envsetup.sh function are compatible with the actual tool
event logger implementation.
Note that this change adds support for extra logger arguments.
This enables calling the real logger binary with a 'dry run'
flag to avoid actual logging during test execution.
Test: atest rul_tool_with_logging_test
Bug: 331638854
Change-Id: I6b280c53baae03477d4f52f0084efb1f500bd5d0
This behavior of "stealing" values from parent makefiles is needed to
match make. We already had similar behavior for list variables via
the __move_items function, but were missing it for single value
variables.
Test: ./out/rbcrun -mode rbc ./build/make/tests/run.rbc
Change-Id: Ib320b9b1cce0224184f585c7a391be1b5353b440
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