forked from TelegramMessenger/Telegram-iOS
-
Notifications
You must be signed in to change notification settings - Fork 11
/
prepare-build-variables-Telegram.sh
executable file
·78 lines (69 loc) · 2.21 KB
/
prepare-build-variables-Telegram.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
set -e
prepare_build_variables () {
BUILD_TYPE="$1"
case "$BUILD_TYPE" in
development)
APS_ENVIRONMENT="development"
;;
distribution)
APS_ENVIRONMENT="production"
;;
*)
echo "Unknown build provisioning type: $BUILD_TYPE"
exit 1
;;
esac
local BAZEL="$(which bazel)"
if [ "$BAZEL" = "" ]; then
echo "bazel not found in PATH"
exit 1
fi
local EXPECTED_VARIABLES=(\
BUILD_NUMBER \
APP_VERSION \
BUNDLE_ID \
DEVELOPMENT_TEAM \
API_ID \
API_HASH \
APP_CENTER_ID \
IS_INTERNAL_BUILD \
IS_APPSTORE_BUILD \
APPSTORE_ID \
APP_SPECIFIC_URL_SCHEME \
PREMIUM_IAP_PRODUCT_ID \
TELEGRAM_DISABLE_EXTENSIONS \
)
local MISSING_VARIABLES="0"
for VARIABLE_NAME in ${EXPECTED_VARIABLES[@]}; do
if [ "${!VARIABLE_NAME}" = "" ]; then
echo "$VARIABLE_NAME not defined"
MISSING_VARIABLES="1"
fi
done
if [ "$MISSING_VARIABLES" == "1" ]; then
exit 1
fi
local VARIABLES_DIRECTORY="build-input/data"
mkdir -p "$VARIABLES_DIRECTORY"
local VARIABLES_PATH="$VARIABLES_DIRECTORY/variables.bzl"
rm -f "$VARIABLES_PATH"
echo "telegram_build_number = \"$BUILD_NUMBER\"" >> "$VARIABLES_PATH"
echo "telegram_version = \"$APP_VERSION\"" >> "$VARIABLES_PATH"
echo "telegram_bundle_id = \"$BUNDLE_ID\"" >> "$VARIABLES_PATH"
echo "telegram_api_id = \"$API_ID\"" >> "$VARIABLES_PATH"
echo "telegram_team_id = \"$DEVELOPMENT_TEAM\"" >> "$VARIABLES_PATH"
echo "telegram_api_hash = \"$API_HASH\"" >> "$VARIABLES_PATH"
echo "telegram_app_center_id = \"$APP_CENTER_ID\"" >> "$VARIABLES_PATH"
echo "telegram_is_internal_build = \"$IS_INTERNAL_BUILD\"" >> "$VARIABLES_PATH"
echo "telegram_is_appstore_build = \"$IS_APPSTORE_BUILD\"" >> "$VARIABLES_PATH"
echo "telegram_appstore_id = \"$APPSTORE_ID\"" >> "$VARIABLES_PATH"
echo "telegram_app_specific_url_scheme = \"$APP_SPECIFIC_URL_SCHEME\"" >> "$VARIABLES_PATH"
echo "telegram_premium_iap_product_id = \"$PREMIUM_IAP_PRODUCT_ID\"" >> "$VARIABLES_PATH"
echo "telegram_aps_environment = \"$APS_ENVIRONMENT\"" >> "$VARIABLES_PATH"
if [ "$TELEGRAM_DISABLE_EXTENSIONS" == "1" ]; then
echo "telegram_disable_extensions = True" >> "$VARIABLES_PATH"
else
echo "telegram_disable_extensions = False" >> "$VARIABLES_PATH"
fi
}