android-app-native/app/.Makefile.scripts/make--android-sdk.sh

40 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
set -x
# get configuration
source app-config.sh
# in case needed download and install `sdkmanager`
type sdkmanager 2>/dev/null || (
BUILD_TOOLS="$(realpath -m "$BUILD_TOOLS_LATEST/..")"
mkdir -p "$BUILD_TOOLS"
cd "$BUILD_TOOLS"
for LATESTTOOLS in \
"$(curl 'https://developer.android.com/studio#command-line-tools-only' |
grep -e 'https://dl.google.com/android/repository/commandlinetools-linux-.*_latest.zip' | cut -f2 -d'"')" \
'https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip'
do
echo "testing to get '$LATESTTOOLS'"
echo test "${LATESTTOOLS:0:22}" = "https://dl.google.com/" -a "${LATESTTOOLS:(-11)}" = "_latest.zip"
test "${LATESTTOOLS:0:22}" = "https://dl.google.com/" -a "${LATESTTOOLS:(-11)}" = "_latest.zip" || {
echo "unsure of URL $LATESTTOOLS correct, skipping it..." >&2
continue;
}
wget -O cmdline-tools.zip "$LATESTTOOLS"
unzip cmdline-tools.zip && break || {
echo "error downloading working cmdline-tools.zip"
exit 1
}
done
ls
ls cmdline-tools
rm cmdline-tools.zip
mv -v cmdline-tools "$BUILD_TOOLS_LATEST" || true
)
test -f android-sdk/installed || {
sdkmanager --install "build-tools;29.0.3" "cmake;3.10.2.4988404" "ndk;21.1.6352462" "platform-tools" "platforms;android-29" "tools" &&
touch android-sdk/installed || exit 1
}