blob: 1bc78e6ba0cf76f05ebddb8629f2c7e1c8924d24 [file] [log] [blame]
Martin Stjernholm691503e2020-05-06 22:03:26 +01001#!/bin/bash -e
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +00002
3# Non exhaustive list of modules where we want prebuilts. More can be added as
4# needed.
5MAINLINE_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.
16MODULES_SDK_AND_EXPORTS=(
17 art-module-sdk
18 art-module-test-exports
19 conscrypt-module-sdk
20 conscrypt-module-test-exports
Nicolas Geoffray0a2e2972020-04-23 09:35:45 +010021 conscrypt-module-host-exports
Martin Stjernholm6ee5f752020-05-12 00:23:22 +010022 runtime-module-sdk
Martin Stjernholm68b0c7a2020-06-11 15:48:13 +010023 runtime-module-host-exports
Nicolas Geoffray7505c502020-06-18 15:33:18 +010024 i18n-module-test-exports
25 i18n-module-sdk
Nicolas Geoffray792ea732020-06-26 14:44:32 +010026 platform-mainline-sdk
Nicolas Geoffrayba7887f2020-06-30 14:25:47 +010027 platform-mainline-host-exports
Nicolas Geoffray792ea732020-06-26 14:44:32 +010028)
29
30# List of libraries installed on the platform that are needed for ART chroot
31# testing.
32PLATFORM_LIBRARIES=(
33 liblog
34 libartpalette-system
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +000035)
36
37# We want to create apex modules for all supported architectures.
38PRODUCTS=(
Martin Stjernholm691503e2020-05-06 22:03:26 +010039 aosp_arm
40 aosp_arm64
41 aosp_x86
42 aosp_x86_64
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +000043)
44
45if [ ! -e "build/make/core/Makefile" ]; then
Martin Stjernholm691503e2020-05-06 22:03:26 +010046 echo "$0 must be run from the top of the tree"
47 exit 1
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +000048fi
49
Martin Stjernholm691503e2020-05-06 22:03:26 +010050echo_and_run() {
51 echo "$*"
52 "$@"
53}
54
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +000055OUT_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var OUT_DIR)
56DIST_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var DIST_DIR)
57
58for product in "${PRODUCTS[@]}"; do
Martin Stjernholm691503e2020-05-06 22:03:26 +010059 echo_and_run build/soong/soong_ui.bash --make-mode $@ \
60 TARGET_PRODUCT=${product} \
Nicolas Geoffray792ea732020-06-26 14:44:32 +010061 ${MAINLINE_MODULES[@]} \
62 ${PLATFORM_LIBRARIES[@]}
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +000063
Martin Stjernholm691503e2020-05-06 22:03:26 +010064 PRODUCT_OUT=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var PRODUCT_OUT)
65 TARGET_ARCH=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var TARGET_ARCH)
66 rm -rf ${DIST_DIR}/${TARGET_ARCH}/
67 mkdir -p ${DIST_DIR}/${TARGET_ARCH}/
68 for module in "${MAINLINE_MODULES[@]}"; do
69 echo_and_run cp ${PWD}/${PRODUCT_OUT}/system/apex/${module}.apex ${DIST_DIR}/${TARGET_ARCH}/
70 done
Nicolas Geoffray792ea732020-06-26 14:44:32 +010071 for library in "${PLATFORM_LIBRARIES[@]}"; do
72 echo_and_run cp ${PWD}/${PRODUCT_OUT}/system/lib/${library}.so ${DIST_DIR}/${TARGET_ARCH}/
73 done
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +000074done
75
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +000076# Create multi-archs SDKs in a different out directory. The multi-arch script
Martin Stjernholm691503e2020-05-06 22:03:26 +010077# uses Soong in --skip-make mode which cannot use the same directory as normal
78# mode with make.
79export OUT_DIR=${OUT_DIR}/aml
80echo_and_run build/soong/scripts/build-aml-prebuilts.sh ${MODULES_SDK_AND_EXPORTS[@]}
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +000081
82rm -rf ${DIST_DIR}/mainline-sdks
Martin Stjernholm691503e2020-05-06 22:03:26 +010083echo_and_run cp -R ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR}