Set up BuildNumberFile in soong.variables.
Necessary for some build steps. aapt2 is one example, although it still
has problems because part of its build logic is in make.
This isn't strictly required for any supported build target at the
moment, but the error when it fails can be confusing so let's add it
anyway.
Test: build/soong/scripts/build-aml-prebuilts.sh art-module-sdk \
art-module-test-exports conscrypt-module-sdk \
conscrypt-module-test-exports conscrypt-module-host-exports \
runtime-module-sdk runtime-module-host-exports \
i18n-module-test-exports i18n-module-sdk platform-mainline-sdk \
platform-mainline-test-exports
Bug: 172548608
Change-Id: I88526a85f288287c3a138f8cbb6fd04ad28c3795
diff --git a/scripts/build-aml-prebuilts.sh b/scripts/build-aml-prebuilts.sh
index ef5565d..89fb1a5 100755
--- a/scripts/build-aml-prebuilts.sh
+++ b/scripts/build-aml-prebuilts.sh
@@ -37,6 +37,14 @@
OUT_DIR=${OUT_DIR}/get_build_var get_build_var "$@"
}
+readonly SOONG_OUT=${OUT_DIR}/soong
+mkdir -p ${SOONG_OUT}
+
+# Some Soong build rules may require this, and the failure mode if it's missing
+# is confusing (b/172548608).
+readonly BUILD_NUMBER="$(my_get_build_var BUILD_NUMBER)"
+echo -n ${BUILD_NUMBER} > ${SOONG_OUT}/build_number.txt
+
readonly PLATFORM_SDK_VERSION="$(my_get_build_var PLATFORM_SDK_VERSION)"
readonly PLATFORM_VERSION="$(my_get_build_var PLATFORM_VERSION)"
PLATFORM_VERSION_ALL_CODENAMES="$(my_get_build_var PLATFORM_VERSION_ALL_CODENAMES)"
@@ -61,8 +69,6 @@
USE_GOMA=false
fi
-readonly SOONG_OUT=${OUT_DIR}/soong
-mkdir -p ${SOONG_OUT}
readonly SOONG_VARS=${SOONG_OUT}/soong.variables
# Aml_abis: true
@@ -73,6 +79,8 @@
# - Enable Bionic on host as ART needs prebuilts for it.
cat > ${SOONG_VARS}.new << EOF
{
+ "BuildNumberFile": "build_number.txt",
+
"Platform_sdk_version": ${PLATFORM_SDK_VERSION},
"Platform_sdk_codename": "${PLATFORM_VERSION}",
"Platform_version_active_codenames": ${PLATFORM_VERSION_ALL_CODENAMES},