Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 1 | #!/bin/bash -e |
Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 2 | |
| 3 | # Non exhaustive list of modules where we want prebuilts. More can be added as |
| 4 | # needed. |
| 5 | MAINLINE_MODULES=( |
| 6 | com.android.art.debug |
| 7 | com.android.art.release |
| 8 | com.android.art.testing |
| 9 | com.android.conscrypt |
| 10 | com.android.runtime |
| 11 | com.android.tzdata |
| 12 | com.android.i18n |
| 13 | ) |
| 14 | |
| 15 | # List of SDKs and module exports we know of. |
| 16 | MODULES_SDK_AND_EXPORTS=( |
| 17 | art-module-sdk |
| 18 | art-module-test-exports |
| 19 | conscrypt-module-sdk |
| 20 | conscrypt-module-test-exports |
Nicolas Geoffray | 0a2e297 | 2020-04-23 09:35:45 +0100 | [diff] [blame] | 21 | conscrypt-module-host-exports |
Martin Stjernholm | 6ee5f75 | 2020-05-12 00:23:22 +0100 | [diff] [blame] | 22 | runtime-module-sdk |
Martin Stjernholm | 68b0c7a | 2020-06-11 15:48:13 +0100 | [diff] [blame] | 23 | runtime-module-host-exports |
Nicolas Geoffray | 7505c50 | 2020-06-18 15:33:18 +0100 | [diff] [blame] | 24 | i18n-module-test-exports |
| 25 | i18n-module-sdk |
Nicolas Geoffray | 792ea73 | 2020-06-26 14:44:32 +0100 | [diff] [blame] | 26 | platform-mainline-sdk |
| 27 | ) |
| 28 | |
| 29 | # List of libraries installed on the platform that are needed for ART chroot |
| 30 | # testing. |
| 31 | PLATFORM_LIBRARIES=( |
| 32 | liblog |
| 33 | libartpalette-system |
Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 34 | ) |
| 35 | |
| 36 | # We want to create apex modules for all supported architectures. |
| 37 | PRODUCTS=( |
Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 38 | aosp_arm |
| 39 | aosp_arm64 |
| 40 | aosp_x86 |
| 41 | aosp_x86_64 |
Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 42 | ) |
| 43 | |
| 44 | if [ ! -e "build/make/core/Makefile" ]; then |
Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 45 | echo "$0 must be run from the top of the tree" |
| 46 | exit 1 |
Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 47 | fi |
| 48 | |
Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 49 | echo_and_run() { |
| 50 | echo "$*" |
| 51 | "$@" |
| 52 | } |
| 53 | |
Nicolas Geoffray | f23054f | 2020-07-31 15:36:39 +0100 | [diff] [blame^] | 54 | lib_dir() { |
| 55 | case $1 in |
| 56 | (aosp_arm|aosp_x86) echo "lib";; |
| 57 | (aosp_arm64|aosp_x86_64) echo "lib64";; |
| 58 | esac |
| 59 | } |
| 60 | |
Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 61 | OUT_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var OUT_DIR) |
| 62 | DIST_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var DIST_DIR) |
| 63 | |
| 64 | for product in "${PRODUCTS[@]}"; do |
Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 65 | echo_and_run build/soong/soong_ui.bash --make-mode $@ \ |
| 66 | TARGET_PRODUCT=${product} \ |
Nicolas Geoffray | 792ea73 | 2020-06-26 14:44:32 +0100 | [diff] [blame] | 67 | ${MAINLINE_MODULES[@]} \ |
| 68 | ${PLATFORM_LIBRARIES[@]} |
Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 69 | |
Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 70 | PRODUCT_OUT=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var PRODUCT_OUT) |
| 71 | TARGET_ARCH=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var TARGET_ARCH) |
| 72 | rm -rf ${DIST_DIR}/${TARGET_ARCH}/ |
| 73 | mkdir -p ${DIST_DIR}/${TARGET_ARCH}/ |
| 74 | for module in "${MAINLINE_MODULES[@]}"; do |
| 75 | echo_and_run cp ${PWD}/${PRODUCT_OUT}/system/apex/${module}.apex ${DIST_DIR}/${TARGET_ARCH}/ |
| 76 | done |
Nicolas Geoffray | 792ea73 | 2020-06-26 14:44:32 +0100 | [diff] [blame] | 77 | for library in "${PLATFORM_LIBRARIES[@]}"; do |
Nicolas Geoffray | f23054f | 2020-07-31 15:36:39 +0100 | [diff] [blame^] | 78 | libdir=$(lib_dir $product) |
| 79 | echo_and_run cp ${PWD}/${PRODUCT_OUT}/system/${libdir}/${library}.so ${DIST_DIR}/${TARGET_ARCH}/ |
Nicolas Geoffray | 792ea73 | 2020-06-26 14:44:32 +0100 | [diff] [blame] | 80 | done |
Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 81 | done |
| 82 | |
Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 83 | # Create multi-archs SDKs in a different out directory. The multi-arch script |
Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 84 | # uses Soong in --skip-make mode which cannot use the same directory as normal |
| 85 | # mode with make. |
| 86 | export OUT_DIR=${OUT_DIR}/aml |
| 87 | echo_and_run build/soong/scripts/build-aml-prebuilts.sh ${MODULES_SDK_AND_EXPORTS[@]} |
Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 88 | |
| 89 | rm -rf ${DIST_DIR}/mainline-sdks |
Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 90 | echo_and_run cp -R ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR} |