| Martin Stjernholm | b1cbfc7 | 2020-11-18 23:02:39 +0000 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | |
| 3 | # This script builds the APEX modules, SDKs and module exports that the ART |
| 4 | # Module provides. |
| 5 | |
| 6 | MAINLINE_MODULES=( |
| 7 | com.android.art |
| 8 | com.android.art.debug |
| 9 | ) |
| 10 | |
| 11 | # The products to build MAINLINE_MODULES for, same as in |
| 12 | # build/soong/scripts/build-mainline-modules.sh. |
| 13 | PRODUCTS=( |
| Martin Stjernholm | 10bb9c5 | 2020-12-01 22:53:51 +0000 | [diff] [blame] | 14 | art_module_arm |
| 15 | art_module_arm64 |
| 16 | art_module_x86 |
| 17 | art_module_x86_64 |
| Martin Stjernholm | b1cbfc7 | 2020-11-18 23:02:39 +0000 | [diff] [blame] | 18 | ) |
| 19 | |
| 20 | MODULES_SDK_AND_EXPORTS=( |
| 21 | art-module-sdk |
| 22 | art-module-host-exports |
| 23 | art-module-test-exports |
| 24 | ) |
| 25 | |
| 26 | # MAINLINE_MODULE_PRODUCTS can be used to override the list of products. |
| 27 | if [ -n "${MAINLINE_MODULE_PRODUCTS}" ]; then |
| 28 | read -r -a PRODUCTS <<< "${MAINLINE_MODULE_PRODUCTS}" |
| 29 | fi |
| 30 | |
| 31 | if [ ! -e build/make/core/Makefile ]; then |
| 32 | echo "$0 must be run from the top of the tree" |
| 33 | exit 1 |
| 34 | fi |
| 35 | |
| 36 | echo_and_run() { |
| 37 | echo "$*" |
| 38 | "$@" |
| 39 | } |
| 40 | |
| 41 | export OUT_DIR=${OUT_DIR:-out} |
| 42 | export DIST_DIR=${DIST_DIR:-${OUT_DIR}/dist} |
| 43 | |
| 44 | if [ ! -d frameworks/base ]; then |
| Martin Stjernholm | 2324775 | 2020-11-23 00:31:38 +0000 | [diff] [blame] | 45 | # Configure the build system for the reduced manifest branch. These need to be |
| 46 | # passed through the environment since they have to be visible to the Soong |
| 47 | # --dumpvars-mode invocations. |
| 48 | export SOONG_ALLOW_MISSING_DEPENDENCIES=true |
| 49 | export TARGET_BUILD_UNBUNDLED=true |
| Martin Stjernholm | b1cbfc7 | 2020-11-18 23:02:39 +0000 | [diff] [blame] | 50 | fi |
| 51 | |
| 52 | for product in ${PRODUCTS[*]}; do |
| Martin Stjernholm | 2324775 | 2020-11-23 00:31:38 +0000 | [diff] [blame] | 53 | echo_and_run build/soong/soong_ui.bash --make-mode \ |
| 54 | TARGET_PRODUCT=${product} "$@" ${MAINLINE_MODULES[*]} |
| Martin Stjernholm | b1cbfc7 | 2020-11-18 23:02:39 +0000 | [diff] [blame] | 55 | |
| Martin Stjernholm | 2324775 | 2020-11-23 00:31:38 +0000 | [diff] [blame] | 56 | vars="$(TARGET_PRODUCT=${product} build/soong/soong_ui.bash --dumpvars-mode \ |
| 57 | --vars="PRODUCT_OUT TARGET_ARCH")" |
| 58 | # Assign to a variable and eval that, since bash ignores any error status from |
| 59 | # the command substitution if it's directly on the eval line. |
| 60 | eval $vars |
| Martin Stjernholm | b1cbfc7 | 2020-11-18 23:02:39 +0000 | [diff] [blame] | 61 | |
| 62 | mkdir -p ${DIST_DIR}/${TARGET_ARCH} |
| 63 | for module in ${MAINLINE_MODULES[*]}; do |
| 64 | echo_and_run cp ${PRODUCT_OUT}/system/apex/${module}.apex \ |
| 65 | ${DIST_DIR}/${TARGET_ARCH}/ |
| 66 | done |
| 67 | done |
| 68 | |
| 69 | # Create multi-archs SDKs in a different out directory. The multi-arch script |
| 70 | # uses Soong in --skip-make mode which cannot use the same directory as normal |
| 71 | # mode with make. |
| 72 | export OUT_DIR=${OUT_DIR}/aml |
| 73 | |
| Martin Stjernholm | 10bb9c5 | 2020-12-01 22:53:51 +0000 | [diff] [blame] | 74 | # Make build-aml-prebuilts.sh set the source_build Soong config variable true. |
| 75 | export ENABLE_ART_SOURCE_BUILD=true |
| 76 | |
| Martin Stjernholm | 2324775 | 2020-11-23 00:31:38 +0000 | [diff] [blame] | 77 | echo_and_run build/soong/scripts/build-aml-prebuilts.sh "$@" \ |
| Martin Stjernholm | b1cbfc7 | 2020-11-18 23:02:39 +0000 | [diff] [blame] | 78 | ${MODULES_SDK_AND_EXPORTS[*]} |
| 79 | |
| 80 | rm -rf ${DIST_DIR}/mainline-sdks |
| 81 | echo_and_run cp -r ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR} |