mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-17 19:07:02 +05:30
scripts: import cleanups from APS
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
4cd00a4b44
commit
f37682c154
2 changed files with 32 additions and 8 deletions
|
@ -3,19 +3,26 @@
|
|||
# Creates and boots an emulator that exactly matches the one in our CI. It is recommended
|
||||
# to use this as the target device for screenshot tests.
|
||||
|
||||
set -euxo pipefail
|
||||
set -euo pipefail
|
||||
|
||||
[ -n "${ANDROID_SDK_ROOT}" ] || { echo "ANDROID_SDK_ROOT must be set to use this script"; exit 1; }
|
||||
[ -n "${ANDROID_SDK_ROOT:-}" ] || {
|
||||
echo "ANDROID_SDK_ROOT must be set to use this script"
|
||||
exit
|
||||
1
|
||||
}
|
||||
[ -n "${ANDROID_API_LEVEL:-}" ] || { echo "ANDROID_API_LEVEL not defined; defaulting to 30"; }
|
||||
|
||||
API_LEVEL="${ANDROID_API_LEVEL:-30}"
|
||||
|
||||
echo no | "${ANDROID_SDK_ROOT}"/cmdline-tools/latest/bin/avdmanager create avd \
|
||||
--force \
|
||||
-n Pixel_XL_API_30 \
|
||||
--abi 'google_apis/x86' \
|
||||
--package 'system-images;android-30;google_apis;x86' \
|
||||
--package "system-images;android-${API_LEVEL};google_apis;x86" \
|
||||
--device 'pixel_xl'
|
||||
|
||||
"${ANDROID_SDK_ROOT}"/emulator/emulator \
|
||||
-avd Pixel_XL_API_30 \
|
||||
-avd "Pixel_XL_API_${API_LEVEL}" \
|
||||
-no-window \
|
||||
-gpu swiftshader_indirect \
|
||||
-no-snapshot \
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo pipefail
|
||||
# Installs the latest command line tools and sets up the necessary packages for an Android emulator
|
||||
# for API level $ANDROID_API_LEVEL, or API 30 if unspecified.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CMDLINE_TOOLS_URL_MAC="https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip"
|
||||
CMDLINE_TOOLS_URL_LINUX="https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip"
|
||||
|
||||
[ -n "${ANDROID_SDK_ROOT:-}" ] || {
|
||||
echo "ANDROID_SDK_ROOT must be set to use this script"
|
||||
exit
|
||||
1
|
||||
}
|
||||
|
||||
if [ "$(uname)" == "Linux" ]; then
|
||||
wget "${CMDLINE_TOOLS_URL_LINUX}" -O /tmp/tools.zip -o /dev/null
|
||||
elif [ "$(uname)" == "Darwin" ]; then
|
||||
|
@ -13,13 +22,21 @@ else
|
|||
echo "This script only works on Linux and Mac"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -n "${ANDROID_API_LEVEL:-}" ] || { echo "ANDROID_API_LEVEL not defined; defaulting to 30"; }
|
||||
|
||||
API_LEVEL="${ANDROID_API_LEVEL:-30}"
|
||||
|
||||
unzip -qo /tmp/tools.zip -d "${ANDROID_SDK_ROOT}/latest"
|
||||
mkdir -p "${ANDROID_SDK_ROOT}/cmdline-tools"
|
||||
if [ -d "${ANDROID_SDK_ROOT}/cmdline-tools" ]; then
|
||||
rm -rf "${ANDROID_SDK_ROOT}/cmdline-tools"
|
||||
fi
|
||||
mkdir -p "${ANDROID_SDK_ROOT}/cmdline-tools"
|
||||
mv -v "${ANDROID_SDK_ROOT}/latest/cmdline-tools" "${ANDROID_SDK_ROOT}/cmdline-tools/latest"
|
||||
|
||||
export PATH="${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${PATH}"
|
||||
|
||||
sdkmanager --install 'build-tools;30.0.3' platform-tools 'platforms;android-30'
|
||||
sdkmanager --install 'build-tools;30.0.3' platform-tools "platforms;android-${API_LEVEL}"
|
||||
sdkmanager --install emulator
|
||||
sdkmanager --install 'system-images;android-30;google_apis;x86'
|
||||
|
||||
sdkmanager --install "system-images;android-${API_LEVEL};google_apis;x86"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue