Merge "Add script for building all target arch's needed in AML (Android Mainline) prebuilts." am: d732beed90 am: 822d8655e5

Change-Id: Ie3a3fc79576a2380d2db16d7306ac61b83cb1025
This commit is contained in:
Automerger Merge Worker
2019-12-20 12:15:51 +00:00
4 changed files with 91 additions and 0 deletions

View File

@@ -1602,6 +1602,15 @@ func getNdkAbisConfig() []archConfig {
}
}
func getAmlAbisConfig() []archConfig {
return []archConfig{
{"arm", "armv7-a", "", []string{"armeabi-v7a"}},
{"arm64", "armv8-a", "", []string{"arm64-v8a"}},
{"x86", "", "", []string{"x86"}},
{"x86_64", "", "", []string{"x86_64"}},
}
}
func decodeArchSettings(os OsType, archConfigs []archConfig) ([]Target, error) {
var ret []Target

View File

@@ -364,6 +364,8 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
archConfig = getMegaDeviceConfig()
} else if config.NdkAbis() {
archConfig = getNdkAbisConfig()
} else if config.AmlAbis() {
archConfig = getAmlAbisConfig()
}
if archConfig != nil {
@@ -1122,6 +1124,10 @@ func (c *config) NdkAbis() bool {
return Bool(c.productVariables.Ndk_abis)
}
func (c *config) AmlAbis() bool {
return Bool(c.productVariables.Aml_abis)
}
func (c *config) ExcludeDraftNdkApis() bool {
return Bool(c.productVariables.Exclude_draft_ndk_apis)
}

View File

@@ -288,6 +288,7 @@ type productVariables struct {
Exclude_draft_ndk_apis *bool `json:",omitempty"`
Flatten_apex *bool `json:",omitempty"`
Aml_abis *bool `json:",omitempty"`
DexpreoptGlobalConfig *string `json:",omitempty"`

75
scripts/build-aml-prebuilts.sh Executable file
View File

@@ -0,0 +1,75 @@
#!/bin/bash -e
export OUT_DIR=${OUT_DIR:-out}
if [ -e ${OUT_DIR}/soong/.soong.in_make ]; then
# If ${OUT_DIR} has been created without --skip-make, Soong will create an
# ${OUT_DIR}/soong/build.ninja that leaves out many targets which are
# 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
# location in that case.
AML_OUT_DIR=out-aml
echo "Avoiding in-make OUT_DIR '${OUT_DIR}' - building in '${AML_OUT_DIR}' instead"
OUT_DIR=${AML_OUT_DIR}
fi
source build/envsetup.sh
my_get_build_var() {
# get_build_var will run Soong in normal in-make mode where it creates
# .soong.in_make. That would clobber our real out directory, so we need to
# run it in a different one.
OUT_DIR=${OUT_DIR}/get_build_var get_build_var "$@"
}
PLATFORM_SDK_VERSION=$(my_get_build_var PLATFORM_SDK_VERSION)
PLATFORM_VERSION=$(my_get_build_var PLATFORM_VERSION)
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
# turn this into ["O","P"].
PLATFORM_VERSION_ALL_CODENAMES=${PLATFORM_VERSION_ALL_CODENAMES/,/'","'}
PLATFORM_VERSION_ALL_CODENAMES="[\"${PLATFORM_VERSION_ALL_CODENAMES}\"]"
# Logic from build/make/core/goma.mk
if [ "${USE_GOMA}" = true ]; then
if [ -n "${GOMA_DIR}" ]; then
goma_dir="${GOMA_DIR}"
else
goma_dir="${HOME}/goma"
fi
GOMA_CC="${goma_dir}/gomacc"
export CC_WRAPPER="${CC_WRAPPER}${CC_WRAPPER:+ }${GOMA_CC}"
export CXX_WRAPPER="${CXX_WRAPPER}${CXX_WRAPPER:+ }${GOMA_CC}"
export JAVAC_WRAPPER="${JAVAC_WRAPPER}${JAVAC_WRAPPER:+ }${GOMA_CC}"
else
USE_GOMA=false
fi
SOONG_OUT=${OUT_DIR}/soong
mkdir -p ${SOONG_OUT}
SOONG_VARS=${SOONG_OUT}/soong.variables
cat > ${SOONG_VARS}.new << EOF
{
"Platform_sdk_version": ${PLATFORM_SDK_VERSION},
"Platform_sdk_codename": "${PLATFORM_VERSION}",
"Platform_version_active_codenames": ${PLATFORM_VERSION_ALL_CODENAMES},
"DeviceName": "generic_arm64",
"HostArch": "x86_64",
"Aml_abis": true,
"UseGoma": ${USE_GOMA}
}
EOF
if [ -f ${SOONG_VARS} ] && cmp -s ${SOONG_VARS} ${SOONG_VARS}.new; then
# Don't touch soong.variables if we don't have to, to avoid Soong rebuilding
# the ninja file when it isn't necessary.
rm ${SOONG_VARS}.new
else
mv ${SOONG_VARS}.new ${SOONG_VARS}
fi
m --skip-make "$@"