Skip to content

Commit bdec138

Browse files
committed
Upgrade Android SDK & NDK
This PR copies the updated install scripts from rust-lang/libc
1 parent 790411f commit bdec138

File tree

3 files changed

+59
-62
lines changed

3 files changed

+59
-62
lines changed

ci/android-install-ndk.sh

+23-20
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
#!/usr/bin/env sh
2-
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
3-
# file at the top-level directory of this distribution and at
4-
# http://rust-lang.org/COPYRIGHT.
5-
#
6-
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7-
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8-
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9-
# option. This file may not be copied, modified, or distributed
10-
# except according to those terms.
112

123
set -ex
134

14-
curl --retry 5 -O \
15-
https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip
16-
unzip -q android-ndk-r15b-linux-x86_64.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
178

18-
case "${1}" in
9+
case "$1" in
10+
arm)
11+
arch=arm
12+
api=28
13+
;;
14+
armv7)
15+
arch=arm
16+
api=28
17+
;;
1918
aarch64)
2019
arch=arm64
20+
api=28
2121
;;
22-
2322
i686)
2423
arch=x86
24+
api=28
25+
;;
26+
x86_64)
27+
arch=x86_64
28+
api=28
2529
;;
26-
2730
*)
28-
arch="${1}"
31+
echo "invalid arch: $1"
32+
exit 1
2933
;;
3034
esac;
3135

32-
android-ndk-r15b/build/tools/make_standalone_toolchain.py \
33-
--unified-headers \
36+
python3 ${NDK}/build/tools/make_standalone_toolchain.py \
3437
--install-dir "/android/ndk-${1}" \
3538
--arch "${arch}" \
36-
--api 24
39+
--api ${api}
3740

38-
rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b
41+
rm -rf ./${NDK}-linux-x86_64.zip ./${NDK}

ci/android-install-sdk.sh

+32-28
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
#!/usr/bin/env sh
2-
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
3-
# file at the top-level directory of this distribution and at
4-
# http://rust-lang.org/COPYRIGHT.
5-
#
6-
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7-
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8-
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9-
# option. This file may not be copied, modified, or distributed
10-
# except according to those terms.
112

123
set -ex
134

@@ -18,43 +9,56 @@ set -ex
189
# located in https://github.com/appunite/docker by just wrapping it in a script
1910
# which apparently magically accepts the licenses.
2011

21-
mkdir sdk
22-
curl --retry 5 https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O
23-
unzip -d sdk sdk-tools-linux-4333796.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
2416

2517
case "$1" in
2618
arm | armv7)
27-
abi=armeabi-v7a
19+
api=24
20+
image="system-images;android-${api};default;armeabi-v7a"
2821
;;
29-
3022
aarch64)
31-
abi=arm64-v8a
23+
api=24
24+
image="system-images;android-${api};google_apis;arm64-v8a"
3225
;;
33-
3426
i686)
35-
abi=x86
27+
api=28
28+
image="system-images;android-${api};default;x86"
3629
;;
37-
3830
x86_64)
39-
abi=x86_64
31+
api=28
32+
image="system-images;android-${api};default;x86_64"
4033
;;
41-
4234
*)
4335
echo "invalid arch: $1"
4436
exit 1
4537
;;
4638
esac;
4739

40+
# Try to fix warning about missing file.
41+
# See https://askubuntu.com/a/1078784
42+
mkdir -p /root/.android/
43+
echo '### User Sources for Android SDK Manager' >> /root/.android/repositories.cfg
44+
echo '#Fri Nov 03 10:11:27 CET 2017 count=0' >> /root/.android/repositories.cfg
45+
46+
# Print all available packages
47+
# yes | ./sdk/tools/bin/sdkmanager --list --verbose
48+
4849
# --no_https avoids
4950
# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
50-
yes | ./sdk/tools/bin/sdkmanager --licenses --no_https
51-
yes | ./sdk/tools/bin/sdkmanager --no_https \
52-
"emulator" \
53-
"platform-tools" \
54-
"platforms;android-24" \
55-
"system-images;android-24;default;$abi"
51+
#
52+
# | grep -v = || true removes the progress bar output from the sdkmanager
53+
# which produces an insane amount of output.
54+
yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --licenses --no_https | grep -v = || true
55+
yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --no_https \
56+
"emulator" \
57+
"platform-tools" \
58+
"platforms;android-${api}" \
59+
"${image}" | grep -v = || true
5660

5761
echo "no" |
58-
./sdk/tools/bin/avdmanager create avd \
62+
./sdk/cmdline-tools/tools/bin/avdmanager create avd \
5963
--name "${1}" \
60-
--package "system-images;android-24;default;$abi"
64+
--package "${image}" | grep -v = || true

ci/android-sysimage.sh

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
#!/usr/bin/env bash
22

3-
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
4-
# file at the top-level directory of this distribution and at
5-
# http://rust-lang.org/COPYRIGHT.
6-
#
7-
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8-
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9-
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10-
# option. This file may not be copied, modified, or distributed
11-
# except according to those terms.
12-
133
set -ex
144

155
URL=https://dl.google.com/android/repository/sys-img/android
@@ -23,13 +13,13 @@ main() {
2313

2414
apt-get install --no-install-recommends e2tools
2515

26-
pushd "$td"
27-
curl --retry 5 -O "${URL}/${name}"
16+
pushd "${td}"
17+
wget -q --tries=5 "${URL}/${name}"
2818
unzip -q "${name}"
2919

3020
local system
31-
system=$(find . -name system.img)
32-
mkdir -p $dest/{bin,lib,lib64}
21+
system="$(find . -name system.img)"
22+
mkdir -p ${dest}/{bin,lib,lib64}
3323

3424
# Extract android linker and libraries to /system
3525
# This allows android executables to be run directly (or with qemu)

0 commit comments

Comments
 (0)