1#!/bin/bash -e 2 3# Non exhaustive list of modules where we want prebuilts. More can be added as 4# needed. 5MAINLINE_MODULES=( 6 com.android.art 7 com.android.art.debug 8 com.android.art.testing 9 com.android.conscrypt 10 com.android.i18n 11 com.android.os.statsd 12 com.android.runtime 13 com.android.tzdata 14) 15 16# List of SDKs and module exports we know of. 17MODULES_SDK_AND_EXPORTS=( 18 art-module-sdk 19 art-module-test-exports 20 conscrypt-module-host-exports 21 conscrypt-module-sdk 22 conscrypt-module-test-exports 23 i18n-module-host-exports 24 i18n-module-sdk 25 i18n-module-test-exports 26 platform-mainline-sdk 27 platform-mainline-test-exports 28 runtime-module-host-exports 29 runtime-module-sdk 30 statsd-module-sdk 31 statsd-module-sdk-for-art 32 tzdata-module-test-exports 33) 34 35# List of libraries installed on the platform that are needed for ART chroot 36# testing. 37PLATFORM_LIBRARIES=( 38 heapprofd_client_api 39 libartpalette-system 40 liblog 41) 42 43# We want to create apex modules for all supported architectures. 44PRODUCTS=( 45 aosp_arm 46 aosp_arm64 47 aosp_x86 48 aosp_x86_64 49) 50 51if [ ! -e "build/make/core/Makefile" ]; then 52 echo "$0 must be run from the top of the tree" 53 exit 1 54fi 55 56echo_and_run() { 57 echo "$*" 58 "$@" 59} 60 61lib_dir() { 62 case $1 in 63 (aosp_arm|aosp_x86) echo "lib";; 64 (aosp_arm64|aosp_x86_64) echo "lib64";; 65 esac 66} 67 68# Make sure this build builds from source, regardless of the default. 69export SOONG_CONFIG_art_module_source_build=true 70 71# This script does not intend to handle compressed APEX 72export OVERRIDE_PRODUCT_COMPRESSED_APEX=false 73 74OUT_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var OUT_DIR) 75DIST_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var DIST_DIR) 76 77for product in "${PRODUCTS[@]}"; do 78 echo_and_run build/soong/soong_ui.bash --make-mode $@ \ 79 TARGET_PRODUCT=${product} \ 80 ${MAINLINE_MODULES[@]} \ 81 ${PLATFORM_LIBRARIES[@]} 82 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 90 for library in "${PLATFORM_LIBRARIES[@]}"; do 91 libdir=$(lib_dir $product) 92 echo_and_run cp ${PWD}/${PRODUCT_OUT}/system/${libdir}/${library}.so ${DIST_DIR}/${TARGET_ARCH}/ 93 done 94done 95 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. 99export FORCE_BUILD_LLVM_COMPONENTS=true 100 101# Create multi-archs SDKs in a different out directory. The multi-arch script 102# uses Soong in --skip-make mode which cannot use the same directory as normal 103# mode with make. 104export OUT_DIR=${OUT_DIR}/aml 105echo_and_run build/soong/scripts/build-aml-prebuilts.sh \ 106 TARGET_PRODUCT=mainline_sdk ${MODULES_SDK_AND_EXPORTS[@]} 107 108rm -rf ${DIST_DIR}/mainline-sdks 109echo_and_run cp -R ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR} 110