blob: fc91c3df5dd5bdef1b0845c1b20091fff5a81fe2 [file] [log] [blame]
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +00001#!/bin/bash -ex
2
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
Nicolas Geoffray90bc3cd2020-02-28 09:04:25 +000022)
23
24# We want to create apex modules for all supported architectures.
25PRODUCTS=(
26 aosp_arm
27 aosp_arm64
28 aosp_x86
29 aosp_x86_64
30)
31
32if [ ! -e "build/make/core/Makefile" ]; then
33 echo "$0 must be run from the top of the tree"
34 exit 1
35fi
36
37OUT_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var OUT_DIR)
38DIST_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var DIST_DIR)
39
40for product in "${PRODUCTS[@]}"; do
41 build/soong/soong_ui.bash --make-mode $@ \
42 TARGET_PRODUCT=${product} \
43 ${MAINLINE_MODULES[@]}
44
45 PRODUCT_OUT=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var PRODUCT_OUT)
46 TARGET_ARCH=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var TARGET_ARCH)
47 rm -rf ${DIST_DIR}/${TARGET_ARCH}/
48 mkdir -p ${DIST_DIR}/${TARGET_ARCH}/
49 for module in "${MAINLINE_MODULES[@]}"; do
50 cp ${PWD}/${PRODUCT_OUT}/system/apex/${module}.apex ${DIST_DIR}/${TARGET_ARCH}/
51 done
52done
53
54
55# Create multi-archs SDKs in a different out directory. The multi-arch script
56# uses soong directly and therefore needs its own directory that doesn't clash
57# with make.
58export OUT_DIR=${OUT_DIR}/aml/
59for sdk in "${MODULES_SDK_AND_EXPORTS[@]}"; do
60 build/soong/scripts/build-aml-prebuilts.sh ${sdk}
61done
62
63rm -rf ${DIST_DIR}/mainline-sdks
64cp -R ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR}