Commit graph

694 commits

Author SHA1 Message Date
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
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
Treehugger Robot
4f22abd334 Merge "Fix stacks for Java processes." 2018-06-15 00:31:07 +00:00
Josh Gao
896a546663 Move pid, stacks from envsetup.sh to dedicated scripts.
Make it so that these can be used in other scripts by moving them from
functions defined in envsetup.sh to standalone scripts.

Test: stacks zygote64
Change-Id: Id8e5ce5b4da80e57f4226eb34edaf82b87393834
2018-06-14 16:36:56 -07:00
Josh Gao
ab1e09a6b0 Fix stacks for Java processes.
Fix stacks for the change in ANR trace location by using `debuggerd -j`
instead of manually fetching the traces file.

Also, dump zygote/zygote64 as native processes, since they don't
respond to SIGQUIT.

Test: stacks zygote
Test: stacks adbd
Test: stacks com.android.settings
Change-Id: I015458bdc2dd45624940204d42614365aacf8304
2018-06-14 15:35:53 -07:00
Steven Moreland
3b99ecfbab mma in dirs w/o Android.(mk|bp) in ancestor dir
Many Android.bp files are now no longer needed (since they
are all scanned and subdirs are deprecated), so there are many
places in a tree where they aren't hit.

This still suffers from one bug, given this directory structure:
 A/B/Android.bp
 A/B/C/D/Android.bp
 A/B/C/
 A/B/C/E/Android.bp

if you call 'mma' from 'A/B/C', then it will make
MODULES-IN-A-B.

However, for now, this change makes it so given the following
directory structure:
 A/B/C/D/Android.bp
 A/B/C/
 A/B/C/E/Android.bp

if you call 'mma' from 'A/B/C', then it will make
MODULES-IN-A-B-C as expected (since there are no makefiles in
parent directories). This is the expected behavior in this case
and it is common in directories where Android.bps have been
removed (since they only referenced subdirs) or outside of
git projects.

The reason why this usecase is supported is so that given this:
A/B/C/D/Android.bp
A/B/C/D/include/D/foo.h

You can, from A/B/C/D/include/D/ (for instance) do an mma, and
it will still make the modules defined in A/B/C/D/ which are
presumably related to this.

This change doesn't fix mm or other binaries. In the long term,
either we should just consider mma to make the current directory
(and not look for parent directories for the above 'feature') or
we should move more of the complexity in the build system itself
so that it can intelligently find the first parent directory
which contains a makefile in a subdirectory.

Fixes: 65407300
Test: mma from following dirs
    system/tools/hidl/test/hash_test/bad/hash/1.0 MODULES-IN-system-tools-hidl-test-hash_test
    system/tools/hidl/test/hash_test/             MODULES-IN-system-tools-hidl-test-hash_test
    system/                                       MODULES-IN-system
    hardware/ril/                                 MODULES-IN-hardware-ril

Change-Id: I072d3f382d40cd360ec3d14f8f5b060a4bde9289
2018-06-13 15:34:19 -07:00
Elliott Hughes
2f9152618f Stop being noisy about including the bash completions.
Now most of the other noise is gone, we should probably quiet down too.

Bug: N/A
Test: `source build/envsetup.sh`
Change-Id: Ic5b169b1771163488e70d732276372efbf304bae
2018-05-04 13:21:16 -07:00
Ng Zhi An
cd2b3869f8 Remove settitle
settitle always had a bug in the PROMPT_COMMAND, it used "\033]0;",
where it should be "\033[0m". It was opt-in, and changed to opt-out, and
no one really complained that it didn't work. So we are just going to
remove this.

References:
- http://www.termsys.demon.co.uk/vtansi.htm
- https://en.wikipedia.org/wiki/ANSI_escape_code

Test: lunch and see no change in prompt
Change-Id: I777c87b4d8e80c0e9437e5d2628f6df020883389
2018-05-04 08:21:22 -07:00
Dan Willemsen
af2e1f8487 Start moving add_lunch_combo to Make
Start deprecating add_lunch_combo, preferring a list of common choices
in each AndroidProducts.mk file.

This list will be validated so that we don't have typos:

https://android-review.git.corp.google.com/c/device/generic/car/+/619533

Or targets that no longer exist.

Bug: 77599627
Test: lunch
Test: lunch 34
Test: lunch aosp_x86_64-eng
Test: lunch aosp_<tab>
Change-Id: Ie0ddaa94cbd6cee26584f56f1706a8ec1333f87e
2018-04-04 17:14:47 -07:00
Elliott Hughes
ce18dd448f Move adb/fastboot bash completion to their projects.
Bug: http://b/74443706
Test: bash completion still works
Change-Id: I21e6407f5114b438f5548be259a65d903ea73b62
2018-04-03 13:49:48 -07:00
Chih-Hung Hsieh
7ed0db8d1d Remove core/clang/versions.mk and scan-build wrapper
* Use the definitions of ClangDefaultBase and ClangDefaultVersion
  in build/soong/cc/config/global.go.
* scan-build is too old;
  replaced by better clang-tidy's -clang-analyzer-* checks.
* WITH_STATIC_ANALYZER is still effective
  to invoke ccc-analyzer or c++-analyzer.

Test: make checkbuild
Change-Id: Ifd159dd28e529d5d3c9807f5e391911365da8cdb
2018-02-15 13:38:50 -08:00
Treehugger Robot
c10bd0d859 Merge "envsetup.sh: don't assume 'cd' is builtin" 2018-01-11 03:52:46 +00:00
Dan Willemsen
dd3a27394f Remove armv5te
This architecture only existed for unbundled use, but even the NDK is
removing support in their r17 release, so just remove support for it.

Test: build/soong/build_test.bash -only-config
Test: check buildserver configs, I don't see anything still using armv5
Change-Id: Ic183b510c9ada94438bd4cc2b9362fa438a29ced
2018-01-08 15:26:16 -08:00
Steven Moreland
0540296e9f envsetup.sh: don't assume 'cd' is builtin
Some parts of envsetup.sh aren't very happy with things like
this:
function cd() {
    builtin cd "$@" && pwd && ls -l
}

