Commit graph

674 commits

Author SHA1 Message Date
Greg Kaiser
83ed159cf7 Fix tapas for git_main builds
In the git_main trunk stable builds, we're required to have a
TARGET_RELEASE set.

For now, we hard-code this to "trunk_staging" (and leave a TODO
to accept this as a function argument).

This will have us producing valid builds under git_main.

Bug: 307975293
Test: 'tapas google-tradefed-all' now works on a tree that has go/aog/2806253
Change-Id: I70572fb4c7902350513e251694f3ddef91efcb13
2023-10-26 18:38:35 +00:00
Greg Kaiser
a13cd28e44 Have default 'lunch' target use a release type
In git_main, the correct target here is aosp_arm-trunk_staging-eng
(or "trunk_food" or "next", but we choose the most generic
"trunk_staging").

Bug: 307738446
Test: "lunch", hit return for the default, "echo $TARGET_RELEASE" to confirm
Change-Id: I4d4bcaf27553976e64133c7351db296953f88b08
2023-10-25 16:18:45 +00:00
Colin Cross
71319726df Add aninja to envsetup.sh
Add an aninja function to envsetup.sh that can run ninja with the
appropriate ninja file for an Android build.  Simplifies running
queries with ninja.  For example:
aninja -t query droid

Test: aninja -t query droid
Change-Id: I7064984d55054cd4350800cfd75bf6aaa1740e9d
2023-10-24 10:58:46 -07:00
Zhi Dou
77c9f0c9cb add script to help override flag value locally
Add a script to help to create flag value building rules.

The script will only extract necessary information from the value file
but it will not validate the file. The validation will defer to building
system.

For input

```
flag_value {
    package: "com.android.aconfig.test"
    name: "disabled_ro"
    state: DISABLED
    permission: READ_ONLY
}
flag_value {
    package: "com.android.demoapp.test"
    name: "enabled_ro"
    state: DISABLED
    permission: READ_WRITE
}
flag_value {
    package: "com.android.aconfig.test"
    name: "enabled_rw"
    state: ENABLED
    permission: READ_WRITE
}
```

The output Android.bp file will be like
```
VALUE_LIST_LIST = [
    aconfig-local-com.android.demoapp.test,
    aconfig-local-com.android.aconfig.test
]

aconfig_values {
    name: "aconfig-local-com.android.demoapp.test",
    package: "com.android.demoapp.test",
    srcs: [
        "override_values.textproto",
    ]
}

aconfig_values {
    name: "aconfig-local-com.android.aconfig.test",
    package: "com.android.aconfig.test",
    srcs: [
        "override_values.textproto",
    ]
}
```

Bug: 298692416
Test: source build/envsetup.sh && overrideflags, and then check the
output

Change-Id: Ife4063e079811e0b29046be7a6bc127cad668ed0
2023-10-20 21:04:00 +00:00
Jingwen Chen
688e5d606b Support multiple module name queries with bmod.
Test: bmod libc libm libdl
Test: bmod adb framework-minus-apex libdl
Change-Id: I156cc31185d3f97d6b5d74c232bd6cd9287cee02
2023-10-17 06:21:46 +00:00
Kousik Kumar
ec5416c9ad Add cog setup scripts
This script has the following functionality:
1. Sets up the `out` symlink to point to a default location on disk
2. Copies RBE binaries outside Cog (temporary fix for build stall problem) - b/289391270
3. Exports ANDROID_BUILD_ENVIRONMENT_CONFIG variable to point to googler-cog.json file. This file will be available in aosp-main-with-phones and goog/main and downstream branches.

TESTED=ran the script within and outside the Cog workspace to test it.

Bug: b/295053716
Change-Id: I59cd6d2d5f954be6f7e4ecd7d64de1e63e51b72e
2023-09-14 17:11:45 +00:00
Saagar Jha
11f188c09a Use command instead of which to locate/run adb
If adb is not found on PATH, which will silently fail and evaluate to
the empty string. This will cause the remaining arguments to be
interpreted as a command to run in the shell, which is generally
undesirable. (Consider, for example, "adb reboot" -> "reboot".)

Bug: 24473359
Test: Just run adb before lunch so it's not on PATH

Change-Id: I6b20722add6c67d1d2627f963dc66095502ab816
Signed-off-by: Saagar Jha <saagarjha@google.com>
2023-07-13 23:36:29 +00:00
Shaju Mathew
2143900a7c Updating build/config setup to refresh adb path name after a rebuild.
Bug: 24473359

