Skip to content

Commit b4b4f9b

Browse files
committed
Attempt to use newer Android SDK
This is copied from the rust-lang/libc CI scripts.
1 parent 30c2aba commit b4b4f9b

File tree

7 files changed

+73
-33
lines changed

7 files changed

+73
-33
lines changed

ci/android-ndk.sh

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,41 @@
1-
set -ex
2-
3-
ANDROID_ARCH=$1
4-
ANDROID_SDK_VERSION=4333796
1+
#!/usr/bin/env sh
52

6-
mkdir /tmp/android
7-
cd /tmp/android
3+
set -ex
84

9-
curl -o android-sdk.zip \
10-
"https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip"
11-
unzip -q android-sdk.zip
5+
NDK=android-ndk-r21d
6+
wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip
7+
unzip -q ${NDK}-linux-x86_64.zip
128

13-
yes | ./tools/bin/sdkmanager --licenses > /dev/null
14-
./tools/bin/sdkmanager ndk-bundle > /dev/null
9+
case "$1" in
10+
arm)
11+
arch=arm
12+
api=28
13+
;;
14+
armv7)
15+
arch=arm
16+
api=28
17+
;;
18+
aarch64)
19+
arch=arm64
20+
api=28
21+
;;
22+
i686)
23+
arch=x86
24+
api=28
25+
;;
26+
x86_64)
27+
arch=x86_64
28+
api=28
29+
;;
30+
*)
31+
echo "invalid arch: $1"
32+
exit 1
33+
;;
34+
esac;
1535

16-
./ndk-bundle/build/tools/make_standalone_toolchain.py \
17-
--arch $ANDROID_ARCH \
18-
--stl=libc++ \
19-
--api 21 \
20-
--install-dir /android-toolchain
36+
python3 ${NDK}/build/tools/make_standalone_toolchain.py \
37+
--install-dir "/android-toolchain" \
38+
--arch "${arch}" \
39+
--api ${api}
2140

22-
cd /tmp
23-
rm -rf android
41+
rm -rf ./${NDK}-linux-x86_64.zip ./${NDK}

ci/android-sdk.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ set -ex
99
# located in https://github.com/appunite/docker by just wrapping it in a script
1010
# which apparently magically accepts the licenses.
1111

12-
SDK=4333796
13-
mkdir sdk
14-
curl --retry 20 https://dl.google.com/android/repository/sdk-tools-linux-${SDK}.zip -O
15-
unzip -q -d sdk sdk-tools-linux-${SDK}.zip
12+
SDK=6609375
13+
mkdir -p sdk/cmdline-tools
14+
wget -q --tries=20 https://dl.google.com/android/repository/commandlinetools-linux-${SDK}_latest.zip
15+
unzip -q -d sdk/cmdline-tools commandlinetools-linux-${SDK}_latest.zip
1616

1717
case "$1" in
1818
arm | armv7)
1919
api=24
20-
image="system-images;android-${api};google_apis;armeabi-v7a"
20+
image="system-images;android-${api};default;armeabi-v7a"
2121
;;
2222
aarch64)
2323
api=24
@@ -51,15 +51,22 @@ echo '#Fri Nov 03 10:11:27 CET 2017 count=0' >> /root/.android/repositories.cfg
5151
#
5252
# | grep -v = || true removes the progress bar output from the sdkmanager
5353
# which produces an insane amount of output.
54-
yes | ./sdk/tools/bin/sdkmanager --licenses --no_https | grep -v = || true
55-
yes | ./sdk/tools/bin/sdkmanager --no_https \
56-
"emulator" \
54+
yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --licenses --no_https | grep -v = || true
55+
yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --no_https \
5756
"platform-tools" \
5857
"platforms;android-${api}" \
5958
"${image}" | grep -v = || true
6059

60+
# The newer emulator versions (31.3.12 or higher) fail to a valid AVD and the test gets stuck.
61+
# Until we figure out why, we use the older version (31.3.11).
62+
wget -q --tries=20 https://redirector.gvt1.com/edgedl/android/repository/emulator-linux_x64-9058569.zip
63+
unzip -q -d sdk emulator-linux_x64-9058569.zip
64+
65+
cp /android/android-emulator-package.xml /android/sdk/emulator/package.xml
66+
6167
echo "no" |
62-
./sdk/tools/bin/avdmanager create avd \
68+
./sdk/cmdline-tools/tools/bin/avdmanager create avd \
6369
--name "${1}" \
6470
--package "${image}" | grep -v = || true
6571

72+
rm -rf commandlinetools-linux-${SDK}_latest.zip emulator-linux_x64-9058569.zip

ci/docker/aarch64-linux-android/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
77
openjdk-8-jre \
88
python \
99
gcc \
10-
libc6-dev
10+
libc6-dev \
11+
wget \
12+
python3 \
13+
python3-distutils
1114

1215
COPY android-ndk.sh /
1316
RUN /android-ndk.sh arm64

ci/docker/arm-linux-androideabi/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
77
openjdk-8-jre \
88
python \
99
gcc \
10-
libc6-dev
10+
libc6-dev \
11+
wget \
12+
python3 \
13+
python3-distutils
1114

1215
COPY android-ndk.sh /
1316
RUN /android-ndk.sh arm

ci/docker/armv7-linux-androideabi/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
77
openjdk-8-jre \
88
python \
99
gcc \
10-
libc6-dev
10+
libc6-dev \
11+
wget \
12+
python3 \
13+
python3-distutils
1114

1215
COPY android-ndk.sh /
1316
RUN /android-ndk.sh arm

ci/docker/i686-linux-android/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
77
openjdk-8-jre \
88
python \
99
gcc \
10-
libc6-dev
10+
libc6-dev \
11+
wget \
12+
python3 \
13+
python3-distutils
1114

1215
COPY android-ndk.sh /
13-
RUN /android-ndk.sh x86
16+
RUN /android-ndk.sh i686
1417
ENV PATH=$PATH:/android-toolchain/bin
1518

1619
# TODO: run tests in an emulator eventually

ci/docker/x86_64-linux-android/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
77
openjdk-8-jre \
88
python \
99
gcc \
10-
libc6-dev
10+
libc6-dev \
11+
wget \
12+
python3 \
13+
python3-distutils
1114

1215
COPY android-ndk.sh /
1316
RUN /android-ndk.sh x86_64

0 commit comments

Comments
 (0)