here, I have s/cd/builtin cd/ one such case where envsetup
is trying to execute the output of cd.

Test: manual
Change-Id: I2774481dfbd958410682a4f773f1b8f12a0080aa
2018-01-05 20:15:36 +00:00
Elliott Hughes
7a6ef87cbe Get off my lawn forever!
Let folks opt in if they want the custom title.

Bug: https://issuetracker.google.com/38402256
Test: hitting enter no longer flashes this title
Change-Id: I8c1e1b22cc47ab9496797328fb1b13c0827840b0
2017-12-07 13:51:23 -08:00
Torne (Richard Coles)
129ab63392 resolve merge conflicts of 0c8b471be3 to stage-aosp-master
Test: I solemnly swear I tested this conflict resolution.
Change-Id: I81ec8e0660100eabdc0664cfc37198e95be95ae2
2017-10-23 11:41:58 -04:00
Treehugger Robot
0c8b471be3 Merge "Don't add empty entry to PATH." 2017-10-23 15:02:24 +00:00
Colin Cross
bce301801f Merge "Update references to build/core to build/make/core"
am: 6db8597174

Change-Id: I4be5bc1805d1900991966d24fda15f2705ee248d
2017-10-20 23:49:17 +00:00
Colin Cross
6db8597174 Merge "Update references to build/core to build/make/core" 2017-10-20 23:41:12 +00:00
Colin Cross
6cdc5d20f3 Update references to build/core to build/make/core
sed -i -e 's"\([^/]\)build/core"\1build/make/core"g' $(git grep -l build/core)

Test: m checkbuild
Change-Id: Idf3a2fed79aee5d2c07bd8e42f0c0660f253ddc2
2017-10-20 12:49:28 -07:00
Jeff Gaston
d58fb067a5 Merge "Support 'tapas help' for more-detailed tapas help"
am: 4f7fd556ae

Change-Id: I040a51338678883e42361bfdfd147554e77ba094
2017-10-19 22:20:10 +00:00
Treehugger Robot
4f7fd556ae Merge "Support 'tapas help' for more-detailed tapas help" 2017-10-19 22:12:05 +00:00
Dan Willemsen
114bf62d39 Merge "Switch envsetup.sh dumpvars to soong_ui"
am: 2023783f4f

Change-Id: I060c886c8d52a339969e43469dae5cce8cd9e198
2017-10-18 01:04:45 +00:00
Dan Willemsen
af88c41795 Switch envsetup.sh dumpvars to soong_ui
Use soong_ui instead of make&config.mk directly. This way we use a
consistent make parser and sandboxing configurations.

Test: printconfig
Test: get_build_var TARGET_DEVICE
Test: get_abs_build_var PRODUCT_OUT
Test: get_abs_build_var ALL_PRODUCTS
Test: lunch aosp_marlin-userdebug
Test: build_build_var_cache; set | grep var_cache (diff before/after)
Change-Id: I22abdf95669b7a4fb8162377e013a9013155f249
2017-10-17 13:13:30 -07:00
Torne (Richard Coles)
0091bae1ad Don't add empty entry to PATH.
When ANDROID_TOOLCHAIN_2ND_ARCH is unset (all arches except ARM64) the
PATH was being extended with an empty entry, which is interpreted as the
current directory (rarely desirable).

Test: lunch aosp_arm-eng; echo $PATH; lunch aosp_arm64-eng; echo $PATH
Change-Id: I31661241c10b06165dcf555c8b3e799fe54cc0dc
2017-10-04 12:58:30 -04:00
Jeff Gaston
9fb05d8c9f Support 'tapas help' for more-detailed tapas help
Bug: 64844028
Test: tapas help
Change-Id: I5629ca781e8cacfa6bb09828acf4160bbca3c3a5
2017-09-11 15:03:50 -07:00
Simran Basi
97053a075c Merge "Add shortcut to atest after envsetup.sh is sourced."
am: 6417aa89e4

Change-Id: Ib6ce6fa0aa878cd3bd552979fcef1a2d8c284e86
2017-08-25 18:50:32 +00:00
Simran Basi
424b876778 Add shortcut to atest after envsetup.sh is sourced.
Bug: None
Test: On master, atest points to atest in tradefed.
Change-Id: Iad6e48a12c4180f77b483cadd4c316820ede87cd
2017-08-23 12:05:36 -07:00
Jeff Gaston
d28e18c2b4 Merge "Consolidate build system usage documentation into source control" am: ea98ab2d3c am: 0f4e0a981e
am: 0339379733

Change-Id: I29e6b47a92e35344b36b28632893b16dafd46edc
2017-08-09 22:52:24 +00:00
Jeff Gaston
0f4e0a981e Merge "Consolidate build system usage documentation into source control"
am: ea98ab2d3c

Change-Id: I1a8a6189f8ae791329c7da87e78b67e8c46e20d7
2017-08-09 22:30:38 +00:00
Jeff Gaston
c6dfc4e95a Consolidate build system usage documentation into source control
Bug: 62201421

Test: make help
Change-Id: I7a7c917f767590657761396dd0545224ff98f27b
2017-08-09 12:58:30 -07:00
Dan Willemsen
f7b6dc8b24 Merge "Continue using the real make if -C is used" am: 218a0c0c70 am: 56a2bb9ec9
am: 4a1a1fc21d

Change-Id: I726a8cf5bde267b8ef881972f19f601c405e827f
2017-07-29 08:24:23 +00:00
Dan Willemsen
56a2bb9ec9 Merge "Continue using the real make if -C is used"
am: 218a0c0c70

Change-Id: I8239d2bbf96fd9d2d99a05592ce4770e18ac4187
2017-07-29 08:18:52 +00:00
Dan Willemsen
e984224899 Continue using the real make if -C is used
To allow building other make-based systems from the top of the android
tree.

