Commit graph

572 commits

Author SHA1 Message Date
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
Treehugger Robot
9d1b28ed10 Merge "Implement multitree lunch" 2022-04-09 00:19:03 +00:00
Joe Onorato
824608c33d Implement multitree lunch
Test: (cd build/make/orchestrator/core ; ./test_lunch.py)
Change-Id: I4ba36a79abd13c42b986e3ba0d6d599c1cc73cb0
2022-04-08 13:42:55 -07:00
Sam Delmerico
89a4702555 prevent unintended m bp2build "" when running b
cl/2045666 allowed the --skip-soong-tests flag to pass through
invocations of the `b` command to soong_ui. But when the flag was
missing, an extra `""` argument was passed instead which caused soong_ui
to invoke a build of the droid target.

Test: m clean && b build '...'  # verify Soong does not run a build
Change-Id: I7b99437d225786eb1698a88d0c755ce897550e70
2022-04-05 13:47:32 +00:00
Sam Delmerico
ef43149136 add flag to skip soong tests for b command
Sometimes it is very handy during testing to temporarily skip Soong
tests, but there is not easy method to allow this without changing the
envsetup.sh file and re-sourcing before/after enabling/disabling the
skip-tests flag.

Test: b build '...' --skip-soong-tests
Change-Id: I6dcad3ba0336cfd1c4d2c4357b852900792445c3
2022-03-29 14:39:33 +00:00
Will Burr
404012020f envsetup.sh: Update text in lunch menu for clarity
Updates the lunch menu text to make it clearer that the choices in lunch
menu are not fully comprehensive. As the list comes from common lunch
choices the text now refers to 'common combinations' and informs that
you can 'specify your own'. This should help developers who are unsure
why they cannot find their desired lunch target in the list.

Change-Id: Ib9d55ee46b7037c30a8f4b43fdd552ea66e887e8
Test: source build/envsetup.sh && lunch
2022-02-09 15:25:17 +00:00
Martin Stjernholm
6a012266a1 Ensure there are no empty paths in ANDROID_BUILD_PATHS and PATH.
Test: lunch armv8
      - Check that PATH has no "::".
      - Check that an executable script in CWD doesn't get executed.
Change-Id: I3a97eb661c614ff2e09723e9ccca0bdeb63dbdc5
2021-11-24 14:59:15 +00:00
Kousik Kumar
bd9b9b0226 Remove unnecessary RBE sourcing in envsetup.sh
We no longer need these since we switched to config files and I missed removing them. So removing them now

Bug: b/202340353
Change-Id: Ibab8ab8d4a45e01d2c98632ccee2684ea600ff69
2021-11-01 01:36:03 -04:00
Cole Faust
3e1923867a Support -s in installmod command
The -s flag must be passed before the adb command,
as in `adb -s emulator-5554 install myapp.apk`
instead of `adb install -s emulator-5554 myapp.apk`.
Parse it and move it to the correct location if it
exists.

Test: Manually
Change-Id: I4b296d7fe4efbe3b25d21d33a8082b321787651a
2021-10-25 13:43:48 -07:00
Dan Willemsen
838dcece45 Remove removed selinux prebuilts from $PATH
These were removed in https://android-review.googlesource.com/c/platform/external/selinux/+/1807296

Change-Id: If13bbeff5e14dc0bcc2e1f30ba5d7eab8d0ff6e3
2021-09-30 22:40:38 +00:00
Jingwen Chen
0e4eba1544 Remove module_name_to_label short circuit from m.
This wasn't adding much value, let's remove it for now until we decide
on how mixed builds will be exposed for users later.

Test: USE_BAZEL_ANALYSIS=1 m droid
Change-Id: I16465fd7759646964ea8c50aab6ab91f47c5e8d1
2021-09-17 08:45:30 +00:00
Lukacs T. Berki
3fef660fae Replace GENERATE_BAZEL_FILES=1 with "m bp2build".
This should have been submitted in the pertinent topic, but I messed by
git repositories up.

Test: Presubmits.
Change-Id: I7f3e9648c1961169ff40c8e2ddaf3d893498f625
2021-09-07 08:20:33 +02:00
Kousik Kumar
09af254c8f Add a prompt to try out RBE for local builds
This is to nudge developers to use RBE especially when they run into
long builds and do NOT have RBE turned on.

Change-Id: I7da94763f5387310e522931bf650f9d7c01dc7f2
2021-08-23 14:55:35 -04:00
Kousik Kumar
721533e0d6 Add the ability to source RBE related scripts from envsetup.sh
This is so that developers don't have to remember to source a separate
script to source RBE related variables.
I'll modify the docs once this change is submitted.

Test:
Ran forrest build with fix for previous build failure - https://android-build.googleplex.com/builds/abtd/run/L72300000950316038

Bug: b/193407413
Change-Id: I16f057086e2ee4f5918816ea70dbb33d0f5e99ab
2021-07-14 11:31:54 -04:00
Ahaan Ugale
678f26c1e7 Revert "Add the ability to source RBE related scripts from envsetup.sh"
This reverts commit 9aa9e47b8c.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_rvc-qpr-dev-plus-aosp&target=ndk&lkgb=7546337&lkbb=7546521&fkbb=7546426, bug https://buganizer.corp.google.com/issues/193566521

Fix: 193566521
Change-Id: I7196a00006499f729baa86a252b0df6535c6aeaa
2021-07-13 22:12:24 +00:00
Kousik Kumar
9aa9e47b8c Add the ability to source RBE related scripts from envsetup.sh
This is so that developers don't have to remember to source a separate
script to source RBE related variables.
I'll modify the docs once this change is submitted.

Test:
USE_RBE=true source build/envsetup.sh sources RBE variables.
USE_RBE=false source build/envsetup.sh does NOT source RBE variables.
source build/envsetup.sh does NOT source RBE variables.

Bug: b/193407413
Change-Id: Ib8abf4c307b02fbb0c63b8a62d7aeda8be42d0fb
2021-07-12 14:05:13 -04:00
Jingwen Chen
bfa114d05b Direct Bazel builds from m.
This CL extends the `m` function to short circuit to Bazel iff:

1) USE_BAZEL_ANALYSIS is set to 1 or true
2) There is only 1 Soong module requested to be built
3) The Soong module has a corresponding Bazel alias target in @soong_injection//targets/BUILD to the real target in out/soong/workspace.

Test: TH
Change-Id: I976ffa53106c0b52c75b71f1e0e1e8b3ef5cb3d1
2021-06-21 06:12:33 +00:00
Jingwen Chen
69f9ed14a9 Show bazel help for b called without args.
This is less surprising than trying to use --config=bp2build as the only args, which is invalid.

Test: source build/envsetup.sh; b
Change-Id: I0b3724d05b8cc149268e660eb672192fe9bad19d
2021-06-16 09:44:57 +00:00
Anton Hansson
32fa7ee8c3 Add help message for likely typo to lunch
Test: lunch aosp_blueline_userdebug
Change-Id: Ieb8059d1717a98f66d61387d6bfd28470835eb6e
2021-06-14 17:21:22 +01:00
Jingwen Chen
17d569940f Improve bazel() warning in envsetup.sh.
Fixes: 190688038

Test: source ~/aosp/build/envsetup.sh && cd / && bazel
Change-Id: I309a77e109d8b3a65c4b28aeb5fbf2a059006ee0
2021-06-10 08:17:54 +00:00
Jingwen Chen
d728ee1a06 Introduce b into envsetup.sh.
`b` is a function that combines:

1. Integrated generation of a synthetic bazel workspace, containing
symlinks to BUILD and bzl files alongside symlinks to the source tree.
This is the --package_path of the bazel build.
2. Running the Bazel build itself with b's entire argv.

A user accustomed to typing `bazel build <targets>` would
now type `b build <targets>`.

Test: source build/envsetup.sh; b build //bionic/...; b cquery --output=label_kind //bionic/...
Fixes: 188490434
Change-Id: I36e366108b024c09945d764a1115786658e03681
2021-05-18 23:37:39 +00:00
Joe Onorato
0bac4fe09d Make verifymodinfo in envsetup.sh quiet on errors during tab completion
Test: m <tab><tab> before having done a full build.
Test: m <tab><tab> after having done a full build.
Change-Id: I35154151e6902d0337a26eab27d9d4fc797beed7
2021-04-29 15:44:29 -07:00
Joe Onorato
4acbe3b416 Use python3 specifically for envsetup.sh
Test: . build/envsetup.sh ; m <tab>
Change-Id: I94152c567f179fd7829bc675766e764624e5b7a3
2021-04-29 15:44:29 -07:00
Colin Cross
fa50d406bb Clear TARGET_PRODUCT and TARGET_BUILD_VARIANT when getting lunch menu
An old TARGET_PRODUCT value pointing to a removed product or an invalid
TARGET_BUILD_VARIANT value cause lunch to fail to read
COMMON_LUNCH_CHOICES, clear them before calling into the build with
get_build_var.

Test: TARGET_PRODUCT=foobar TARGET_BUILD_VARIANT=foobar lunch
Change-Id: I53d205784149ba7e32cc093f9d81d1a82c08bfc0
2021-04-22 13:05:41 -07:00
Martin Stjernholm
215596dd59 Merge "Allow selecting a different product in banchan." 2021-04-20 11:22:00 +00:00
Treehugger Robot
9dbecd650f Merge "envsetup: fix indent" 2021-04-19 18:16:08 +00:00
Martin Stjernholm
2b8d923a09 Allow selecting a different product in banchan.
Necessary since the products used for APEX modules are different in
internal builds.

Test: banchan com.android.art
Test: banchan com.android.art arm
Test: banchan com.android.art art_module_arm
Test: banchan com.android.art module_arm
Test: banchan com.android.art x86_64
Test: banchan com.android.art art_module_x86_64
Bug: 179779520
Change-Id: Ib59a86b70e409537aaad7258465b6874b589b858
2021-04-19 18:32:00 +01:00
Timi
0469c3f91c envsetup: fix indent
Test: . build/envsetup.sh
Change-Id: I829dafc707dc02d5a31899a784f88a367ec95e94
Signed-off-by: Timi <timi.rautamaki@gmail.com>
2021-04-19 17:07:53 +02:00
Martin Stjernholm
f692c756f7 Add new user setup command banchan for module building.
It currently uses TARGET_BUILD_APPS just like tapas, but the use case is
different and it may diverge more in the future.

Test: banchan com.android.art
Test: banchan help
Test: banchan
Test: hmm
Bug: 179779520
Change-Id: Iae718e65a2a7212c741c397e03c6f9a6d5ee8951
2021-04-13 02:07:04 +01:00
Taesu Lee
ea0cecd9e4 Add "ktgrep" for Kotlin
New ktgrep is added and sgrep/treegrep also scan *.kt files.

Test: kgrep/sgrep/treegrep for Kotlin files.

Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
Change-Id: Ie615aa86c4958310785392f18ee7bddaf64706a9
2021-03-16 15:10:34 +09:00
Joe Onorato
2c1aa47057 Add dirmods command to envsetup.sh
It will query module-info.json for modules inside a given directory.

Test: . build/envsetup.sh ; dirmods frameworks/base
Change-Id: Iad3dcb038315f49c156764e34fb5f52ec3ad29be
2021-02-26 08:57:23 -08:00
Alistair Delva
176e534edb Rename rgrep to rsgrep
rgrep is a common alias for 'grep -r' and this new macro was confusing.

Test: cd external/rust/crates
    rsgrep test
Change-Id: If71cdcc926455983a04a80982356e9feb61968fe
2021-02-22 13:32:07 -08:00
Jeff Vander Stoep
1431ab8cf9 envsetup: add rgrep for local Rust files
Test: cd external/rust/crates
    rgrep test
Change-Id: I69fa770742c0dc20259346acaf1184c19675b3a7
2021-02-02 19:18:26 +01:00
Cole Faust
24c36dbeec Add outmod and installmod commands
These are analogs to pathmod/gomod that find/install
the module's apk instead of cd'ing to its source
directory.

