Skip to content

Commit 2068a2d

Browse files
committed
android: Rust 1.82 increased min api level of 32-bit targets to 21
1 parent 43a3025 commit 2068a2d

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,14 @@ For the `qemu-user` runner, see ["qemu-user runner" section for linux-gnu target
306306
| target | api level | host | runner | note |
307307
| ------ | --------- | ---- | ------ | ---- |
308308
| `aarch64-linux-android` | 21 (default), 22-24, 26-33 [1] | x86_64 Linux | qemu-user | |
309-
| `arm-linux-androideabi` | 19 (default), 21-24, 26-33 [1] | x86_64 Linux | qemu-user | |
310-
| `armv7-linux-androideabi` | 19 (default), 21-24, 26-33 [1] | x86_64 Linux | qemu-user | |
311-
| `i686-linux-android` | 19 (default), 21-24, 26-33 [1] | x86_64 Linux | native (default), qemu-user | |
312-
| `thumbv7neon-linux-androideabi` | 19 (default), 21-24, 26-33 [1] | x86_64 Linux | qemu-user | |
309+
| `arm-linux-androideabi` | 21 / 19 [2] (default), 21-24, 26-33 [1] | x86_64 Linux | qemu-user | |
310+
| `armv7-linux-androideabi` | 21 / 19 [2] (default), 21-24, 26-33 [1] | x86_64 Linux | qemu-user | |
311+
| `i686-linux-android` | 21 / 19 [2] (default), 21-24, 26-33 [1] | x86_64 Linux | native (default), qemu-user | |
312+
| `thumbv7neon-linux-androideabi` | 21 / 19 [2] (default), 21-24, 26-33 [1] | x86_64 Linux | qemu-user | |
313313
| `x86_64-linux-android` | 21 (default), 22-24, 26-33 [1] | x86_64 Linux | native (default), qemu-user | |
314314

315315
[1] This action currently uses the API level 24 system image, so `cargo test` and `cargo run` may not work on API level 26+.
316+
[2]: [21 on Rust 1.82+](https://github.com/rust-lang/rust/pull/120593), otherwise 19.
316317

317318
You can select/pin the API level version by using `@` syntax in `target` option. For example:
318319

main.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ fi
5555
target="${INPUT_TARGET:?}"
5656
runner="${INPUT_RUNNER:-}"
5757

58+
host=$(rustc -vV | grep '^host:' | cut -d' ' -f2)
59+
rustc_version=$(rustc -vV | grep '^release:' | cut -d' ' -f2)
60+
rustc_minor_version="${rustc_version#*.}"
61+
rustc_minor_version="${rustc_minor_version%%.*}"
62+
5863
if [[ "${target}" == *"@"* ]]; then
5964
case "${target}" in
6065
*-android*)
@@ -69,6 +74,13 @@ if [[ "${target}" == *"@"* ]]; then
6974
else
7075
# NB: Sync with readme.
7176
case "${target}" in
77+
*-android*)
78+
api_level=21
79+
# https://github.com/rust-lang/rust/pull/120593 increased min api level of 32-bit targets to 21.
80+
if [[ "${rustc_minor_version}" -lt 82 ]]; then
81+
api_level=''
82+
fi
83+
;;
7284
*-freebsd*)
7385
# FreeBSD have binary compatibility with previous releases.
7486
# Therefore, the default is the minimum supported version.
@@ -93,10 +105,6 @@ fi
93105
target_lower="${target//-/_}"
94106
target_lower="${target_lower//./_}"
95107
target_upper=$(tr '[:lower:]' '[:upper:]' <<<"${target_lower}")
96-
host=$(rustc -vV | grep '^host:' | cut -d' ' -f2)
97-
rustc_version=$(rustc -vV | grep '^release:' | cut -d' ' -f2)
98-
rustc_minor_version="${rustc_version#*.}"
99-
rustc_minor_version="${rustc_minor_version%%.*}"
100108
rustup_target_list=$(rustup target list | cut -d' ' -f1)
101109

102110
install_apt_packages() {

0 commit comments

Comments
 (0)