xref: /aosp_15_r20/build/soong/bin/hmm (revision 333d2b3687b3a337dbcca9d65000bca186795e39)
1#!/bin/bash
2
3# Copyright (C) 2024 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Common script utilities
18source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../make/shell_utils.sh
19
20cat <<EOF
21
22Run "m help" for help with the build system itself.
23
24Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
25- lunch:      lunch <product_name>-<release_type>-<build_variant>
26              Selects <product_name> as the product to build, and <build_variant> as the variant to
27              build, and stores those selections in the environment to be read by subsequent
28              invocations of 'm' etc.
29- tapas:      tapas [<App1> <App2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user]
30              Sets up the build environment for building unbundled apps (APKs).
31- banchan:    banchan <module1> [<module2> ...] \\
32                      [arm|x86|arm64|riscv64|x86_64|arm64_only|x86_64only] [eng|userdebug|user]
33              Sets up the build environment for building unbundled modules (APEXes).
34- croot:      Changes directory to the top of the tree, or a subdirectory thereof.
35- m:          Makes from the top of the tree.
36- mm:         Builds and installs all of the modules in the current directory, and their
37              dependencies.
38- mmm:        Builds and installs all of the modules in the supplied directories, and their
39              dependencies.
40              To limit the modules being built use the syntax: mmm dir/:target1,target2.
41- mma:        Same as 'mm'
42- mmma:       Same as 'mmm'
43- provision:  Flash device with all required partitions. Options will be passed on to fastboot.
44- cgrep:      Greps on all local C/C++ files.
45- ggrep:      Greps on all local Gradle files.
46- gogrep:     Greps on all local Go files.
47- jgrep:      Greps on all local Java files.
48- jsongrep:   Greps on all local Json files.
49- ktgrep:     Greps on all local Kotlin files.
50- resgrep:    Greps on all local res/*.xml files.
51- mangrep:    Greps on all local AndroidManifest.xml files.
52- mgrep:      Greps on all local Makefiles and *.bp files.
53- owngrep:    Greps on all local OWNERS files.
54- rsgrep:     Greps on all local Rust files.
55- sepgrep:    Greps on all local sepolicy files.
56- sgrep:      Greps on all local source files.
57- tomlgrep:   Greps on all local Toml files.
58- pygrep:     Greps on all local Python files.
59- godir:      Go to the directory containing a file.
60- allmod:     List all modules.
61- gomod:      Go to the directory containing a module.
62- pathmod:    Get the directory containing a module.
63- outmod:     Gets the location of a module's installed outputs with a certain extension.
64- dirmods:    Gets the modules defined in a given directory.
65- installmod: Adb installs a module's built APK.
66- refreshmod: Refresh list of modules for allmod/gomod/pathmod/outmod/installmod.
67- syswrite:   Remount partitions (e.g. system.img) as writable, rebooting if necessary.
68
69Environment options:
70- SANITIZE_HOST: Set to 'address' to use ASAN for all host modules.
71- ANDROID_QUIET_BUILD: set to 'true' to display only the essential messages.
72
73Look at the source to view more functions. The complete list is:
74EOF
75    T=$(gettop)
76    A=""
77    for i in `cat $T/build/envsetup.sh | sed -n "/^[[:blank:]]*function /s/function \([a-z_]*\).*/\1/p" | sort | uniq`; do
78      A="$A $i"
79    done
80    echo $A
81
82