Commit graph

522 commits

Author SHA1 Message Date
Christopher Tate
e2fe95903b Include .proto in sgrep()
Test: use in frameworks/base
Change-Id: I8104822cf69b09b3d11edb9261b8ab43029549d7
2020-03-05 11:34:16 -08:00
Steven Moreland
92793dc56c lunch: error on >1 arg (before ignored)
Bug: N/A
Test: lunch w/ 0, 1, and 2 args
Change-Id: Icbeb511e836b08cbd64b08a23b0e4820039b12ab
2020-02-25 18:33:53 -08:00
Stephen Hines
aa8d72c93f Add ASAN_SYMBOLIZER_PATH for SANITIZE_HOST=address builds.
Bug: http://b/30877494
Test: source build/envsetup.sh && echo $ASAN_SYMBOLIZER_PATH --version
Change-Id: I669a5762cc2cea26c0c29f935abde6c14eb0ced7
2020-02-04 09:16:28 -08:00
LuK1337
b6a7819be6 Make allmod() and pathmod() py3 compatible
Change-Id: I8d58f2f64c03d54449844269974367f31de6ad31
2020-01-12 03:12:17 +01:00
Treehugger Robot
49aa6fc009 Merge "Update the docs for 'mm[m][a]'" 2019-11-01 06:42:14 +00:00
Dan Willemsen
67074fec61 Update the docs for 'mm[m][a]'
Make it explicit that we will build *and* install all the modules under
the directories. And that 'mm[m]' is now the same as 'mm[m][a]'.

Test: hmm
Change-Id: I86c42229f8cdc24922fb3014777ad13d72a1c0ea
2019-10-30 12:35:34 -07:00
Orion Hodson
831472dee1 Update finding go files
Add gogrep for grepping golang files.

Extend mgrep to search for files in subfolders of build and soong
directories.

Test: source build/envsetup.sh && gogrep DepsMutators
Test: source build/envsetup.sh && mgrep ProductPrivateSepolicyDirs

Change-Id: I26fd9ba5ba0b81b202154aa527ed4a0aa60c1c54
2019-10-30 10:07:17 +00:00
Treehugger Robot
3da3191366 Merge "Fix zsh compatibility issue in build/envsetup.sh" 2019-10-08 11:41:26 +00:00
Dan Willemsen
91763e93e6 Fix lunch choices w/zsh
zsh doesn't split variables (by default), but it will split command
output. bash will split both. Apparently a portable way to do this in
both is to just turn it into another command: "$(echo $var)".

Test: source build/envsetup.sh; lunch (see list; repeat in bash and zsh)
Change-Id: I9716a8d77aefdf05da8923deb9e37e0b6132b549
2019-10-03 15:15:37 -07:00
Guillaume Chelfi
ce000fdc4d Fix zsh compatibility issue in build/envsetup.sh
Arrays are zero indexed in bash and one indexed in zsh by default. This
leads to an off-by-one issue in the `godir` and `choosevariant` commands: when
prompted to chose an option, in order to pick option "n" you have to input
"n+1".

In those two specific instances, by using "substring expansion" instead of
array indexing, one can get consistent behaviour between bash and zsh
(equivalent to zero indexing).

Test: manual -
 # godir
 $ zsh
 $ source build/envsetup.sh
 $ godir SurfaceFlinger # There should be many options
 # Pick 1, check that you end up in the right location
 $ godir SurfaceFlinger.cpp # There should be only one possibility
 # make sure you end up in the right location
 # repeat with bash (to ensure compatibility is not broken)

 # choosevariant
 $ zsh
 $ source build/envsetup.h
 $ choosevariant # pick whatever variant you want
 $ printconfig # make sure the variant matches your choice
 # repeat with bash (to ensure compatibility is not broken)

Change-Id: I998d8fb48b708066b6db28a2129a2b09785fb0b1
2019-10-03 12:02:46 +02:00
Steven Moreland
115d1f58d7 Update SANITIZE_HOST documentation.
Should be set to 'address' not 'true'.

