2018-11-02 12:16:29 +00:00
|
|
|
#!/usr/bin/env bash
|
2018-08-21 15:17:25 +00:00
|
|
|
|
2018-11-02 12:16:29 +00:00
|
|
|
#####################################################################
|
2018-05-07 12:32:46 +00:00
|
|
|
#
|
|
|
|
# This script manages app build numbers.
|
|
|
|
# It returns the next build number to be used.
|
2018-11-02 12:16:29 +00:00
|
|
|
# The limit of size of the number is signed int, which is 2147483647.
|
2018-05-07 12:32:46 +00:00
|
|
|
#
|
|
|
|
# These numbers are used to mark app artifacts for:
|
|
|
|
# * Play Store - versionCode attribute (gradle)
|
|
|
|
# * Apple Store - CFBundleVersion attribute (plutil)
|
|
|
|
#
|
|
|
|
# For more details see:
|
|
|
|
# * https://developer.android.com/studio/publish/versioning
|
|
|
|
# * https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
2018-07-10 14:17:27 +00:00
|
|
|
#
|
2018-11-02 12:16:29 +00:00
|
|
|
# History:
|
|
|
|
#
|
|
|
|
# This script used to tag builds with `build-[0-9]+` tags.
|
|
|
|
# Since only release builds actually get uploaded to Play or Apple
|
|
|
|
# stores only then is the uniqueness of numbers checked.
|
|
|
|
# Because of that we are fine using just hour granurality.
|
|
|
|
#
|
2018-08-23 12:56:19 +00:00
|
|
|
#####################################################################
|
|
|
|
|
2018-11-02 12:16:29 +00:00
|
|
|
# Fail on first error
|
|
|
|
set -e
|
2018-08-23 12:56:19 +00:00
|
|
|
|
2018-11-02 12:16:29 +00:00
|
|
|
DEV_BUILD_NUMBER=9999
|
2019-08-23 17:16:08 +00:00
|
|
|
|
|
|
|
SCRIPTPATH="$(cd "$(dirname "$0")" ; pwd -P)"
|
|
|
|
ROOT_PATH="${SCRIPTPATH}/../../"
|
|
|
|
BUILD_NUMBER_FILE="${ROOT_PATH}/BUILD_NUMBER"
|
2018-08-21 15:17:25 +00:00
|
|
|
|
2018-11-02 12:16:29 +00:00
|
|
|
# If running under Jenkins use a timestamp-based build number.
|
2019-08-23 17:16:08 +00:00
|
|
|
# That build number is generated by the scripts/version/gen_build_no.sh script.
|
2018-11-02 12:16:29 +00:00
|
|
|
if [[ -f "${BUILD_NUMBER_FILE}" ]]; then
|
2019-01-17 17:24:44 +00:00
|
|
|
echo "Build number file found, using: $(cat ${BUILD_NUMBER_FILE})" 1>&2
|
2018-11-02 12:16:29 +00:00
|
|
|
cat "${BUILD_NUMBER_FILE}"
|
|
|
|
else
|
2019-01-17 17:24:44 +00:00
|
|
|
echo "Build number file missing, using: ${DEV_BUILD_NUMBER}" 1>&2
|
2018-11-02 12:16:29 +00:00
|
|
|
echo "${DEV_BUILD_NUMBER}"
|
2018-05-07 12:32:46 +00:00
|
|
|
fi
|