Test: Treehugger
Change-Id: I706e24a8ba7b75a381e9efe48d5db2d49c0f4da6
2023-07-10 00:53:22 +00:00
Santiago Aboy Solanes
9ebfc23191 Merge "Remove dmtracedump from build/make" into main 2023-07-07 15:30:21 +00:00
Ulya Trafimovich
08c381b8b2 Add riscv64 banchan target.
Test: banchan riscv64 com.android.art
Test: build/soong/build_test.bash --dist -products module_riscv64
Bug: 271573990
Change-Id: I6aa8c51b1a1928b3da52a9345a8bfb84e3eb11d0
2023-06-28 13:58:30 +01:00
Santiago Aboy Solanes
06adf82ca7 Remove dmtracedump from build/make
Bug: 287576918
Fixes: 287576918
Change-Id: Ie84cccf97ddf7e9277d28759000ad35ebf813d1a
2023-06-27 16:06:23 +01:00
Dan Albert
426ac69cbf Adapt to gdbrunner packaging.
Similar to
https://android-review.googlesource.com/c/platform/build/+/2403120.
The directory structure of //development/python-packages/gdbrunner
needs to change to be able to export type info to importers, and this
needs to adapt to keep gdbclient working.

Bug: None
Test: gdbclient.py --help
Change-Id: I8127ec7beae2a7840283be25ee236a8e2af48cae
2023-05-16 22:59:55 +00:00
Joe Onorato
964f401281 Add release flag logic based on TARGET_RELEASE.
Test: Lots of manual testing
Change-Id: I9072f136e64576009d0debd057c8ce6918fae861
2023-05-11 12:53:36 -07:00
Jeff Hamilton
a02c747449 Add lunch support for TARGET_RELEASE
This replaces support for the unused
TARGET_PLATFORM_VERSION variable.

Now, if you pass three - separated
items the first is product, the
second is release and the third
is variant. If you only pass two
they're still product-variant
and the build system will choose
a reasonable default for release.

Test: run lunch with two and three items, confirmed values in the build banner
Change-Id: I128177d96ffe81b79b6945a24ebf37861c3b25fc
2023-05-08 03:23:30 +00:00
Steven Moreland
7275a19b5f envsetup: syswrite - wait after rooting
adb root sometimes takes a second, and the next command
will fail.

Bug: N/A
Test: syswrite on device which isn't already rooted
Change-Id: I91754c31c74bf0589ea8cbae77c10e5a120bdce5
2023-04-17 17:22:41 +00:00
Joe Onorato
956707830e have sgrep search rust and go files too
Test: sgrep Singleton
Change-Id: I00ac124cbea59512b094ddc50523a5491ac9a1b7
2023-02-27 15:58:15 -08:00
Treehugger Robot
4e0be0b4e3 Merge "Skip RBE warning message" 2023-02-01 22:14:58 +00:00
Dan Albert
0d6d3599a0 Update PYTHONPATH for adb.py restructuring.
Importers of the adb python package like lldbclient.py and gdbrunner
are broken following the restructure that enabled adb to export type
info to importers.

Bug: http://b/266688086
Test: adb.__file__ is no longer None after envsetup.sh/lunch
Change-Id: I7bf27601e800043adee8971c093347ca9b2979a9
2023-01-26 00:09:21 +00:00
Kousik Kumar
869f3fee37 Skip RBE warning message
Since RBE is default for dev builds, and we no longer set RBE config
through env variables, this error message is incorrect.

Bug: b/265326161
Test: Ran a build and make sure this error message wasn't printed
anymore.

Change-Id: I128616ce37763400407e099b52ef284905239eb4
2023-01-12 20:27:50 +00:00
Jeff Vander Stoep
f5f5146415 envsetup: add tomlgrep and jsongrep
This is useful for searching Rust config files in external.

Test: cd external/rust/crates; tomlgrep foo
Change-Id: I1ff5118a8eee1a95f1bc6fa44c922673a03ebd8b
2023-01-10 14:09:45 +01:00
Joe Onorato
344e404abb Pull common methods into shell_utils.sh, which can be included by scripts.
So we can stop copying gettop and others all over the place.

Test: manual
Bug: 260003429
Change-Id: Ic1b5d6bec8726d9253fb33ec588e503d6fc8167a
2023-01-03 14:12:43 -08:00
LaMont Jones
51670eb263 multitree_lunch: remove extraneous call
If the shell is set to exit on errors, the extraneous (incorrect syntax)
call to lunch.py causes an early exit.

Change-Id: I0176d5c9e7e42640514fd4988d82fbfdd825631d
2022-12-07 21:55:58 +00:00
Joe Onorato
1cb9e157ec Fix tests. Missing colon separator and typo
Test: build/make/tests/b_tests.sh
Change-Id: Ie7d2b5b839b9d16db2c04980ea2d643118769e69
2022-12-05 17:06:30 -08:00
Joe Onorato
7c3a77f4c9 Split envsetup.sh PATH setting into lunch-dependent and lunch-independent values
This gets b (and other scripts that are coming soon) into the path without running lunch.

Also gets rid of the make dumpvar ANDROID_BUILD_PATHS variable, used to set a few more paths,
so that the setting is all in one place, now that the get_abs_build_var is cached.

Test: Lots of manual checks of before and after combinations
Change-Id: I745168c43ccf2fef4cdd22657fd087f1ad07e510
2022-12-05 13:13:37 -08:00
Treehugger Robot
c5f135a5eb Merge "envsetup: Add pygrep function to grep all python files" 2022-11-18 04:38:51 +00:00
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