Bug: 64145979
Test: get_make_command
Test: get_make_command -C
Test: get_make_command -C.
Test: get_make_command -C .
Test: get_make_command -j test
Test: get_make_command test-C
Test: get_make_command " -C"
Test: make
Test: make -C.
Change-Id: I406dd2706f19e5d2a6afdff441335f4e01ba6d12
2017-07-28 21:08:12 +00:00
Colin Cross
19bd3427d0 Merge "Use java prebuilts" am: 45d2ef40f2 am: d35fe2c55e
am: 1589539f10

Change-Id: Ie701576175eef2469de22e68623a6914ca20239d
2017-07-25 00:52:37 +00:00
Colin Cross
d35fe2c55e Merge "Use java prebuilts"
am: 45d2ef40f2

Change-Id: Icb9e7cd6ad37a5ff37fb72d12a058be79dbabf68
2017-07-25 00:47:17 +00:00
Colin Cross
e97e69359a Use java prebuilts
Point the make java variables at JDK prebuilts in
prebuilts/jdk/jdk8, add them to the path, and clean up
some old overrides.

Reapplies Ibbeb30fab96e45aedd5bb6d710d1170f85789982 after updating
some more manifests to include the prebuilts.

Bug: 62956999
Test: m -j checkbuild
Change-Id: I9e27aa5cb04d1ed09e43b798e5d654843afc000f
(cherry picked from commit 1931750940)
2017-07-20 15:14:26 +00:00
Colin Cross
f2da657628 Merge "Revert "Use java prebuilts"" am: 4d69df5191 am: f4e78ccf25
am: 96018b3d10

Change-Id: Ib54b8c0fbb95179bff97abe028d133da3528380f
2017-07-19 22:58:23 +00:00
Colin Cross
f4e78ccf25 Merge "Revert "Use java prebuilts""
am: 4d69df5191

Change-Id: I978bf3d25e0be2a2a6b40c5b396821cc2a8d9365
2017-07-19 22:52:21 +00:00
Colin Cross
02112900cc Revert "Use java prebuilts"
This reverts commit 1931750940.

Change-Id: I7a99fd6c53d35a2a674f2d60b113a727f3c453ce
2017-07-19 22:42:46 +00:00
Colin Cross
1a05e52e6d Merge "Merge "Use java prebuilts" am: 26e1b6d6c2 am: fcbaa25380" into oc-dev-plus-aosp
am: 7b38914e4e

Change-Id: I61313e8009c964868cf4984a7f86811748e98819
2017-07-19 22:19:03 +00:00
Colin Cross
fcbaa25380 Merge "Use java prebuilts"
am: 26e1b6d6c2

Change-Id: If761856f9fd509d2c5694844b6bb10966717e0b1
2017-07-19 22:13:09 +00:00
Colin Cross
1931750940 Use java prebuilts
Point the make java variables at JDK prebuilts in
prebuilts/jdk/jdk8, add them to the path, and clean up
some old overrides.

Bug: 62956999
Test: m -j checkbuild
Change-Id: Ibbeb30fab96e45aedd5bb6d710d1170f85789982
2017-07-14 14:18:53 -07:00
Dan Willemsen
4d62a6bfde Merge "Stop using make wrapper around soong_ui" am: 80c05c518b am: 757926d509
am: f734d09753

Change-Id: I1ab7eba7edab3f19af08fc4ed4ec7887347c3c9e
2017-07-13 21:49:25 +00:00
Dan Willemsen
757926d509 Merge "Stop using make wrapper around soong_ui"
am: 80c05c518b

Change-Id: I74b69fd1c6f6fd2a9feb9807770577b523656fb8
2017-07-13 21:41:26 +00:00
Dan Willemsen
d41ec5a3bc Stop using make wrapper around soong_ui
Instead of running make -> makeparallel -> soong_ui, just run soong_ui.
Soong_ui now handles user-facing argument parsing.

The user visible changes should only be:
* Most `make` command line options are no longer supported. Many didn't
do anything useful before this change either.
* `-j` is now implied, so not specifying it will default to full
parallelism instead of a single-threaded build.
* `make` debug messages are removed:
  make: Entering directory ...
  make: Leaving directory ...
  make: *** [run_soong_ui] Error 1

We still support the make workflow for users that don't use envsetup.sh
-- the build servers primarily, but also various helper scripts. These
will be converted later.

Test: in $TOP; make nothing
Test: in $TOP/bionic; make (runs real make, fails w/no makefile)
Test: in $TOP; m nothing
Test: in $TOP; mm nothing
Test: in $TOP; mma nothing
Test: in bionic/libc; m nothing
Test: in bionic/libc; mm
Test: in bionic/libc; mma
Test: in $TOP; mmm bionic/libc
Test: in $TOP; mmma bionic/libc
Test: in bionic; mmm libc
Test: in bionic; mmma libc
Test: set WITH_STATIC_ANALYZER=1, repeat above
Change-Id: Ic00190ac65a6aa924dad35d3d540c11d653b9c53
2017-07-12 17:16:49 -07:00
David Gross
832b31512b Merge "Teach mgrep to find soong/*.go files." am: 46d9bf8f9a am: bb67e3ae54 am: f515b91b3f
am: d5b0f9abe6

Change-Id: I1ea056d5997e31791153aafd149412a5e75953ce
2017-05-18 18:29:40 +00:00
David Gross
d5b0f9abe6 Merge "Teach mgrep to find soong/*.go files." am: 46d9bf8f9a am: bb67e3ae54
am: f515b91b3f