Bug: N/A
Test: `hmm`
Change-Id: I29c0105f0b29c51a6e3d7ce75756d7d25b7fc7e7
2019-09-27 19:20:33 +00:00
Steven Moreland
8f0a62ab3f Detect leaks on host by default.
Right now, leaks are disabled globally on host. This is problematic
because:
a). people write leaks in new code
b). if we fix leaks in old code, it doesn't get tested
c). fixing leaks in old code is harder because when we set
    ASAN_OPTIONS="" locally, other targets start hitting errors,
    and we have to set __asan_default_options there

Fixes: 141313466
Test: host ASAN build passes
Change-Id: I89298c7518c016e6a30884c75d7b791db16a5217
2019-09-24 18:28:39 -07:00
Colin Cross
cb8337ddcb Gather lunch choices before printing prompt
Get the lunch choices before starting to print the lunch menu prompt
so that it doesn't sit at `Lunch menu... pick a combo:` with no
choices for a few seconds.

Fixes: 138719635
Test: lunch
Change-Id: I2bb373ec037bff0ab1d7e4f5ff8a8bd3b57f3263
2019-09-23 12:52:32 -07:00
Jeff Sharkey
f17cddfa5b Add "owngrep" shell utility.
Bug: 132612223
Test: manual
Change-Id: Ibe27e419caaf4ebcbb5d48ab50cc71730c320e1c
2019-08-21 13:55:52 -06:00
Jim Tang
c4dba1d56e Filter out VENDOR_PYTHONPATH from PYTHONPATH in aosp.
Currently when switching between internal to aosp, PYTHONPATH will be
contaminated. This CL is to ensure PYTHONPATH will be as clean as
opening a new terminal and source/lunch.

Bug: 121106770

Test: internal:
$ source build/envsetup.sh; lunch; echo $PYTHONPATH| sed 's/:/\n/g'
will see VENDOR_PYTHONPATH in PYTHONPATH.

switch to aosp:
$ source build/envsetup.sh; lunch; echo $PYTHONPATH| sed 's/:/\n/g'
won't see VENDOR_PYTHONPATH in PYTHONPATH.

Change-Id: Id1916673000ee3fad55e9611d0c47cc80de86645
2019-08-06 09:17:24 +08:00
Ryan Prichard
8426a19969 envsetup: avoid adding "::" (the cwd) to the PATH
Fix this error:

    rprichard@cashew:/x/aosp/out/target/product/walleye/system/bin$ ls
    bash: ./ls: cannot execute binary file: Exec format error

