| 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=( |
| 14 | aosp_arm |
| 15 | aosp_arm64 |
| 16 | aosp_x86 |
| 17 | aosp_x86_64 |
| 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 |
| 45 | # Configure the build system for the reduced manifest branch. |
| 46 | build_args="SOONG_ALLOW_MISSING_DEPENDENCIES=true" |
| 47 | build_args="$build_args TARGET_BUILD_UNBUNDLED=true" |
| 48 | fi |
| 49 | |
| 50 | for product in ${PRODUCTS[*]}; do |
| 51 | echo_and_run build/soong/soong_ui.bash --make-mode $build_args \ |
| 52 | TARGET_PRODUCT=${product} ${MAINLINE_MODULES[*]} |
| 53 | |
| 54 | eval $(TARGET_PRODUCT=${product} build/soong/soong_ui.bash --dumpvars-mode \ |
| 55 | --vars="PRODUCT_OUT TARGET_ARCH") |
| 56 | |
| 57 | mkdir -p ${DIST_DIR}/${TARGET_ARCH} |
| 58 | for module in ${MAINLINE_MODULES[*]}; do |
| 59 | echo_and_run cp ${PRODUCT_OUT}/system/apex/${module}.apex \ |
| 60 | ${DIST_DIR}/${TARGET_ARCH}/ |
| 61 | done |
| 62 | done |
| 63 | |
| 64 | # Create multi-archs SDKs in a different out directory. The multi-arch script |
| 65 | # uses Soong in --skip-make mode which cannot use the same directory as normal |
| 66 | # mode with make. |
| 67 | export OUT_DIR=${OUT_DIR}/aml |
| 68 | |
| 69 | echo_and_run build/soong/scripts/build-aml-prebuilts.sh $build_args \ |
| 70 | ${MODULES_SDK_AND_EXPORTS[*]} |
| 71 | |
| 72 | rm -rf ${DIST_DIR}/mainline-sdks |
| 73 | echo_and_run cp -r ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR} |