forked from TGX-Android/Telegram-X
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-sdk.sh
executable file
·38 lines (31 loc) · 1.6 KB
/
setup-sdk.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
#!/bin/bash
set -e
# shellcheck source=set-env.sh
source "$(dirname "$0")"/set-env.sh "$1"
# Fetching SDK
echo "Checking Android SDK: ${ANDROID_SDK_ROOT}..." && (test -d "$ANDROID_SDK_ROOT" || mkdir -p "$ANDROID_SDK_ROOT")
# Fetching cmdline-tools
CMDLINE_VERSION=$(read-property.sh version.properties version.cmdline_tools)
pushd "$ANDROID_SDK_ROOT"
if [ ! -d "$ANDROID_SDK_ROOT/cmdline-tools/latest" ]; then
test -f cmdline-tools.zip || (echo "Downloading cmdline-tools..." && wget -O cmdline-tools.zip "https://dl.google.com/android/repository/commandlinetools-${PLATFORM}-${CMDLINE_VERSION}_latest.zip")
echo "Installing cmdline-tools..."
unzip cmdline-tools.zip -d cmdline-tools
mv -f cmdline-tools/cmdline-tools cmdline-tools/latest
fi
popd
# Downloading packages
BUILD_TOOLS_VERSION=$(read-property.sh version.properties version.build_tools)
NDK_VERSION=$(read-property.sh version.properties version.ndk)
COMPILE_SDK_VERSION=$(read-property.sh version.properties version.sdk_compile)
CMAKE_VERSION=$(read-property.sh version.properties version.cmake)
yes | "$ANDROID_SDK_ROOT"/cmdline-tools/latest/bin/sdkmanager --licenses
yes | "$ANDROID_SDK_ROOT"/cmdline-tools/latest/bin/sdkmanager --update
yes | "$ANDROID_SDK_ROOT"/cmdline-tools/latest/bin/sdkmanager --install \
"platforms;android-$COMPILE_SDK_VERSION" \
"build-tools;$BUILD_TOOLS_VERSION" \
"ndk;$NDK_VERSION" \
"cmake;$CMAKE_VERSION"
test -d "$ANDROID_SDK_ROOT" || (echo "ANDROID_SDK_ROOT ($ANDROID_SDK_ROOT) not found!" && exit 1)
test -d "$ANDROID_NDK" || (echo "ANDROID_NDK ($ANDROID_NDK) not found!" && exit 1)
echo "SDK setup is now complete!"