Change-Id: Idfa23df410e92a6afa7953cceb2286b3b994bbee
2017-05-18 18:25:39 +00:00
David Gross
d1d6fc5cff Teach mgrep to find soong/*.go files.
Test: $ cd $ANDROID_BUILD_TOP
      $ mgrep FORCE_BUILD_LLVM_DEBUG
      ./external/llvm/llvm-host-build.mk:24:ifeq ($(FORCE_BUILD_LLVM_DEBUG),true)
      ./external/llvm/soong/llvm.go:44:       if ctx.AConfig().IsEnvTrue("FORCE_BUILD_LLVM_DEBUG") {
      $ cd external/llvm
      $ mgrep FORCE_BUILD_LLVM_DEBUG
      ./llvm-host-build.mk:24:ifeq ($(FORCE_BUILD_LLVM_DEBUG),true)
      ./soong/llvm.go:44:     if ctx.AConfig().IsEnvTrue("FORCE_BUILD_LLVM_DEBUG") {

Change-Id: Ibe114550a8022d792a0c10c766c964a67721a6ba
2017-05-10 10:49:44 -07:00
Colin Cross
49718f9b85 Merge "Only set TARGET_PLATFORM version in lunch when explicitly requested" am: 4a3dc1458f am: 624932e360
am: 6969203720

Change-Id: I84652622424ec1abe317b847d5fe00962aeb5853
2017-05-03 04:49:16 +00:00
Colin Cross
1c1e142199 Only set TARGET_PLATFORM version in lunch when explicitly requested
Setting TARGET_PLATFORM_VERSION to DEFAULT_PLATFORM_VERSION during
"lunch sailfish-userdebug" causes unnecessary pain when
DEFAULT_PLATFORM_VERSION becomes invalid after branching.  Only
set TARGET_PLATFORM_VERSION if it was explicitly requested with
lunch sailfish-userdebug-OPR1.

Test: build/make/tests/envsetup_tests.sh
Bug: 34972208
Bug: 37208937
Change-Id: I40ba4617e73803c5bec1a8d317382f70fb3ec3a2
Merged-In: I40ba4617e73803c5bec1a8d317382f70fb3ec3a2
2017-05-03 02:47:59 +00:00
Colin Cross
b105e365c7 Only set TARGET_PLATFORM version in lunch when explicitly requested
Setting TARGET_PLATFORM_VERSION to DEFAULT_PLATFORM_VERSION during
"lunch sailfish-userdebug" causes unnecessary pain when
DEFAULT_PLATFORM_VERSION becomes invalid after branching.  Only
set TARGET_PLATFORM_VERSION if it was explicitly requested with
lunch sailfish-userdebug-OPR1.

Test: build/make/tests/envsetup_tests.sh
Bug: 34972208
Bug: 37208937
Change-Id: I40ba4617e73803c5bec1a8d317382f70fb3ec3a2
2017-05-01 14:26:40 -07:00
Yueyao Zhu
efc786a82b Add dtc and libufdt prebuilts to dev path
Test: . build/envsetup.sh and lunch
Bug: 37099957
Change-Id: I26e0b78a18ea4b3acdfb4cc64309ace327d29933
2017-04-07 14:18:07 -07:00
Christopher Ferris
36a570f7e0 Merge "Small fixes for environment variables." am: fd0cb496b1 am: 37f3a728a0
am: 7eb7796868

Change-Id: Iafed66e19bc114552b0261dd299379dbb37873c6
2017-03-24 16:23:45 +00:00
Christopher Ferris
fd0cb496b1 Merge "Small fixes for environment variables." 2017-03-24 16:15:07 +00:00
Colin Cross
1b81278572 Merge "Add TARGET_PLATFORM_VERSION to lunch" am: a007142381 am: 7b5dc8ad3e
am: 086d109f35

Change-Id: If005f3917b1f1664b111ce7d070590a47a259ce5
2017-03-24 00:27:16 +00:00
Christopher Ferris
55257d2b78 Small fixes for environment variables.
Fix all of the leaking of local variables by marking locals properly.

Fix a case where ANDROID_TOOLCHAIN_2ND_ARCH is set incorrectly.

Test: lunch'd aosp_angler-userdebug and then aosp_fugu-userdebug
Test: and verified ANDROID_TOOLCHAIN_2ND_ARCH is set properly after
Test: the first lunch and unset after the second lunch.
Test: Also attempt to build the two targets.
Change-Id: I49548e0d6654bfb1105a6ecaf2705825b9ddf3a5
2017-03-23 11:12:04 -07:00
Colin Cross
8873713f36 Add TARGET_PLATFORM_VERSION to lunch
lunch can now take combos in the form:
$TARGET_PRODUCT
$TARGET_PRODUCT-$TARGET_BUILD_VARIANT
$TARGET_PRODUCT-$TARGET_BUILD_VARIANT-$TARGET_PLATFORM_VERSION

If all 3 are not specified the unspecified ones will take the
default values provided by the build system (eng, and currently
OPR1).

In addition, error handling for invalid products, variants and
versions is moved to the build system.

Bug: 34972208
Test: build/make/tests/envsetup_tests.sh
Change-Id: Ib0aaa98633448ba9bd8df911704c9cb3a8ebbe85
2017-03-23 09:44:08 -07:00
Josh Gao
57795ff2a8 Merge "Fix stacks on 64 bit processes." am: aea79fa207 am: d3e865abbe
am: a941b547c0

Change-Id: I37a1e3a3ab37b7f8b35b2951815d6af8c96e0d5f
2017-03-01 21:21:58 +00:00
Josh Gao
310b6ff676 Fix stacks on 64 bit processes.
debuggerd64 doesn't exist anymore, `debuggerd $PID` works on both 32
and 64 bit processes.

Bug: http://b/35872661
Change-Id: I47be05c7ec346e5d657d06e6c3aff1723494639b
2017-03-01 11:34:58 -08:00
Simran Basi
5a5dc1eb39 Merge "Share *_OUT_TESTCASES environment variables with TF" am: 6eeba8f6ec am: 13ced77ea2 am: 78be58d869
am: 2de40b411a

Change-Id: I9c322935a7a8fb8c6a1c15ab0cf92ed17d2fc39f
2017-02-14 01:53:41 +00:00
Simran Basi
dd050ed1b3 Share *_OUT_TESTCASES environment variables with TF
Instead of having test tools search the OUT_DIR for the
testcases folders (of which there can be multiple different
targets), let's have these variables become part of the runtime
environment after a developer has run lunch.

Bug: 35322559
Test: . build/envsetup.sh ; lunch ; printenv | grep TESTCASES
Change-Id: Ic4addc2b9727ff717b2e595b9be224650e2f1b1d
2017-02-13 13:50:14 -08:00
Joe Onorato
c257831705 Merge "Add bit helper utility" 2016-10-21 17:55:42 +00:00
Joe Onorato
002a6c769d Add bit helper utility
- Add it to the base build (the first one in the hierarchy that includes
  the activity manager).
- Add tab completion commands to envsetup.sh

Test: . build/envsetup.sh ; make
Change-Id: Id24acaa0f17f198bda329016ff17170ad93624ec
2016-10-20 16:41:37 -07:00
Wei Wang
79056db4e0 Support Android.bp in mgrep
This patch enabled Android.bp in mgrep result

Bug: 32313127
Test: mgrep
Change-Id: Ie3171a10ab54322bfc3844d1f629c783286ec212
2016-10-20 14:31:05 -07:00
Colin Cross
127fceae06 Walk up tree to find makefiles in mma
Call findmakefile in mma to walk up the tree to find the nearest
makefile.  Fixes mma in subdirectories of directories that have
Android.mk or Android.bp files.

Change-Id: I6fa509171699071fc34a2a75dd7e191d4ddca31a
2016-09-01 15:35:57 -07:00
Colin Cross
4bfae06e71 Canonicalize mmm path
Canonicalize the mmm path relative to the top level before creating the
MODULES-IN-dir target.  Fixes cd frameworks/base; mmm -j .

Test: cd frameworks/base; mmm -j
Change-Id: If7bc321e8a87b76121f876bf4bc296b0f9b80578
2016-08-31 22:00:03 -07:00
Dan Willemsen
9fc9cac0ac Merge "Fix GET-INSTALL-PATH to work with Soong"
am: 6b9aa6938d

Change-Id: I9f433cb383846ec6ccb8e39be4b30110d60d54fd
2016-08-15 21:17:33 +00:00
Dan Willemsen
53e3899222 Fix GET-INSTALL-PATH to work with Soong
This was printing all of the Soong modules in addition to the modules
defined in the ONE_SHOT_MAKEFILE. So replicate what we did with
MODULES-IN-* with GET-INSTALL-PATH-IN-* and update all the users.

Bug: 30191725
Change-Id: Ib1e4bf00f64d7a3e8cd91f44eaf1ff82fdfbf162
2016-08-12 05:10:51 +00:00
Colin Cross
6f8244b62d Merge "Fix mm and mmm in Android.bp directories" am: 8ed91b6624
am: 323396993c

* commit '323396993c6651b4b98974df9e9d53118f27a840':
  Fix mm and mmm in Android.bp directories

Change-Id: I95d6bde7a0ea72b47779f1a5b0577ff423524b6f
2016-05-27 00:29:14 +00:00
Colin Cross
8642525726 Fix mm and mmm in Android.bp directories
mm and mmm were not parsing out/soong/Android.mk, so they were ignoring
all modules defined in an Android.bp file.  Always include
out/soong/Android.mk when ONE_SHOT_MAKEFILE is set, and convert the mm
and mmm functions to build MODULES-IN-$DIR instead of all_modules so
that only the subset of modules defined in out/soong/Android.mk for the
requested directory are built.

Bug: 28986194
Change-Id: I6e1ff8cacfc668a4154a0d5937450db840bb7a6b
2016-05-26 15:56:21 -07:00
Vishwath Mohan
9cdb6f1a31 Merge "Double quote some statements for zsh compatibility" am: 576fd3ebb9
am: 29c2c4db19

* commit '29c2c4db19c6c9f152a1c48aee368a3439cd195f':
  Double quote some statements for zsh compatibility

Change-Id: Id02db06a190370d18e3b7828a453cd16948d77c1
2016-05-23 22:29:50 +00:00
Vishwath Mohan
7d35f001e1 Double quote some statements for zsh compatibility
Two eval commands did not enclose their arguments in double quotes, and
this broke compatibility on zsh - preventing lunch from running to
completion. This CL adds the double quotes and fixes the issue.

Change-Id: I5ed884b455e2e61182f6c29fb807ed92372af039
2016-05-19 12:38:16 -07:00
Keun Soo Yim
46a259651f resolve merge conflicts of 72b82dc to nyc-dev-plus-aosp
Change-Id: I6e62226774584154ad1a802594e386fe7942504b
2016-04-25 15:27:21 -07:00
Keun Soo Yim
3d4847525f build rule change for VTS (vendor test suite)'s metadata files
Change-Id: I76b81529a97b672e08632703d2f6a2777ee8811e
2016-04-25 13:06:57 -07:00
Marie Janssen
32ec50a1f1 make croot slightly more useful
Have croot take an argument of a directory to end up in,
so we can jump around the tree even faster.

Change-Id: Ieb6a8d47fee0412006a11192b29ed44604961312
2016-04-22 16:25:29 -07:00
Chih-Hung Hsieh
a9a55c7c7e Call clang-tidy based on WITH_TIDY* variables.
* Call clang-tidy before every C/C++ compilation if
  (1) clang-tidy is found at $(PATH_TO_CLANG_TIDY)
  (2) $(my_clang) is true
  (3) LOCAL_TIDY is 1 or true, or
      LOCAL_TIDY is undefined and WITH_TIDY is 1 or true.
* clang-tidy is called with -checks=$(my_tidy_checks),
  which has default '-*,google*,-google-readability*'
  and can be overwritten by WITH_TIDY_CHECKS.
* LOCAL_TIDY_CHECKS is appended to $(my_tidy_checks)
* Extra flags are passed to clang-tidy through
  WITH_TIDY_FLAGS or LOCAL_TIDY_FLAGS.
* To quickly find and fix clang-tidy warnings, set $(WITH_TIDY_ONLY)
  to 1 or true to skip compilation of C/C++ files.
* Add a PHONY tidy_only target,
  which includes all $(cpp_objects) and $(c_objects).
* The 'mm' and 'mmm' functions are changed to call make with
  the 'tidy_only' target when WITH_TIDY_ONLY is true or 1.
  In that case, only clang-tidy is called for C and C++ files.

Bug: http://b/27779618
Change-Id: I8adcfff217d68af49849b79aacee7d7654cafb1b
2016-04-21 12:31:13 -07:00
Elliott Hughes
910a355947 Use ulimit -p rather than prlimit.
Neither is standard, but ulimit is toybox and therefore a bit more
regular and at least has help text.

Change-Id: Id7ba9adc9ca256b821d8060506010abef30dee28
2016-03-07 14:05:22 -08:00
Ying Wang
ac9092730e Small fixes.
Change-Id: Ia949ed0bc93edb78d0b029f3bd3dd584e9a00dc8
(cherry-pick from commit f0cb397a9e)
2016-03-04 14:02:25 -08:00
Ying Wang
7dfdb843b2 Speed up lunch/tapas/etc. shell utility functions.
1. Combined ~10 calls to the make build system to only one.
   We added a phony target "dump-many-vars" to the build system to dump
   "<var>=<value>" pairs. We then store the pairs as shell variables.
   With this cache get_build_var/get_abs_build_var can just return
   the shell variables instead of querying the build system.
2. Prune .git when we search for AndroidProduct.mks.

In internal source tree lunch time was reduced from ~15s to ~1.5s.

Bug: 27429759

(cherry picked from commit 08800fd905)

Change-Id: I862a0ec3c1aae97c552054dacec133e857042edf
2016-03-04 14:02:03 -08:00
Ying Wang
f0cb397a9e Small fixes.
Change-Id: Ia949ed0bc93edb78d0b029f3bd3dd584e9a00dc8
2016-03-04 13:56:23 -08:00
Ying Wang
08800fd905 Speed up lunch/tapas/etc. shell utility functions.
1. Combined ~10 calls to the make build system to only one.
   We added a phony target "dump-many-vars" to the build system to dump
   "<var>=<value>" pairs. We then store the pairs as shell variables.
   With this cache get_build_var/get_abs_build_var can just return
   the shell variables instead of querying the build system.
2. Prune .git when we search for AndroidProduct.mks.

In internal source tree lunch time was reduced from ~15s to ~1.5s.

Bug: 27429759
Change-Id: I24e88598f6fab598ef26518885fd5e86e71a772d
2016-03-04 11:01:57 -08:00
Chih-Hung Hsieh
42d5c292d9 Use new clang scan-build script.
The actual clang compiler called for static analysis is decided
by build/core/binary.mk, not the one given to --use-analyzer.

BUG: 13287788
Change-Id: I58105c20b56ce17ddf329a275c750d14284d1e25
2016-02-24 19:18:45 -08:00
Neil Fuller
fcf7c81a7f Revert "Revert "Make OpenJDK 8 the default""
Reapply the JDK 8 switch in internal builds.

This reverts commit 85bddfdedf.
2016-01-25 17:35:57 +00:00
Neil Fuller
1f495b865e Revert "Revert "Make OpenJDK 8 the default""
Reapply the switch to JDK 8 on aosp/master.

This reverts commit 85bddfdedf.

Change-Id: If2e8733ba78b007d37914c0512cd6be1bd4c1e69
2016-01-25 17:12:41 +00:00
Neil Fuller
85bddfdedf Revert "Make OpenJDK 8 the default"
Temporary revert to help out Brillo folks.
It will be resubmitted tomorrow.

This reverts commit 4495f6afb8.

Change-Id: Id378c7d3a6e72e9be50f9404b19d5763568987a5
2016-01-25 17:04:14 +00:00
Neil Fuller
4495f6afb8 Make OpenJDK 8 the default
To return to OpenJDK 7:
export LEGACY_USE_JAVA7=true

And run envsetup.sh/lunch again.

Bug: 25786468
Change-Id: I8e00591a24d13e3b8b6baaafe0fdff6536c58770
2016-01-25 10:19:25 +00:00
Neil Fuller
8f354bc8c2 Merge "Use sensible default locations for Java" 2015-11-20 10:16:17 +00:00
Neil Fuller
91e012cd99 Use sensible default locations for Java
Use sensible default locations for Java based on
the EXPERIMENTAL_USE_JAVA8 flag.

Bug: 25786468
Change-Id: I7ec035b5329785efc41b3f971d5e3ae202293576
2015-11-19 16:41:36 +00:00
Marie Janssen
4afc2c0f6f envsetup: fix for provision to work on zsh
The -p option means something else on zsh and breaks this function.

Bug: None
Change-Id: Ie0ba8119e34c616f5b8f931806063d6b1d3d893e
2015-11-10 10:41:15 -08:00
Gaurav Shah
881ec090c4 Merge "build: Add support for defining products in /product"
am: acb8a7c1f8

* commit 'acb8a7c1f8cacaf136edba1a25d64467d352a432':
  build: Add support for defining products in /product
2015-11-02 22:27:08 +00:00
Lee Campbell
455f6f458d build: Add support for defining products in /product
The build will now search for AndroidProducts.mk in /product

BUG: 22030305

Change-Id: I2d067d95d0c8dc1341a55167f9ac7f6926e04ce3
2015-11-02 14:17:47 -08:00
Mike Frysinger
2bd3f6e12c Merge "use find -exec ... + everywhere"
am: 6ff6e9552c

* commit '6ff6e9552c90d091adf4e3f686d2922585d8060f':
  use `find -exec ... +` everywhere
2015-10-22 19:44:08 +00:00
Mike Frysinger
5e47973204 use find -exec ... + everywhere
This is more efficient as find itself can handle correctly passing
arguments down to the command, and this is in POSIX.  The current
versions of OS X also support this form.

BUG=None
TEST=mgrep still works

Change-Id: Ie570867609113868daaf068658c4f7e6f4ae42fa
2015-10-22 09:50:59 -04:00
Roland Levillain
fef5ba8ec7 Merge "Typos in envsetup.sh."
am: 8503cfb49c

* commit '8503cfb49c797bffa2568cffaab483071230fef0':
  Typos in envsetup.sh.
2015-10-20 21:44:10 +00:00
Roland Levillain
39341924db Typos in envsetup.sh.
Change-Id: I31cc811e1352b9c924bdf164561f334b032d6f5c
2015-10-20 12:51:06 +01:00
Ying Wang
3a6ad87039 Merge "envsetup: Show error when supplied dir isn\'t present with mmm"
am: 475054a16a

* commit '475054a16ad57b184fa476c093cf1ce8e9ec3e15':
  envsetup: Show error when supplied dir isn't present with mmm
2015-10-19 23:21:46 +00:00
Abhinav1997
a72a6e7c72 envsetup: Show error when supplied dir isn't present with mmm
When a directory isn't present with mmm, don't show "No Android.mk present", rather show that the directory isn't present

Change-Id: I7259a60012c6f30c470daa60d5a5097d01ffc4c7
Signed-off-by: Abhinav1997 <abhinav.jhanwar.august2@gmail.com>
2015-10-19 22:38:42 +02:00
Brian Carlstrom
10abe69478 am b43cf696: am 848b8e9d: am fa2ce3b3: am f73f79f1: Merge "Use /filelist when OUT_DIR is set" into mnc-dev
* commit 'b43cf69672c72c025f0fe764d49ec950e3b57b81':
  Use $OUT_DIR/filelist when OUT_DIR is set
2015-10-04 20:05:54 +00:00
Brian Carlstrom
f2257427d9 Use $OUT_DIR/filelist when OUT_DIR is set
Change-Id: Iadf3f05e752d71371d3d74e670ade3e937b1cd92
2015-09-30 20:36:15 -07:00
David Zeuthen
2fb9d0904f am 0238e879: Merge "envsetup.sh: Add \'provision\' function."
* commit '0238e879893bbbbab4e75b0fd1355c43547ca31e':
  envsetup.sh: Add 'provision' function.
2015-09-30 21:51:55 +00:00
David Zeuthen
1b126ffedc envsetup.sh: Add 'provision' function.
This will run ${ANDROID_PRODUCT_OUT}/provision-device which in turn can
run fastboot (and other vendor-specific bits, if needed) to repartition
the device and reflash all partitions with known versions. Options
passed to the 'provision' command will be passed on to said script which
is expected to pass them on to fastboot.

Since this is a rather destructive operation involving data loss etc.,
user confirmation is required. This confirmation can be bypassed using
the option --no-confirmation.

Change-Id: Iec5667f2f5070b95d2eb70ad1b2984909ae4184c
2015-09-30 17:18:22 -04:00
Ying Wang
945bc2f288 am 92facb1f: Merge "Substitue "/" with "-" in the MODULES-IN phony goal names."
* commit '92facb1fed26492746aca267df51b6082286521c':
  Substitue "/" with "-" in the MODULES-IN phony goal names.
2015-09-24 23:59:29 +00:00
Ying Wang
61cd884a11 Substitue "/" with "-" in the MODULES-IN phony goal names.
This avoids Ninja's path canonicalization on those goal names.
Without this, Ninja complains about duplicate rules for
MODULES-IN/a/b/.. and MODULES-IN/a.

Bug: 24309760
Change-Id: Id3aa9da5d3887a2cd1426cbb5fdf35659c65805e
2015-09-24 16:24:42 -07:00
Ying Wang
2f9f1fb32f resolved conflicts for 964f06b1 to stage-aosp-master
Change-Id: I0cebad2e440ec7d605afafac893352f06ca2f419
2015-09-23 19:31:44 -07:00
Ying Wang
caeaa08f9d Re-implement mma/mmma using make goals.
Previously we use command line variable BUILD_MODULES_IN_PATHS which
causes kati to regenerate build.ninja if any variable value changes.

TODO: Remove the old rules of BUILD_MODULES_IN_PATHS in
build/core/main.mk and ninja.mk once users have re-sourced envsetup.sh.
Probably in a few weeks.

Caveat: With this change, if a user sources the new envsetup.sh, mma/mmma
won't work in old branches from the same shell.

Bug: 24309760
Change-Id: I212e82aeebaaa2bd4114e2066f1995da8886b5e2
2015-09-23 16:31:02 -07:00
Dan Albert
2afd720936 am 86e1aa1a: Merge "Move python-adb to development/python-packages."
* commit '86e1aa1a1d3593861f3a127e337fbdb8d965ee4f':
  Move python-adb to development/python-packages.
2015-09-21 17:34:25 +00:00
Dan Albert
f5caa3d3ba Move python-adb to development/python-packages.
Nothing else was being imported from system/core yet, and a path under
development makes more sense for this.

Bug: http://b/22881740
Change-Id: Ib0beb02137805b3e382535514a2bc067b7fd1d33
2015-09-18 13:40:26 -07:00
Ying Wang
1dd4dfbfd7 am 6eb3d977: Merge "Remove legacy kernel build toolchain PATH setup in envsetup.sh"
* commit '6eb3d977c5a8b7612058f1a55e648f8200de2b8f':
  Remove legacy kernel build toolchain PATH setup in envsetup.sh
2015-09-15 23:09:38 +00:00
Ying Wang
750396dd30 Remove legacy kernel build toolchain PATH setup in envsetup.sh
We used to rely on envsetup.sh to set up PATH before doing kernel build.
Now we have new kernel build process.
Also the variable doesn't work any more as we don't have corresponding arm-eabi
toolchain for the latest arm-linux-androideabi toolchain.

Change-Id: I99443fdc58e94f57f4f1f7e88da6dd127f3b2fac
2015-09-14 19:32:50 -07:00
Dan Albert
8405451f90 am 4982ef9d: am 010f652e: Merge "Add system/core to the PYTHONPATH."
* commit '4982ef9d76d4ca7189e56377a4032d8fe68fd994':
  Add system/core to the PYTHONPATH.
2015-07-31 22:31:58 +00:00
Dan Albert
515ab1e2d1 Add system/core to the PYTHONPATH.
There's an adb Python interface now, and system/core needs to be in
the PYTHONPATH for `import adb` to find it.

Change-Id: I712767a2ba96cb017ce5857dc367e4cacf2ec51f
2015-07-31 13:38:47 -07:00
Nick Kralevich
41da3d1209 am abbf8eeb: am a521a37d: Merge "mgrep: add output to environment commands"
* commit 'abbf8eeb674b1a9d9b8ac1cc8744f03144c3968c':
  mgrep: add output to environment commands
2015-07-15 21:27:43 +00:00
William Roberts
23a298b190 mgrep: add output to environment commands
Change-Id: I7a97e00c7ef5ac179333303d89511c2f72cbd100
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-07-13 09:29:52 -07:00
Jeff Vander Stoep
e50b3ec5f8 am f9af2646: am ed6e4d19: Merge "selinux: add tools to dev path"
* commit 'f9af26462fe9dd7c68ca49a8b5b148f00d4ea3ec':
  selinux: add tools to dev path
2015-06-12 20:05:32 +00:00
Jeff Vander Stoep
5aa6832e6b selinux: add tools to dev path
Adds audit2allow to the path. No build required.

(cherry picked from 5f50f05340)
Bug: 21724977
Change-Id: Ide320a56b9cdbfa426b978443f6df07fa2a38fbc
2015-06-12 20:02:25 +00:00
Jeff Vander Stoep
5f50f05340 selinux: add tools to dev path
Adds audit2allow to the path. No build required.

Bug: 21724977
Change-Id: Ide320a56b9cdbfa426b978443f6df07fa2a38fbc
2015-06-12 10:16:06 -07:00
Ying Wang
bc0f1f5651 am ac3f88d8: am 080f57ae: Merge "Remove the unnecessary full_x86_64 and full_mips64."
* commit 'ac3f88d8a2812cd2134f9b67ec4a928d886a4eb6':
  Remove the unnecessary full_x86_64 and full_mips64.
2015-06-08 20:08:09 +00:00
Ying Wang
0a76df5ce7 Remove the unnecessary full_x86_64 and full_mips64.
For historical reason, the aosp_* products were named full_*.
We keep the full, full_x86 and full_mips in case some tools still
reference these legacy names; But no reason the have the full_* product
names for the new 64-bit archs.

Change-Id: I240ed0c6ded0ded2d80603bd0c5ff24750999afc
2015-06-08 11:57:26 -07:00
Christopher Ferris
4c4db2d809 am ce78cf40: am 6bd0bbd5: Merge "Portable way to color"
* commit 'ce78cf40a4dbdfe2644215102c1269a4e72bec8b':
  Portable way to color
2015-05-29 05:07:18 +00:00
Jacky Cao
89483b83fb Portable way to color
Change-Id: I62ae1da772f4e3eb80ed26aca89ebe47aff8efa7
2015-05-17 10:07:42 +08:00
Ying Wang
55c838f115 am 0b584f2b: am f994458b: am b4b996a8: Merge "Include vendorsetup scripts in order"
* commit '0b584f2b394051684e2506cc7304b583df29bca6':
  Include vendorsetup scripts in order
2015-04-04 21:40:06 +00:00
Oleksiy Avramchenko
15760a8a96 Include vendorsetup scripts in order
This fixes randomness of the combo index.

Change-Id: I533161fea8d1bc0c9dbd6ca2f3393d27310c9588
2015-04-03 11:58:09 +02:00
Ying Wang
131d2f15c8 am 8b6fabc4: am 18aad5fe: am 24a71e15: Merge "Return non-zero if can\'t locate top of the tree in m/mm/mmm."
* commit '8b6fabc4619f6b1c5c4c1834783268bea0e77afc':
  Return non-zero if can't locate top of the tree in m/mm/mmm.
2015-04-02 01:40:19 +00:00
Ying Wang
0c1374cc70 Return non-zero if can't locate top of the tree in m/mm/mmm.
Bug: 20017058
Change-Id: I85fac71061673d00a1b583ad13afc8567d794cd6
2015-04-01 10:16:03 -07:00
Adrian Roos
afa958f413 Allow variable overrides in mmm and mmma
Change-Id: I12e8cc62e72d0af3b777f69727eafec9aa1713e3
2015-03-05 19:52:55 +01:00
Greg Hackmann
e39b0c118a am 01e0cb2c: am fc93e284: am 6492792d: Merge "Consult tput about color control sequence support"
* commit '01e0cb2ce011e65099737ca6052d10758d885c8b':
  Consult tput about color control sequence support
2015-03-03 22:24:52 +00:00
Greg Hackmann
fc93e284dd am 6492792d: Merge "Consult tput about color control sequence support"
* commit '6492792d8a30f218fff6d54765ba5502de0a9a2a':
  Consult tput about color control sequence support
2015-03-03 19:02:37 +00:00
Greg Hackmann
6492792d8a Merge "Consult tput about color control sequence support" 2015-03-03 18:55:21 +00:00
Jeff Sharkey
ea0068a2ee Add rcgrep for searching init.rc style files.
Change-Id: Iece26217a7c59c7b2fd1bf19a7edccbe4be92947
2015-02-26 14:13:46 -08:00