Commit graph

648 commits

Author SHA1 Message Date
Cole Faust
5d825b7a68 Speed up m command autocompletion
Generate a all_modules.txt file on every build that
can be used for autocompleting.

Because this adds time to every non-incremental build,
I profiled it by using `$(shell date +"%s.%3N")` before
and after, and disovered it only adds about 0.01 seconds
to the build. And of course it won't be rerun if there
weren't build changes.

Bug: 255867758
Test: Manually
Change-Id: I1d3f1008611fd542884322b27b19ea2fa1d341fe
2022-10-28 10:44:02 -07:00
Jingwen Chen
acdcaa06dc Make bmod compatible with custom $OUT_DIR.
Bug: 251436403

Change-Id: I00fc4af05b0b2f5b4f859deaf04d9e586a5e3c59
2022-10-26 13:10:23 +00:00
Joe Onorato
5319beb76a Merge "Move b from a shell function to a shell script at build/bazel/bin/b" 2022-10-25 20:35:00 +00:00
Joe Onorato
5a9ecebbb4 Move bazel from being a shell function to being a script at build/bazel/bin/bazel
Bug: 254713799
Test: b build //packages/modules/adb/apex:com.android.adbd
Change-Id: Ia0d5b68b4d486383563b879b11f6255e2f56ba77
2022-10-24 06:36:02 -07:00
Joe Onorato
404fde5d70 Move b from a shell function to a shell script at build/bazel/bin/b
Bug: 244766775
Test: b build //packages/modules/adb/apex:com.android.adbd
Change-Id: I81b627965fcff636a142324e1eb221fd4c746e9d
2022-10-24 04:36:37 -07:00
LaMont Jones
5151ddc13f envsetup.sh: fix typo in multitree_lunch
Run lunch, not the orchestrator.

Change-Id: Ib0d81bddce4dea8b4daa51e3399d0adc4f9c8e64
2022-10-13 23:05:15 +00:00
Jingwen Chen
6fcd760988 Merge "envsetup: add bmod to get Bazel label of a Soong module." 2022-10-06 23:21:14 +00:00
Jingwen Chen
141d63dcd9 Disable USE_RBE with b builds (m bp2build).
RBE is not used with standalone builds, and it adds unnecessary
overhead.

Test: without this change, b info no-op takes 24s on my machine. with
this change, it drops to 9s.

Fixes: 251441524
Bug: 243596580
Change-Id: I564629064f51e2b2cad836915aacf6f72e84aaeb
2022-10-06 15:28:14 +00:00
Colin Cross
c0b0104bff Remove references to gcc from envsetup.sh
The target gcc toolchains have been removed from the tree, remove them
from the PATH set up by envsetup.sh.  Also remove GCC_COLORS, since
we always use clang.

Test: source envsetup.sh
Change-Id: I6020816a78d0f3e03ade13812313adb156864ab6
2022-10-05 12:03:03 -07:00
Jingwen Chen
83eeebb4df envsetup: add bmod to get Bazel label of a Soong module.
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
2022-10-05 04:11:22 +00:00
Sam Delmerico
f4a5240eb3 Merge changes I5e887932,I648960b3
* changes:
  re-enable b run commands in test suite
  re-enable b test suite
2022-09-28 19:09:24 +00:00
Sam Delmerico
d0c8cf02b6 re-enable b run commands in test suite
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
2022-09-28 09:52:22 -04:00
Spandan Das
ca76205afd Update paths to orchestrator scripts
Now that orchestrator code has moved into its own project, update the
paths in multitree envesetup

Test: multitree_lunch locally
Change-Id: Ic718b9fa169c68ac161ac3448b6e46635ec2ae10
2022-09-21 00:08:34 +00:00
Jingwen Chen
6f4963b99f Fix b with zsh (again), remove shwordsplit use.
Context: zsh doesn't do string splitting like bash, so it passes the
post-processed bazel args to bazel as a single arg. So this CL adds a
conditional to split explicitly with zsh using the {=<arg>} flag
syntax.

Reference: https://zsh.sourceforge.io/FAQ/zshfaq03.html (for shwordsplit)
Reference: https://zsh.sourceforge.io/Guide/zshguide05.html (Section 5.4.4)

For bash, this uses array[@] to split the list into separate
shell words.

Test: zsh; source build/envsetup.sh && b test
//system/logging/logd:logd-unit-tests --config=linux_x86_64
Test: bash; source build/envsetup.sh && b test
//system/logging/logd:logd-unit-tests --config=linux_x86_64

Change-Id: Id92462661bbe1799a6de8dd3393799d91e3044e8
2022-09-12 14:31:37 +00:00
Jingwen Chen
4ed082f61b Fix b with zsh.
zsh doesn't do string splitting like bash, so it passes the
post-processed bazel args to bazel as a single arg. So this CL adds a
conditional to do the splitting correctly for zsh with `setopt
shwordsplit`.

Reference: https://zsh.sourceforge.io/FAQ/zshfaq03.html

For bash, this uses array[@] to split the list into separate
shell words.

Test: zsh; source build/envsetup.sh && b test
//system/logging/logd:logd-unit-tests --config=linux_x86_64
Test: bash; source build/envsetup.sh && b test
//system/logging/logd:logd-unit-tests --config=linux_x86_64

Change-Id: I4e19a062b7f7e119b1612a8ce5c801878378cc69
2022-09-09 07:24:41 +00:00
Anton Hansson
90ac61c8b6 Make banchan support arm64only and x86_64only
Test: banchan arm64only
Test: banchan x86_64only
Change-Id: I1a787a4c5d80db18d7712d257e196dc19f3496b7
2022-09-06 16:26:10 +00:00
Treehugger Robot
522df8591f Merge "Add b autocomplete to envsetup" 2022-09-01 14:41:20 +00:00
Chris Parsons
a297297fdf Add b autocomplete to envsetup
Note that b autocompletion isn't perfect, given that the autocompletion
script looks into the workspace root for BUILD files, instead of
out/soong/workspace. (Also, out/soong/workspace may not even be
available if bp2build has not yet been run!) However, this is a good
start to autocompletion, as bazel commands, flags, and packages
autocomplete correctly.