Bug: none
Test: lunch a target, "echo $PATH | grep ::"
Test: lunch an arm target, cd $OUT/system/bin, ls (
Change-Id: I2c0d5ece85964dffa14d6ac8df168dd4e733162e
2019-07-15 18:16:35 -07:00
Patrice Arruda
fa7204b0e1 Revert "Revert "Deprecate bash m* commands and use the soong's modules-in* build commands instead.""
This reverts commit c4dae4d7ab.

Reason for revert: Fix available: go/aog/987391

Change-Id: I0a6cd679699488da716c30b95c62af89b6aa4f1a
2019-06-20 23:40:33 +00:00
Patrice Arruda
c4dae4d7ab Revert "Deprecate bash m* commands and use the soong's modules-in* build commands instead."
This reverts commit 610b6302cf.

Reason for revert: m mlibc from root dir works. Create a tmp dir and then cd in to tmp. Run the same command and it fails.

Change-Id: I0f0c056d7e668da621ae99d347a055ecdf2dec07
2019-06-20 22:32:46 +00:00
Patrice Arruda
610b6302cf Deprecate bash m* commands and use the soong's modules-in* build commands instead.
The functionality of m* envsetup.sh commands has been implemented in
soong_ui. The bash functionality of m* commands can be replaced by
soong's modules-in* build commands.

Fixes: b/130049705
Test: * Loaded the envsetup.sh on a new environment
      * Executed each m* command.
      * Verified with "type <build command>" to make sure
        the function generation is correct.
      * Ran on Darwin environment.

Change-Id: I8792e4f1f1727aba2ca6ee4bdfe657f6ac42302a
2019-06-19 14:16:38 -07:00
Yi Kong
dfd00b1ba1 Add LLVM binutils prebuilds in PATH
Test: lunch; manually examine $PATH
Bug: 133170927
Change-Id: Iceb0add1bfde052acf547402f8d932b87cdf0a2d
2019-05-22 23:36:53 -07:00
Jaewoong Jung
892d0fe1dd Update hmm text for mgrep.
mgrep also scans *.bp files.

Test: hmm
Change-Id: Ie7bf79d42958b269f4d2fb55d7728a22a52bf908
2019-05-04 10:06:28 -07:00
Treehugger Robot
0201a19ba8 Merge "Add Asuite prebuilds in PATH and remove functions." 2019-02-20 04:51:03 +00:00
Dan Willemsen
d855a72ebe Support loading only approved vendorsetup.sh files
Very few vendorsetup.sh files are needed anymore, since add_lunch_combo
has been deprecated. So add a way so that only approved vendorsetup.sh
files can be loaded into the shell, and others will be skipped.

This further limits the amount of code that can run outside the build
sandbox, and makes this list more visible to tree maintainers before
they're used instead of after.

Test: no allowed-vendorsetup_sh-files
Test: empty allowed-vendorsetup_sh-files
Test: one file in allowed-vendorsetup_sh-files
Test: two files in allowed-vendorsetup_sh-files
Test: non-present file in allowed-vendorsetup_sh-files
Change-Id: Ia23d1c9d11a7295d5be5abd10cf56edbdec80483
2019-02-12 15:52:36 -08:00
Dan Willemsen
5436c7e583 Obsolete add_lunch_combo
Bug: 77599627
Test: source build/envsetup.sh with add_lunch_combo calls in bash & zsh
Change-Id: If12b41d8f9a2f56efdb64ad0dccc25a1e342fdd1
2019-02-11 21:36:25 -08:00
Jim Tang
b3fda301c2 Add Asuite prebuilds in PATH and remove functions.
Remove atest/acloud/aidegen functions and append prebuilt path
in PATH. Use local built by default; if there is no local built,
use the prebuilt one instead.

Bug:

Test: $ source build/envsetup.sh; lunch
      $ echo $PATH|sed 's/:/\n/g' | egrep "out|asuite"
      # will see out/host prioritises prebuilts/asuite.

Change-Id: I1e5869bcb81cf7058cf8971f480a47d2c8f8b6f0
2019-02-12 11:29:28 +08:00
Chen Xu
aaf8cdf59d Merge "Revert "Add Asuite prebuilds in PATH and remove functions."" 2019-02-08 21:58:33 +00:00
Chen Xu
a1cc558cdd Revert "Add Asuite prebuilds in PATH and remove functions."
This reverts commit dda51d42da.

Reason for revert: This change caused AOSP build breakage on NDK

Change-Id: I27973e8e0f08e5d71a405208ae4a6a855c751932
2019-02-08 21:52:59 +00:00
Treehugger Robot
fc58ed2fb7 Merge "Add Asuite prebuilds in PATH and remove functions." 2019-02-08 20:56:37 +00:00
Anton Hansson
ece9c48e4d Tab completion for the croot function
Test: bash 3.2
Test: bash 4.4
Change-Id: Ie35ea05c4dd5ea246c005559bb5f36a9c05ef7c4
2019-02-08 08:24:26 +00:00
Sasha Smundak
9f27cc0af5 Provide an option to reduce build verbosity
If ANDROID_QUIET_BUILD environment variable is set, do not print
build timing and colorized summary result.

Test: treehugger
Change-Id: I7ae3f8eb407df470837560706f06e5785911828c
2019-01-31 13:30:26 -08:00
Rett Berg
78d1c93e12 add pathmod to envsetup.sh for making finding paths to modules easier
Change-Id: Ice1f2ff6d46a61bca5a4ddc1163af36c89947822
Test: gomod vsoc_lib && pwd
Test: pathmod vsoc_lib
Test: pathmod foobar  # get error message
Test: gomod foobar    # get error message, directory doesn't change
2019-01-30 12:47:13 -08:00
Jim Tang
dda51d42da Add Asuite prebuilds in PATH and remove functions.
Remove atest/acloud/aidegen functions and append prebuilt path
in PATH. Use local built by default; if there is no local built,
use the prebuilt one instead.

Bug:

Test: $ source build/envsetup.sh; lunch
      $ echo $PATH|sed 's/:/\n/g' | egrep "out|asuite"
      # will see out/host prioritises prebuilts/asuite.

Change-Id: I16c3e85c195b878d3c629149afbd96636ed1f0e1
2019-01-17 14:44:31 +08:00
Kevin Cheng
f0497e4e51 Update acloud alias to support mac via workaround in go/acloud-mac.
Bug: 113557161
Test: acloud on mac, (m acloud and running prebuilt)
Change-Id: Iee6abb6751e8b265dfffdf9c425f073443db2531
2019-01-11 11:00:29 -08:00
Jaewoong Jung
66b9774525 Merge "Improve mmm behavior when targets are specified." 2019-01-03 18:18:35 +00:00
Jaewoong Jung
b6112cdcc5 Improve mmm behavior when targets are specified.
When target directories are specified, mmm now scans their parent
direcotries to when searching for build config files. Also make it look
more like mm as minor refactoring.

Bug: 62899341
Test: Manual builds.
Change-Id: Ic9c081090e1baeb0849508e9086f2976b108c0ee
2019-01-02 14:19:40 -08:00
Jim Tang
22f4c322d6 Prevent PYTHONPATH from accumulatively growing.
After running "lunch" multiple times, the global variable
PYTHONPATH grows larger and larger with repetively content.
This patch is to prevent PYTHONPATH from prepending redundant path.

Bug: b/121110600

Test: $ source build/envsetup.sh && lunch
      $ echo $PYTHONPATH | sed 's/:/\n/g'
      $ lunch; lunch
      $ echo $PYTHONPATH | sed 's/:/\n/g' # not growing.

Change-Id: Ifc36d071fb63bb1494bb0a94fdff477a41708c74
2018-12-22 11:19:40 +08:00
dimitry
73b8481edf Rename _complete-android-module-names
A function name with dashes is apparently not universally recognized
by shell versions/variants(?). Using underscore in place of dashes
solves this problem.

Test: ./development/vndk/tools/header-checker/utils/create_reference_dumps.py -l libGLESv1_CM
Change-Id: Id7d701600760140dae9e4762a11f4abd64947d10
2018-12-11 18:06:00 +01:00
Treehugger Robot
4ea66801b2 Merge "Add functions to jump to specific modules." 2018-12-07 20:47:40 +00:00
Steven Moreland
62054a43fa Add functions to jump to specific modules.
Usage:
...aosp/$ gomod libbase
...aosp/system/core/base$

Using in alias:
alias g=gomod
complete -F _complete-android-module-names g

...aosp/$ g libbase
...aosp/system/core/base$

Nothing in Android keeps an up to date index of all Android modules
and their locations between builds. However, there is a target
'module-info.json' which is used to contain some of that information.
This module can be updated using the command 'refreshmod' added
here, but it will also be updated during a normal Android build.

This also adds auto-complete for m.

Bug: N/A
Test: manual
Change-Id: I06b0b87c308b9fe2798dbc29225906cc30fe59fe
2018-12-06 18:28:50 -08:00
patricktu
345c9ae44f AIDEGen: Adopt prebuilt mechanism to bypass 'm aidegen'.
Bug: 119642842
Test: m clean;aidegen tradefed
Change-Id: Ib25591de77762ffdcc72ea4a064a50cfb3e5015e
2018-11-29 15:25:40 +08:00
Elliott Hughes
d3e472569a envsetup.sh: say -p for plain, not -ps.
toybox xxd treats -ps as -p -s with a missing argument to -s, rather
than as a bizarre synonym for -p.

Test: manual
Change-Id: Ia576861588a4ddeac9885bce8d718929b74f31b1
2018-11-15 16:32:14 -08:00
Treehugger Robot
4c969fa22a Merge "Add atest shortcut in envsetup.sh." 2018-11-14 10:58:18 +00:00
Aurelio Jargas
67edd15196 Add .hpp files to sgrep and treegrep
There are plenty of .hpp files in the AOSP sources.

    $ find . -name \*.hpp | wc -l
    2430

They were already grepped in cgrep(), but were missing in
sgrep and treegrep.

Test: manual - run the script

Change-Id: I1fb3f576f6cdcc2b492e2beadf11ced98cb3938e
2018-11-06 17:36:46 +01:00
Jim Tang
f258e7e424 Add atest shortcut in envsetup.sh.
Atest will run in the sequence of built -> prebuilt -> source code.

Bug: b/118801769

Test: source build/envsetup.sh; lunch
     and atest will run in the appearing sequence above.
Change-Id: I0494aeab99c390c31bb02641c6c1c11afd5642a2
2018-11-06 13:41:01 +08:00
Patrik Fimml
df248e60e5 Don't override zsh users' compinit options.
I call "compinit -i" in my .zshrc, to allow loading autocompletion from
"unsafe" locations. envsetup.sh breaks that. Change behavior to only
call compinit if bash-style completion is not already enabled.

This is a minimal fix; an alternative would be to rely on the user
to call 'bashcompinit' in their .zshrc instead, and just skip all
autocomplete functionality if they don't.

Test: manual - source ./envsetup.sh in {bash, zsh, zsh -f} and test
	completion for lunch
Change-Id: Ibb10eb68a96d69c19b9db9b21e0546fe8ae299b2
2018-10-16 13:36:23 +02:00
Kevin Cheng
bf89aff251 Add acloud shortcut in envsetup.sh
Bug: None
Test: source envsetup.sh and ran acloud successfully.
Change-Id: Ie75c2a6ea002fe3d909afd1760f4ab05c7c94a26
2018-10-08 16:23:40 -07:00
Jim Tang
0e3397b225 Envsetup: Fix lunch choice with number in zsh
(zsh)$ source build/envsetup.sh; lunch 23
will result in selecting #22 because array in zsh starts from 1
instead of 0. This CL is to fix this issue.

Bug: b/117202855
Test: below commands should have the same output:
    (zsh)$ source build/envsetup.sh; lunch 23
    (zsh)$ source build/envsetup.sh; lunch aosp_walleye-userdebug

Change-Id: I0570585417878bc7c73eda0e1a416232fe147fb4
2018-10-03 18:35:37 +08:00
Jim Tang
a881a257ca Add Atest tab completion script.
Now Atest can autocomplete module names, dir and filenames with
tab completion, and zsh users can benefit from it.

Bug: 110629292
Test: In both bash and zsh environments:
    source build/envsetup.sh && lunch aosp_arm-eng
    atest <tab><tab>  # has candidates
    adb <tab><tab>    # has candidates
    ENVSETUP_NO_COMPLETION=atest:adb . build/envsetup.sh && lunch aosp_arm-eng
    atest <tab><tab>  # no candidates
    adb <tab><tab>    # no candidates

Change-Id: Ib1c9e02feeb8aaf75c0b97821ae26e13ba8df350
2018-07-17 14:27:32 +08:00
Makoto Onuki
da97106284 Envsetup: Add way to skip installing completions
Skip installing completion if ENVSETUP_NO_COMPLETIONS is set to 1.

Test: Following command with debug log added:
$ ENVSETUP_NO_COMPLETION=adb:fastboot:bit . build/envsetup.sh -> no completion installed
$ ENVSETUP_NO_COMPLETION=adb . build/envsetup.sh -> adb completion isn't installed
$ ENVSETUP_NO_COMPLETION=a . build/envsetup.sh -> all completions installed
$ ENVSETUP_NO_COMPLETION=fastboot . build/envsetup.sh -> fastboot completion isn't installed

Change-Id: I9f907585a1d2413f55ffcb6c7c01e49d1b55a3e0
2018-06-18 15:35:40 -07:00
Treehugger Robot
b6a2565382 Merge "Move pid, stacks from envsetup.sh to dedicated scripts." 2018-06-15 15:43:37 +00:00