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