Commit Graph

704 Commits

Author SHA1 Message Date
Joe Onorato
d4e29a4b63 Remove the "provision" shell function from envsetup.sh
It's been a long time since anything in the tree generated the
$ANDROID_PRODUCT_OUT/provision-device script needed for it to work.

Bug: 340648588
Test: treehugger
Change-Id: I5f34fb7b9ed9f6c06d422ddeb55a5ef9aa367538
2024-05-24 14:37:51 -07:00
Zhuoyao Zhang
dfdf19f225 Fix a bug in run_tool_with_logging script
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
2024-05-21 18:10:01 +00:00
Joe Onorato
143f9e0b72 Make side of converting refreshmod to a shell script
Bug: 340648588
Test: refreshmod
Change-Id: Iedbdd31f9a58cb609a826dfe8066c9eff8aa5904
2024-05-20 14:22:20 -07:00
Joe Onorato
1b9ab2903c Clean cruft out of envsetup.sh
Most if it moved to build/soong/bin as standalone scripts

Bug: 340648588
Test: ran the scripts
Change-Id: I69bff94a2293e2563d58d29b12f7926a9229f9d4
2024-05-20 14:22:20 -07:00
Joe Onorato
2312475f66 Clean cruft out of envsetup.sh.
aninja and overrideflags moved to build/soong/bin

Bug: 340648588
Test: manual
Change-Id: I1d426b628f15674e142df4152661d3f4b9b56320
2024-05-14 15:12:53 -07:00
Joe Onorato
32b2aa33c5 Provide a function in envsetup.sh to get the host arch directly
It's very simple logic, and running get_build_var to do it is slow
and has side effects (like needing a lunch target, creating an out
directory, etc.)

Test: source envsetup.sh
Change-Id: If260efd21713874fba7c15dbc0fd23442d776f8a
Merged-In: If260efd21713874fba7c15dbc0fd23442d776f8a
2024-05-14 15:12:16 -07:00
Zhuoyao Zhang
ef1c03f997 Remove the ANDROID_ENABLE_TOOL_LOGGING environment variable
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
2024-05-07 22:51:51 +00:00
Zhuoyao Zhang
db666bcb0c Add an integration test
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
2024-05-02 18:43:19 +00:00
Zhuoyao Zhang
60dd9ddce9 Support tool event logging for ADB invocations
Note that tool logging is still disabled by default.
This change validates that the ADB shell function
does not break any user flows when integrated with
the logging facility.

Test: adb devices -l
Bug: 331638854
Change-Id: Ic27fd44c9385ca48df79f2d7570c037b6fe18232
2024-04-19 17:38:17 +00:00
Zhuoyao Zhang
cc44d2e70e Add a facility to log tool invocations
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
2024-04-17 22:41:58 +00:00
Elliott Hughes
57c47b7055 envsetup.sh: work around zsh's built-in which.
Change-Id: I2583e7c2d7f27aa0d1b0e81601dc3b10e2404c89
2024-03-22 15:46:59 +00:00
Elliott Hughes
86e991710c envsetup.sh: explain _why_ there's an adb function in here.
This is what I came to do yesterday, but got distracted by the fact that it had been broken.

