| 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=( | 
| Martin Stjernholm | 7f51107 | 2020-10-12 15:10:36 +0100 | [diff] [blame] | 6 | com.android.art | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 7 | com.android.art.debug | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 8 | com.android.art.testing | 
|  | 9 | com.android.conscrypt | 
| Martin Stjernholm | 7f51107 | 2020-10-12 15:10:36 +0100 | [diff] [blame] | 10 | com.android.i18n | 
| Eric Holk | 277b0e7 | 2021-02-17 13:00:41 -0800 | [diff] [blame] | 11 | com.android.os.statsd | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 12 | com.android.runtime | 
|  | 13 | com.android.tzdata | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 14 | ) | 
|  | 15 |  | 
|  | 16 | # List of SDKs and module exports we know of. | 
|  | 17 | MODULES_SDK_AND_EXPORTS=( | 
|  | 18 | art-module-sdk | 
|  | 19 | art-module-test-exports | 
| Martin Stjernholm | 4c13f58 | 2020-11-11 12:49:03 +0000 | [diff] [blame] | 20 | conscrypt-module-host-exports | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 21 | conscrypt-module-sdk | 
|  | 22 | conscrypt-module-test-exports | 
| Martin Stjernholm | 4c13f58 | 2020-11-11 12:49:03 +0000 | [diff] [blame] | 23 | i18n-module-host-exports | 
| Nicolas Geoffray | 7505c50 | 2020-06-18 15:33:18 +0100 | [diff] [blame] | 24 | i18n-module-sdk | 
| Martin Stjernholm | 4c13f58 | 2020-11-11 12:49:03 +0000 | [diff] [blame] | 25 | i18n-module-test-exports | 
| Nicolas Geoffray | 792ea73 | 2020-06-26 14:44:32 +0100 | [diff] [blame] | 26 | platform-mainline-sdk | 
| Nicolas Geoffray | b0df23f | 2020-08-05 15:56:09 +0100 | [diff] [blame] | 27 | platform-mainline-test-exports | 
| Martin Stjernholm | 4c13f58 | 2020-11-11 12:49:03 +0000 | [diff] [blame] | 28 | runtime-module-host-exports | 
|  | 29 | runtime-module-sdk | 
| Eric Holk | 7529f06 | 2021-02-11 02:06:32 +0000 | [diff] [blame] | 30 | statsd-module-sdk | 
| Eric Holk | ff0529d | 2021-02-19 17:19:30 -0800 | [diff] [blame] | 31 | statsd-module-sdk-for-art | 
| Nicolas Geoffray | c1b1663 | 2021-01-11 09:45:57 +0000 | [diff] [blame] | 32 | tzdata-module-test-exports | 
| Nicolas Geoffray | 792ea73 | 2020-06-26 14:44:32 +0100 | [diff] [blame] | 33 | ) | 
|  | 34 |  | 
|  | 35 | # List of libraries installed on the platform that are needed for ART chroot | 
|  | 36 | # testing. | 
|  | 37 | PLATFORM_LIBRARIES=( | 
| Martin Stjernholm | 4f0f3f0 | 2021-03-09 17:13:51 +0000 | [diff] [blame] | 38 | heapprofd_client_api | 
| Nicolas Geoffray | 792ea73 | 2020-06-26 14:44:32 +0100 | [diff] [blame] | 39 | libartpalette-system | 
| Martin Stjernholm | 4f0f3f0 | 2021-03-09 17:13:51 +0000 | [diff] [blame] | 40 | liblog | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 41 | ) | 
|  | 42 |  | 
|  | 43 | # We want to create apex modules for all supported architectures. | 
|  | 44 | PRODUCTS=( | 
| Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 45 | aosp_arm | 
|  | 46 | aosp_arm64 | 
|  | 47 | aosp_x86 | 
|  | 48 | aosp_x86_64 | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 49 | ) | 
|  | 50 |  | 
|  | 51 | if [ ! -e "build/make/core/Makefile" ]; then | 
| Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 52 | echo "$0 must be run from the top of the tree" | 
|  | 53 | exit 1 | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 54 | fi | 
|  | 55 |  | 
| Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 56 | echo_and_run() { | 
|  | 57 | echo "$*" | 
|  | 58 | "$@" | 
|  | 59 | } | 
|  | 60 |  | 
| Nicolas Geoffray | f23054f | 2020-07-31 15:36:39 +0100 | [diff] [blame] | 61 | lib_dir() { | 
|  | 62 | case $1 in | 
|  | 63 | (aosp_arm|aosp_x86) echo "lib";; | 
|  | 64 | (aosp_arm64|aosp_x86_64) echo "lib64";; | 
|  | 65 | esac | 
|  | 66 | } | 
|  | 67 |  | 
| Martin Stjernholm | bd396b6 | 2021-02-02 16:20:45 +0000 | [diff] [blame] | 68 | # Make sure this build builds from source, regardless of the default. | 
|  | 69 | export SOONG_CONFIG_art_module_source_build=true | 
|  | 70 |  | 
| Samiul Islam | 129afae | 2021-06-02 15:23:37 +0100 | [diff] [blame] | 71 | # This script does not intend to handle compressed APEX | 
|  | 72 | export OVERRIDE_PRODUCT_COMPRESSED_APEX=false | 
|  | 73 |  | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 74 | OUT_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var OUT_DIR) | 
|  | 75 | DIST_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var DIST_DIR) | 
|  | 76 |  | 
|  | 77 | for product in "${PRODUCTS[@]}"; do | 
| Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 78 | echo_and_run build/soong/soong_ui.bash --make-mode $@ \ | 
|  | 79 | TARGET_PRODUCT=${product} \ | 
| Nicolas Geoffray | 792ea73 | 2020-06-26 14:44:32 +0100 | [diff] [blame] | 80 | ${MAINLINE_MODULES[@]} \ | 
|  | 81 | ${PLATFORM_LIBRARIES[@]} | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 82 |  | 
| Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 83 | PRODUCT_OUT=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var PRODUCT_OUT) | 
|  | 84 | TARGET_ARCH=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var TARGET_ARCH) | 
|  | 85 | rm -rf ${DIST_DIR}/${TARGET_ARCH}/ | 
|  | 86 | mkdir -p ${DIST_DIR}/${TARGET_ARCH}/ | 
|  | 87 | for module in "${MAINLINE_MODULES[@]}"; do | 
|  | 88 | echo_and_run cp ${PWD}/${PRODUCT_OUT}/system/apex/${module}.apex ${DIST_DIR}/${TARGET_ARCH}/ | 
|  | 89 | done | 
| Nicolas Geoffray | 792ea73 | 2020-06-26 14:44:32 +0100 | [diff] [blame] | 90 | for library in "${PLATFORM_LIBRARIES[@]}"; do | 
| Nicolas Geoffray | f23054f | 2020-07-31 15:36:39 +0100 | [diff] [blame] | 91 | libdir=$(lib_dir $product) | 
|  | 92 | 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] | 93 | done | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 94 | done | 
|  | 95 |  | 
| Martin Stjernholm | 7e14888 | 2021-06-07 23:18:56 +0100 | [diff] [blame] | 96 | # We use force building LLVM components flag (even though we actually don't | 
|  | 97 | # compile them) because we don't have bionic host prebuilts | 
|  | 98 | # for them. | 
|  | 99 | export FORCE_BUILD_LLVM_COMPONENTS=true | 
|  | 100 |  | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 101 | # Create multi-archs SDKs in a different out directory. The multi-arch script | 
| Pete Bentley | 237de41 | 2021-01-29 15:14:42 +0000 | [diff] [blame] | 102 | # uses Soong in --skip-make mode which cannot use the same directory as normal | 
| Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 103 | # mode with make. | 
|  | 104 | export OUT_DIR=${OUT_DIR}/aml | 
| Martin Stjernholm | 7e14888 | 2021-06-07 23:18:56 +0100 | [diff] [blame] | 105 | echo_and_run build/soong/scripts/build-aml-prebuilts.sh \ | 
|  | 106 | TARGET_PRODUCT=mainline_sdk ${MODULES_SDK_AND_EXPORTS[@]} | 
| Nicolas Geoffray | 90bc3cd | 2020-02-28 09:04:25 +0000 | [diff] [blame] | 107 |  | 
|  | 108 | rm -rf ${DIST_DIR}/mainline-sdks | 
| Martin Stjernholm | 691503e | 2020-05-06 22:03:26 +0100 | [diff] [blame] | 109 | echo_and_run cp -R ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR} |