Bug: None
Change-Id: Iad750e154397f7cfcdd620f1ed6478b05c1225bb
Test: Manually, with bash and zsh
2021-01-26 01:50:18 +00:00
Jingwen Chen
c8b5e196ce Pipe bazel() note text to stderr.
This allows subshell-ing bazel, e.g. bazel build $(bazel query //...)

Test: . build/envsetup.sh; bazel build $(bazel query <expression>)
Change-Id: If28b63769032b61e150422cb5b9b4e55c14cd13d
2020-12-14 18:51:50 -05:00
Jiyong Park
c02b1c463e Export SOONG_HOST_OUT as ANDROID_SOONG_HOST_OUT
Some host tools (launch_cvd, etc.) have been using HOST_OUT.
As their dependencies are now installed by soong, the tools should refer
to SOONG_HOST_OUT. Export it as ANDROID_SOONG_HOST_OUT.

Bug: 172065015
Test: build aosp_cf_x86_phone, execute launch_cvd
Change-Id: Ie175049f15b89485feec0d33d82e756b12a7ad8a
2020-11-03 11:06:39 +09:00
Alessandro Astone
c8771bef56 build: allow refreshmod with external out directory
Get a relative path to out by using $(get_build_var PRODUCT_OUT)
instead of hardcoding it to out/target/product/$TARGET_DEVICE.
That will correctly return the path to the out directory
when setting an external OUT_DIR_COMMON_BASE.

Change-Id: I8a990b710222bc72755c6b6b88fd0c9e80711e14
2020-10-27 13:39:59 +01:00
Rupert Shuttleworth
5d60d02454 Rename abazel() to bazel(), give a warning if clobbering an existing Bazel, and have it call tools/bazel (aka build/bazel/bazel.sh) to start Bazel.
Test: Manually.
Change-Id: I5605571147db33c6b6a008cedbf279bb909ecdee
2020-10-26 09:21:55 +00:00
Patrice Arruda
aa4b824d25 Source vendorsetup.sh scripts anywhere within the repo.
When sourcing the envsetup.sh script from a deep directory
inside of the repo, the vendorsetup.sh scripts are not being
sourced. This was causing the ANDROID_ENABLE_METRICS_UPLOAD
not to be set and developer's metrics were not being uploaded.
Provided the top directory to each directory path. Also cleaned
up the function to handle whitespacing correctly.

Bug: b/169699936
Test: *Ran source ../../build/envsetup.sh from external/libchrome dir
      *Renamed repo dir to "aosp master" and source build/envsetup.sh
      *Ran the script in zsh command line interpretor
      *Ran the script in MacOS
Change-Id: I96eb73d50a1923cdda782792778b0d185a341cf9
2020-10-14 15:33:44 +00:00
Rupert Shuttleworth
131fa7d866 Add abazel() function to envsetup.
Test: Tested manually on Linux and macOS.

Change-Id: I17f061c2d9135a7a309fc0750cc44cb30d455bc7
2020-10-13 04:26:09 +00:00
Ben Taitelbaum
8c2c9cfa9d Fix conflict with common zsh alias
oh-my-zsh common-aliases plugin defines `alias -g T='| tail'`, which causes an
error with the line `local T dir f`.

Making these lines more explicit resolves this issue, while also being clearer
that the intent is to clear out the local variables.

Bug: 169191000
Fix: 169191000
Test: source build/envsetup.sh; lunch <target>; m
Change-Id: Ief27aa3d9f541d0c39c6c11d7d771818d6493d31
2020-09-29 20:50:57 +00:00
Treehugger Robot
cecc644055 Merge "envsetup.sh: add 'syswrite' function" 2020-09-22 18:34:24 +00:00
Steven Moreland
74114f1e69 envsetup.sh: add 'syswrite' function
This function:
- disables verity on the device
- reboots the device only if it is needed
- remounts partitions on the device

Bug: 167697453
Test: syswrite
Change-Id: I23c3e88daaa2b334233f4faf7fe8f8244cd56225
2020-09-17 01:42:32 +00:00
Dan Albert
bab814f330 Add a showcommands function to envsetup.
This is similar to the old `m showcommands`, but operates on specific
output paths instead and does not require a build aside from the
initial invocation of soong to generate the ninja files. The
`--regenerate` option is accepted that causes the ninja file to be
regenerated first, but this is not the default because it is slow.
Just note that without this flag results may be stale.

It unfortunately doesn't work for everything in out. For example,
`$OUT/system/lib/libc.so` won't work because it is a symlink that
isn't in the build graph, but `$OUT/system/lib/bootstrap/libc.so`
works.

Test: showcommands out/target/product/walleye/system/lib/libz.so
Bug: None
Change-Id: I4cfded3db994044870fc71ae4bcf9a69224b1e15
2020-09-16 16:20:59 -07:00
Sasha Smundak
90d07bc72d Do not print environment variables if ANDROID_QUIET_BUILD is set.
Test: manual
Change-Id: I17c24beb9f0008e038a739a06027266b57e17e7a
2020-06-04 10:48:15 -07:00
Matt Alexander
d9c56568de Revert "Minor cleanup for script consistency and adherence to Google shell style guide."
This reverts commit d92718356d.

Reason for revert: Adding the opening brace to the end of the function breaks lunch.  

Change-Id: Ia3a9ff01964de0e616a534058d568150de32558a
2020-05-21 10:49:17 +00:00
Matt Alexander
d92718356d Minor cleanup for script consistency and adherence to Google shell style guide.
Test: manual

Change-Id: Ie9fd197cee5e934a0b89898b85d1a97adcec6348
2020-05-20 19:21:38 +00:00
Steven Moreland
ab25c7a30f Update refreshmod docs.
This also affects pathmod here.

Since it's updating module-info.json, we could say that as well (this
should affect any tools which parse this file), but I haven't seen any
indication it's necessary in this context.

Bug: N/A
Test: N/A
Change-Id: Iecb6f454112b5c0095ee7063bc5442fdb1e3bd09
2020-04-09 12:05:34 -07:00
Roland Levillain
23c46cf424 Print a user-friendly message when lunch cannot use the default product.
In some environments (e.g. with the master-art branch), the default
product (aosp_arm-eng) cannot be built, and thus prevents `lunch` from
printing the lunch menu (as it cannot initialize the build system in
order to fetch the common lunch choices). When this happens, show an
explicit error message from `lunch` instead of a Soong UI error.

Test: Check that this command line displays the expected error message:
        unset TARGET_PRODUCT && . build/envsetup.sh && lunch
Bug: 152762648
Change-Id: I40c66bca5b075d88dbc8364b36b2db713e6ad93e
2020-04-08 13:09:49 +01:00
Elliott Hughes
f71c05a8e5 Remove unused mips workarounds.
This was never really finished, and hasn't been supported for years.

Test: treehugger
Change-Id: I7668088d1449f33025aaf36fae0817894c84a877
2020-03-06 16:46:59 -08:00