Change-Id: Ie3baf387c6c95a7302c1f6916c1557d486341cd8
2024-03-21 16:55:08 +00:00
Elliott Hughes
7e7ff75042 Fix adb function.
It was broken by the last change (because unlike `which adb`, `command
adb` does not search $PATH if there's already an entry in the hash).
No-one's noticed in almost a year, but this has caused (rare) confusion
in the past.

Bug: http://b/24473359
Change-Id: I6bbb207992449132ba8563a8bcf298256c599c0d
2024-03-20 17:23:40 -07:00
LaMont Jones
e8a3be2ea2 envsetup: fix path to build/bazel/bin tools
Bug: None
Test: manual
Change-Id: If0124eb5f5d85064e0063403cca477b98d42a922
2024-02-12 09:55:41 -08:00
Joe Onorato
84e61d0d07 Add build/soong/bin to the paths
This gives us a good place to put scripts on the PATH instead of adding
more functions to envsetup.sh

Test: GENERATE_SOONG_DEBUG=true m nothing ; soongdbg ...
Change-Id: I3c1a80fc8aae8de548bfe9036dc86fa006fc58c6
2024-02-03 14:44:41 -08:00
Kevin Dagostino
185109bdd6 Add banner announcing adevice when running builds.
Test: ANDROID_QUIET_BUILD=true mm
Test: mm
Change-Id: Ib1329d2f52f11d0ad437d0fb02000e4e7f104d55
2024-01-17 21:56:30 +00:00
Fabián Cañas
3939d1ca59 Merge "Fix numeric selection from lunch menu" into main 2024-01-08 19:06:02 +00:00
Fabián Cañas
03dd0283bc Fix numeric selection from lunch menu
Bug: 318871826
Test: 'lunch' with no arguments, then select a lunch target with a
number.

Change-Id: I8418ef0415437548d1429ec7a2c239d8c5b615d5
2024-01-05 16:57:39 -05:00
Greg Kaiser
bae4c57b7b Change default lunch target
We keep this as "trunk_staging" and "eng".  However, we switch
from "aosp_arm" to "aosp_cf_x86_64_phone".  This switches us
away from 32-bit development, and gives us a project (the
cuttlefish ("cf") emulator) at the end of the build which is
runnable with reasonable performance, and able to run all 32-bit
and 64-bit tests.

Bug: 318749634
Test: lunch

Change-Id: I920cdd413cbcecd4300bc46c719e5788244a924e
2024-01-04 16:36:07 -07:00
Martin Stjernholm
a73fe8da4b Quote the backslash in the hmm output.
Otherwise it becomes a single line with an ugly long stretch of spaces
in the middle.

Test: hmm
Bug: 179779520
Change-Id: Ia095b75248952d9bee0d6417028d04460e74ad33
2023-12-22 13:32:42 +00:00
Mark White
9075d32212 Merge "Suggest developers use -eng builds instead when they lunch -userdebug" into main 2023-11-23 16:18:35 +00:00
Colin Cross
3cf51d84af Merge "Revert "Add banner announcing adevice when running builds."" into main 2023-11-17 19:17:08 +00:00
Colin Cross
0fa5af19b9 Revert "Add banner announcing adevice when running builds."
This reverts commit 6d10bbddf9.

Reason for revert: broke exit code from `m`

Bug: 309792999
Change-Id: If0de43003a9c4427d1da941de4afc28723ee0cd3
2023-11-17 18:18:00 +00:00
Greg Kaiser
9a5a526257 Fix example lunch target
We make this example valid for trunk stable.

Bug: 307738446
Test: lunch command
Change-Id: I25a142f1b87facebdcf2751f3f4cb68a0738945d
2023-11-02 16:59:23 +00:00
Ronald Braunstein
75b114560a Merge "Add banner announcing adevice when running builds." into main 2023-11-01 17:54:03 +00:00
Ronald Braunstein
6d10bbddf9 Add banner announcing adevice when running builds.
Test: ANDROID_QUIET_BUILD=true mm
Test: mm
Change-Id: I513591137d4866bcb824b3021269c29dec32f972
2023-10-31 15:29:06 -07:00
Greg Kaiser
b6a0d39dad Set empty TARGET_RELEASE for some commands
The same commands where we're setting things like
TARGET_BUILD_VARIANT to be explicitly empty, we do the
same with TARGET_RELEASE.

Bug: 307946156
Test: 'lunch' with no arguments
Change-Id: If78eacd62725122d47829e2e9079b182fdafb9b4
2023-10-27 18:07:30 -06:00
Greg Kaiser
d35095e5f4 Fix banchan for trunk stable builds
In the 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 in places like git_main.

Bug: 307946156
Test: None
Change-Id: Ie418aee2fad192a38beca44cd7d168e0e1b45689
2023-10-27 18:07:23 -06:00
Greg Kaiser
5e2d3399d3 Require lunch targets to be product-release-variant
Instead of supporting both product-variant and
product-release-variant, we now require the release
type to be given to use.

Bug: 307946156
Test: 'lunch aosp_mokey-userdebug' (now) fails; 'lunch aosp_mokey-trunk_staging-userdebug' (still) works
Change-Id: Ica87b3969f950a57232615f33bfe5f4012a743d6
2023-10-27 15:59:36 -06:00
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
Mark White
2c807515c0 Suggest developers use -eng builds instead when they lunch -userdebug
This is because -eng provides faster local builds.

(also moving hints to where they are more likely to be seen)

Test: lunch cf_x86_64_phone-userdebug
Fixes: 307753064
Change-Id: I52cf9e9c399dbb3a52c7952f7204a9e567d15c22
2023-10-25 17:34:04 +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