Fixes: 196945896
Test: Treehugger
Test: Manual verification of `b` autocompletion
Change-Id: Ia99abcfe50d195c48644c7b3455243c03d5d38f7
2022-09-01 08:41:14 -04:00
Jingwen Chen
1ea787a0d0 Remove 'eval' from b to fix quoted arguments.
eval doesn't seem to be necessary and using it breaks quoted args to query.

    $ b cquery 'kind(test, //build/bazel/...)'
    -bash: eval: line 99: syntax error near unexpected token `('
    -bash: eval: line 99: ')`bazel cquery kind(test, //build/bazel/...)
    ---config=bp2build ''

Test: source and rerun b cquery with quoted args
Change-Id: I2b8c4387ab729b5f927fe5a629d3a4cd58bcf901
2022-09-01 05:59:02 +00:00
Jingwen Chen
28a22982cc Actually pass $skip_tests to _trigger_build in b
Change-Id: I66514175978f2fc224fcbd38b65d42e499593f28
Test: run b
2022-08-31 09:47:37 +00:00
Cole Faust
45844ab338 Add avbtool alias
As a replacement for the removal of the avbtool symlink

Bug: 198619163
Test: Manually running `avbtool`
Change-Id: I54d504a5132e5ac89337e67a07bca0a6f410c272
2022-08-30 13:59:07 -07:00
Sam Delmerico
e4c74c5eef skip soong tests by default for b command
It doesn't really make sense to incur the cost of running Soong tests to
Bazel users. We can shave off 20 seconds from the local critical path
during clean builds (or if Soong itself has changed) by enabling
--skip-soong-tests in the b command.

Test: b build '...'
Test: b build '...' --run-soong-tests
Bug: 240231596
Change-Id: I2325e1992099534b41ae996cee99e126a12f3c62
2022-08-30 10:30:19 -04:00
Sam Delmerico
e31d7de7b0 insert --config=bp2build before -- in b args
Bazel also supports `--foo bar` as another way to mean `--foo=bar`,
The current implementation would accidentally catch that and make it
`--foo --config=bp2build bar`. This CL instead requires that additional
arguments to the target come after a `--`.

E.g.
```
b run --args-for-bazel //foo -- --args-for-foo
```

Test: b build //build/bazel/scripts/difftool:difftool
Test: b run //build/bazel/scripts/difftool/difftool.py --level=FINE /tmp/legacyBuildFiles /tmp/bazelBuildFiles --file_type=object
Change-Id: I534caab04e4c919d4e7b6dc83b8a88e020626b18
2022-08-30 10:22:22 -04:00
Jingwen Chen
e7b2c97c6a Revert "skip soong tests by default for b command"
This reverts commit 56e576dc12.

Reason for revert: breaks `b cquery //foo:bar` - it strips out `//foo:bar`.

Change-Id: I92d8b1c2732efad3160d26ee78116eccc9f8e48a
2022-08-30 08:54:06 +00:00
Sam Delmerico
56e576dc12 skip soong tests by default for b command
It doesn't really make sense to incur the cost of running Soong tests to
Bazel users. We can shave off 20 seconds from the local critical path
during clean builds (or if Soong itself has changed) by enabling
--skip-soong-tests in the b command.

Test: b build '...'
Test: b build '...' --run-soong-tests
Bug: 240231596
Change-Id: I77d652502dc000908166e13045aa3e245c2e762c
2022-08-25 14:13:21 -04:00
Cole Faust
f376161d5a Merge "Move the --config flag in the b command earlier" 2022-08-24 00:31:52 +00:00
Frederick Mayle
e59a87946f envsetup.sh: partly fix syswrite
The grep doesn't work because "Reboot" is capitalized in the
enable-verity output. Now, syswrite gets farther, but fails before the
final remount.

    $ syswrite
    adbd is already running as root
    Successfully disabled verity
    Enabled overlayfs
    rebooting
    restarting adbd as root
    error: closed

Test: ran syswrite on freshly flashed device
Change-Id: I26aaa6278d76dcab56fd4bde3d70ac7841ae2a3b
2022-08-22 22:40:23 +00:00
Cole Faust
a68f5166fa Move the --config flag in the b command earlier
Having the --config flag at the end of a bazel command
will make it get passed to the command you're running
with b run instead of bazel.

Fixes: 242759256
Test: Manually
Change-Id: I6d23a0b022fdee5f822a873c1578674d1eab39c0
2022-08-18 19:41:43 -07:00
LaMont Jones
d2655af162 Merge "orchestrator: inner-tree path can be a list." am: ef1d2f06c6
Original change: https://android-review.googlesource.com/c/platform/build/+/2138856

Change-Id: I75c88dcbbac1caf69727a08c400679909aa7c968
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-04 17:05:53 +00:00
LaMont Jones
c39e502774 orchestrator: inner-tree path can be a list.
Shared trees are supported by specifying the inner-tree as a list in the
mcombo file.  This change enables that work.

Bug: None
Test: manual, unittests pass

Change-Id: I161d707d0aada66d134b49b158bf538f0e2a2572
2022-08-03 20:51:04 +00:00
Treehugger Robot
337805bef5 Merge "[Bugfix][Coredump] Fix coredump_enable() in envsetup.sh" am: f6aae1608d am: cbc5cc8500
Original change: https://android-review.googlesource.com/c/platform/build/+/2107828

Change-Id: I107ca4170c93c22120bb1bbd0db2c4703d83d60d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-02 22:33:55 +00:00
Treehugger Robot
cbc5cc8500 Merge "[Bugfix][Coredump] Fix coredump_enable() in envsetup.sh" am: f6aae1608d
Original change: https://android-review.googlesource.com/c/platform/build/+/2107828

Change-Id: Ic93e452300e3b919dcdcd92c165838bedb5d4e52
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-02 22:15:30 +00:00
Treehugger Robot
f6aae1608d Merge "[Bugfix][Coredump] Fix coredump_enable() in envsetup.sh" 2022-06-02 21:53:40 +00:00
Anton Hansson
ee35c25629 Merge "Change default arch for banchan to arm64" am: 3f65d6d834 am: 10129759b5
Original change: https://android-review.googlesource.com/c/platform/build/+/2105084

Change-Id: I5ae8d4e3bb2cacd79380e9dbd86e3f13d176d462
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-31 11:16:17 +00:00
Anton Hansson
10129759b5 Merge "Change default arch for banchan to arm64" am: 3f65d6d834
Original change: https://android-review.googlesource.com/c/platform/build/+/2105084

Change-Id: I71afcacff56545940e25a92ab26c9914c2bdf353
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-31 09:32:52 +00:00
Anton Hansson
3f65d6d834 Merge "Change default arch for banchan to arm64" 2022-05-31 09:12:24 +00:00
xi yu
addf4833b6 [Bugfix][Coredump] Fix coredump_enable() in envsetup.sh
-P means PID to affect (default $PPID), while -p means Pipe buffer (512 bytes), we should use -P here.

Bug: 234049197

Test: Perform ". build/envsetup.sh" in host, then run "coredump_enable $PID".

Change-Id: Id373f2a7adc56d6a40720ec900b2561c9dbea2b1
2022-05-27 04:58:22 +00:00
Usta Shrestha
8c2f467697 Merge "Allow sourcing envsetup from anywhere" am: 0e46244250 am: 596a630c65
Original change: https://android-review.googlesource.com/c/platform/build/+/2097636

Change-Id: I1470f163980b57d0c56f9dcb00f3692b3f8c8cc7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-24 18:08:31 +00:00
Usta Shrestha
596a630c65 Merge "Allow sourcing envsetup from anywhere" am: 0e46244250
Original change: https://android-review.googlesource.com/c/platform/build/+/2097636

Change-Id: Ifd8b3f9d5556a05713ae6d9043d7047b42fb5b27
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-24 17:29:31 +00:00
Anton Hansson
0328e32621 Change default arch for banchan to arm64
Devices that only support 32-bit are very uncommon. Default
to the arch that module authors are most likely to be using.

Test: banchan com.android.sdkext | grep TARGET_PRODUCT
Test: banchan com.android.sdkext arm | grep TARGET_PRODUCT
Test: banchan com.android.sdkext arm64 | grep TARGET_PRODUCT
Change-Id: I31734660318eabbe3279214980b5cdecb55ab80b
2022-05-24 15:47:40 +00:00
Usta Shrestha
1433fb357b Allow sourcing envsetup from anywhere
Bug: 232555676
Test: cd build && source envsetup.sh
Change-Id: I8491628406e494f31589249d1cc851b672dd7cae
2022-05-23 18:50:52 +00:00
Treehugger Robot
10e1b73e6e Merge "Checkpoint new build orchestrator" am: a96be433c4 am: c7de0493f1
Original change: https://android-review.googlesource.com/c/platform/build/+/2096153

Change-Id: Iea29dc64f0a6dc2a7859e4aad16261635641a002
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 23:59:16 +00:00
Treehugger Robot
c7de0493f1 Merge "Checkpoint new build orchestrator" am: a96be433c4
Original change: https://android-review.googlesource.com/c/platform/build/+/2096153

Change-Id: Id670437d8bb08dff6cac932cee28986a3c0bd20a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 23:37:59 +00:00
Joe Onorato
7cf6f97775 Checkpoint new build orchestrator
Test: rm -rf out && multitree_build
Change-Id: Ic274182f0925f30d56227597b65e5b9ef3b19707
2022-05-12 12:12:38 -07:00
Treehugger Robot
9a37e45746 Merge "envsetup.sh: fix adb tab completion" am: 1ef63b944e am: d436fa704b
Original change: https://android-review.googlesource.com/c/platform/build/+/2087123

Change-Id: I025a3b394d5c877426136f26d0a8ebc8e0f0d882
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-05 09:28:18 +00:00
Treehugger Robot
d436fa704b Merge "envsetup.sh: fix adb tab completion" am: 1ef63b944e
Original change: https://android-review.googlesource.com/c/platform/build/+/2087123

Change-Id: I9324867e6b23d6288150ac045bcfb724a381de08
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-05 09:07:17 +00:00
Mårten Kongstad
cb5c73fd9e envsetup.sh: fix adb tab completion
The adb module has been moved from system/core to packages/modules/adb.
Update the path to the adb tab completion script accordingly.

Also teach envsetup.sh to complain if completion files are not found.

Test: manual: adb tab completion works
Test: source build/envsetup.sh && declare -F _adb
Change-Id: I7d6fda3813b95e64de7b1953675f66659e750c31
2022-05-04 14:47:20 +00:00
Treehugger Robot
ed826115b7 Merge "revert addition of --skip-soong-test flag" am: 9bc50689c9 am: 3cbef527f0 am: def5eefbb7
Original change: https://android-review.googlesource.com/c/platform/build/+/2060119

Change-Id: I7f60617cc3da425444049cb8f7786a858181f3e2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-11 17:22:14 +00:00
Treehugger Robot
3cbef527f0 Merge "revert addition of --skip-soong-test flag" am: 9bc50689c9
Original change: https://android-review.googlesource.com/c/platform/build/+/2060119

Change-Id: I5bea9a572c1257509131f042df2efc196cd87fa3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-11 16:37:41 +00:00
Sam Delmerico
9d67a905b7 revert addition of --skip-soong-test flag
aosp/2045666 attempted to permit passing the `--skip-soong-tests` flag
through the `b` command to `soong_ui`, but it has been causing problems.

Test: b build '...' --skip-soong-tests is not recognized
Test: build/bazel/ci/bp2build.sh
Change-Id: I02487841d8081218dc941cb04bfa1a9e148ab6af
2022-04-11 12:27:10 +00:00