Jeff Gaston | c6dfc4e | 2017-05-30 17:12:37 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # locate some directories |
| 4 | cd "$(dirname $0)" |
| 5 | SCRIPT_DIR="${PWD}" |
| 6 | cd ../.. |
| 7 | TOP="${PWD}" |
| 8 | |
| 9 | message='The basic Android build process is: |
| 10 | |
| 11 | cd '"${TOP}"' |
| 12 | source build/envsetup.sh # Add "lunch" (and other utilities and variables) |
| 13 | # to the shell environment. |
| 14 | lunch [<product>-<variant>] # Choose the device to target. |
Colin Cross | 3fb7ddf | 2021-03-01 13:32:13 -0800 | [diff] [blame] | 15 | m [<goals>] # Execute the configured build. |
Jeff Gaston | c6dfc4e | 2017-05-30 17:12:37 -0700 | [diff] [blame] | 16 | |
| 17 | Usage of "m" imitates usage of the program "make". |
Dan Willemsen | 7733862 | 2017-11-08 16:39:18 -0800 | [diff] [blame] | 18 | See '"${SCRIPT_DIR}"'/Usage.txt for more info about build usage and concepts. |
Jeff Gaston | c6dfc4e | 2017-05-30 17:12:37 -0700 | [diff] [blame] | 19 | |
Colin Cross | 3fb7ddf | 2021-03-01 13:32:13 -0800 | [diff] [blame] | 20 | The parallelism of the build can be set with a -jN argument to "m". If you |
Jaewoong Jung | f9a2e4d | 2021-03-25 14:40:44 -0700 | [diff] [blame] | 21 | don'\''t provide a -j argument, the build system automatically selects a parallel |
Colin Cross | 3fb7ddf | 2021-03-01 13:32:13 -0800 | [diff] [blame] | 22 | task count that it thinks is optimal for your system. |
| 23 | |
Jeff Gaston | c6dfc4e | 2017-05-30 17:12:37 -0700 | [diff] [blame] | 24 | Common goals are: |
| 25 | |
| 26 | clean (aka clobber) equivalent to rm -rf out/ |
| 27 | checkbuild Build every module defined in the source tree |
| 28 | droid Default target |
Colin Cross | 1778342 | 2022-09-22 02:26:08 +0000 | [diff] [blame] | 29 | sync Build everything in the default target except the images, |
| 30 | for use with adb sync. |
Jeff Gaston | c6dfc4e | 2017-05-30 17:12:37 -0700 | [diff] [blame] | 31 | nothing Do not build anything, just parse and validate the build structure |
| 32 | |
| 33 | java Build all the java code in the source tree |
| 34 | native Build all the native code in the source tree |
| 35 | |
| 36 | host Build all the host code (not to be run on a device) in the source tree |
| 37 | target Build all the target code (to be run on the device) in the source tree |
| 38 | |
| 39 | (java|native)-(host|target) |
| 40 | (host|target)-(java|native) |
| 41 | Build the intersection of the two given arguments |
| 42 | |
| 43 | snod Quickly rebuild the system image from built packages |
| 44 | Stands for "System, NO Dependencies" |
| 45 | vnod Quickly rebuild the vendor image from built packages |
| 46 | Stands for "Vendor, NO Dependencies" |
Jaekyun Seok | b7735d8 | 2017-11-27 17:04:47 +0900 | [diff] [blame] | 47 | pnod Quickly rebuild the product image from built packages |
| 48 | Stands for "Product, NO Dependencies" |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 49 | senod Quickly rebuild the system_ext image from built packages |
| 50 | Stands for "SystemExt, NO Dependencies" |
Bowgo Tsai | d624fa6 | 2017-11-14 23:42:30 +0800 | [diff] [blame] | 51 | onod Quickly rebuild the odm image from built packages |
Yifan Hong | cfb917a | 2020-05-07 14:58:20 -0700 | [diff] [blame] | 52 | Stands for "Odm, NO Dependencies" |
| 53 | vdnod Quickly rebuild the vendor_dlkm image from built packages |
| 54 | Stands for "VendorDlkm, NO Dependencies" |
Yifan Hong | f496f1b | 2020-07-15 16:52:59 -0700 | [diff] [blame] | 55 | odnod Quickly rebuild the odm_dlkm image from built packages |
| 56 | Stands for "OdmDlkm, NO Dependencies" |
Ramji Jiyani | 13a4137 | 2022-01-27 07:05:08 +0000 | [diff] [blame] | 57 | sdnod Quickly rebuild the system_dlkm image from built packages |
| 58 | Stands for "SystemDlkm, NO Dependencies" |
Jeff Gaston | c6dfc4e | 2017-05-30 17:12:37 -0700 | [diff] [blame] | 59 | |
| 60 | |
| 61 | So, for example, you could run: |
| 62 | |
| 63 | cd '"${TOP}"' |
| 64 | source build/envsetup.sh |
| 65 | lunch aosp_arm-userdebug |
| 66 | m -j java |
| 67 | |
| 68 | to build all of the java code for the userdebug variant of the aosp_arm device. |
| 69 | ' |
| 70 | |
| 71 | echo "$message" |