Merge "Reduce the number of Soong invocations, and various other minor script fixes."
This commit is contained in:
@@ -1,5 +1,15 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# This is a wrapper around "m" that builds the given modules in multi-arch mode
|
||||||
|
# for all architectures supported by Mainline modules. The make (kati) stage is
|
||||||
|
# skipped, so the build targets in the arguments can only be Soong modules or
|
||||||
|
# intermediate output files - make targets and normal installed paths are not
|
||||||
|
# supported.
|
||||||
|
#
|
||||||
|
# This script is typically used with "sdk" or "module_export" modules, which
|
||||||
|
# Soong will install in $OUT_DIR/soong/mainline-sdks (cf
|
||||||
|
# PathForMainlineSdksInstall in android/paths.go).
|
||||||
|
|
||||||
export OUT_DIR=${OUT_DIR:-out}
|
export OUT_DIR=${OUT_DIR:-out}
|
||||||
|
|
||||||
if [ -e ${OUT_DIR}/soong/.soong.in_make ]; then
|
if [ -e ${OUT_DIR}/soong/.soong.in_make ]; then
|
||||||
@@ -8,11 +18,16 @@ if [ -e ${OUT_DIR}/soong/.soong.in_make ]; then
|
|||||||
# expected to be supplied by the .mk files, and that might cause errors in
|
# expected to be supplied by the .mk files, and that might cause errors in
|
||||||
# "m --skip-make" below. We therefore default to a different out dir
|
# "m --skip-make" below. We therefore default to a different out dir
|
||||||
# location in that case.
|
# location in that case.
|
||||||
AML_OUT_DIR=out-aml
|
AML_OUT_DIR=out/aml
|
||||||
echo "Avoiding in-make OUT_DIR '${OUT_DIR}' - building in '${AML_OUT_DIR}' instead"
|
echo "Avoiding in-make OUT_DIR '${OUT_DIR}' - building in '${AML_OUT_DIR}' instead"
|
||||||
OUT_DIR=${AML_OUT_DIR}
|
OUT_DIR=${AML_OUT_DIR}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "build/envsetup.sh" ]; then
|
||||||
|
echo "$0 must be run from the top of the tree"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
source build/envsetup.sh
|
source build/envsetup.sh
|
||||||
|
|
||||||
my_get_build_var() {
|
my_get_build_var() {
|
||||||
@@ -22,13 +37,13 @@ my_get_build_var() {
|
|||||||
OUT_DIR=${OUT_DIR}/get_build_var get_build_var "$@"
|
OUT_DIR=${OUT_DIR}/get_build_var get_build_var "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
PLATFORM_SDK_VERSION=$(my_get_build_var PLATFORM_SDK_VERSION)
|
readonly PLATFORM_SDK_VERSION="$(my_get_build_var PLATFORM_SDK_VERSION)"
|
||||||
PLATFORM_VERSION=$(my_get_build_var PLATFORM_VERSION)
|
readonly PLATFORM_VERSION="$(my_get_build_var PLATFORM_VERSION)"
|
||||||
PLATFORM_VERSION_ALL_CODENAMES=$(my_get_build_var PLATFORM_VERSION_ALL_CODENAMES)
|
PLATFORM_VERSION_ALL_CODENAMES="$(my_get_build_var PLATFORM_VERSION_ALL_CODENAMES)"
|
||||||
|
|
||||||
# PLATFORM_VERSION_ALL_CODENAMES is a comma separated list like O,P. We need to
|
# PLATFORM_VERSION_ALL_CODENAMES is a comma separated list like O,P. We need to
|
||||||
# turn this into ["O","P"].
|
# turn this into ["O","P"].
|
||||||
PLATFORM_VERSION_ALL_CODENAMES=${PLATFORM_VERSION_ALL_CODENAMES/,/'","'}
|
PLATFORM_VERSION_ALL_CODENAMES="${PLATFORM_VERSION_ALL_CODENAMES/,/'","'}"
|
||||||
PLATFORM_VERSION_ALL_CODENAMES="[\"${PLATFORM_VERSION_ALL_CODENAMES}\"]"
|
PLATFORM_VERSION_ALL_CODENAMES="[\"${PLATFORM_VERSION_ALL_CODENAMES}\"]"
|
||||||
|
|
||||||
# Logic from build/make/core/goma.mk
|
# Logic from build/make/core/goma.mk
|
||||||
@@ -46,11 +61,16 @@ else
|
|||||||
USE_GOMA=false
|
USE_GOMA=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SOONG_OUT=${OUT_DIR}/soong
|
readonly SOONG_OUT=${OUT_DIR}/soong
|
||||||
mkdir -p ${SOONG_OUT}
|
mkdir -p ${SOONG_OUT}
|
||||||
SOONG_VARS=${SOONG_OUT}/soong.variables
|
readonly SOONG_VARS=${SOONG_OUT}/soong.variables
|
||||||
|
|
||||||
# We enable bionic linux builds as ART also needs prebuilts for it.
|
# Aml_abis: true
|
||||||
|
# - This flag configures Soong to compile for all architectures required for
|
||||||
|
# Mainline modules.
|
||||||
|
# CrossHost: linux_bionic
|
||||||
|
# CrossHostArch: x86_64
|
||||||
|
# - Enable Bionic on host as ART needs prebuilts for it.
|
||||||
cat > ${SOONG_VARS}.new << EOF
|
cat > ${SOONG_VARS}.new << EOF
|
||||||
{
|
{
|
||||||
"Platform_sdk_version": ${PLATFORM_SDK_VERSION},
|
"Platform_sdk_version": ${PLATFORM_SDK_VERSION},
|
||||||
@@ -79,4 +99,6 @@ fi
|
|||||||
# We use force building LLVM components flag (even though we actually don't
|
# We use force building LLVM components flag (even though we actually don't
|
||||||
# compile them) because we don't have bionic host prebuilts
|
# compile them) because we don't have bionic host prebuilts
|
||||||
# for them.
|
# for them.
|
||||||
FORCE_BUILD_LLVM_COMPONENTS=true m --skip-make "$@"
|
export FORCE_BUILD_LLVM_COMPONENTS=true
|
||||||
|
|
||||||
|
m --skip-make "$@"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash -ex
|
#!/bin/bash -e
|
||||||
|
|
||||||
# Non exhaustive list of modules where we want prebuilts. More can be added as
|
# Non exhaustive list of modules where we want prebuilts. More can be added as
|
||||||
# needed.
|
# needed.
|
||||||
@@ -34,11 +34,16 @@ if [ ! -e "build/make/core/Makefile" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo_and_run() {
|
||||||
|
echo "$*"
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
OUT_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var OUT_DIR)
|
OUT_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var OUT_DIR)
|
||||||
DIST_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var DIST_DIR)
|
DIST_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var DIST_DIR)
|
||||||
|
|
||||||
for product in "${PRODUCTS[@]}"; do
|
for product in "${PRODUCTS[@]}"; do
|
||||||
build/soong/soong_ui.bash --make-mode $@ \
|
echo_and_run build/soong/soong_ui.bash --make-mode $@ \
|
||||||
TARGET_PRODUCT=${product} \
|
TARGET_PRODUCT=${product} \
|
||||||
${MAINLINE_MODULES[@]}
|
${MAINLINE_MODULES[@]}
|
||||||
|
|
||||||
@@ -47,18 +52,16 @@ for product in "${PRODUCTS[@]}"; do
|
|||||||
rm -rf ${DIST_DIR}/${TARGET_ARCH}/
|
rm -rf ${DIST_DIR}/${TARGET_ARCH}/
|
||||||
mkdir -p ${DIST_DIR}/${TARGET_ARCH}/
|
mkdir -p ${DIST_DIR}/${TARGET_ARCH}/
|
||||||
for module in "${MAINLINE_MODULES[@]}"; do
|
for module in "${MAINLINE_MODULES[@]}"; do
|
||||||
cp ${PWD}/${PRODUCT_OUT}/system/apex/${module}.apex ${DIST_DIR}/${TARGET_ARCH}/
|
echo_and_run cp ${PWD}/${PRODUCT_OUT}/system/apex/${module}.apex ${DIST_DIR}/${TARGET_ARCH}/
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# Create multi-archs SDKs in a different out directory. The multi-arch script
|
# Create multi-archs SDKs in a different out directory. The multi-arch script
|
||||||
# uses soong directly and therefore needs its own directory that doesn't clash
|
# uses Soong in --skip-make mode which cannot use the same directory as normal
|
||||||
# with make.
|
# mode with make.
|
||||||
export OUT_DIR=${OUT_DIR}/aml/
|
export OUT_DIR=${OUT_DIR}/aml
|
||||||
for sdk in "${MODULES_SDK_AND_EXPORTS[@]}"; do
|
echo_and_run build/soong/scripts/build-aml-prebuilts.sh ${MODULES_SDK_AND_EXPORTS[@]}
|
||||||
build/soong/scripts/build-aml-prebuilts.sh ${sdk}
|
|
||||||
done
|
|
||||||
|
|
||||||
rm -rf ${DIST_DIR}/mainline-sdks
|
rm -rf ${DIST_DIR}/mainline-sdks
|
||||||
cp -R ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR}
|
echo_and_run cp -R ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR}
|
||||||
|
Reference in New Issue
Block a user