Skip to content

Commit 9c4a201

Browse files
committed
Changes on PR feedback
- Check rustup on common installation paths and user's $PATH or %PATH% - fail the build if rustup is not found - Use NDK LTS r27d
1 parent 9d7f885 commit 9c4a201

File tree

7 files changed

+31
-16
lines changed

7 files changed

+31
-16
lines changed

.github/workflows/android-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set up NDK
2525
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410
2626
with:
27-
ndk-version: r29
27+
ndk-version: r27d
2828
link-to-sdk: true
2929
local-cache: true
3030
- name: Install Rust

.github/workflows/android-debug-artifact-ondemand.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Set up NDK
4444
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410
4545
with:
46-
ndk-version: r29
46+
ndk-version: r27d
4747
link-to-sdk: true
4848
local-cache: true
4949
- name: Install Rust

.github/workflows/android-debug-artifact-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up NDK
1818
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410
1919
with:
20-
ndk-version: r29
20+
ndk-version: r27d
2121
link-to-sdk: true
2222
local-cache: true
2323
- name: Install Rust

.github/workflows/android-feature.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
id: setup-ndk
2727
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410
2828
with:
29-
ndk-version: r29
29+
ndk-version: r27d
3030
link-to-sdk: true
3131
local-cache: true
3232
- name: Check formatting using spotless

.github/workflows/android-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Set up NDK
2626
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410
2727
with:
28-
ndk-version: r29
28+
ndk-version: r27d
2929
link-to-sdk: true
3030
local-cache: true
3131
- name: Check formatting using spotless

gradle/setupRustAndroidLocal.gradle

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,33 @@ tasks.register("setupRustAndroidLocal") {
77
}
88

99
// Detect existence of rustup.
10-
def rustupExists = exec {
11-
commandLine("which", "rustup")
12-
ignoreExitValue true
13-
}.exitValue == 0
10+
def rustupExists = {
1411

15-
if (!rustupExists) {
16-
println("rustup not found. Installing rustup...")
17-
exec {
18-
commandLine("sh", "-c",
19-
"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --default-toolchain none --no-modify-path"
20-
)
12+
// First check common installation path
13+
def isWindows = System.getProperty("os.name").toLowerCase().contains("windows")
14+
def home = System.getProperty("user.home")
15+
def rustupPath = isWindows
16+
? new File(home, ".cargo/bin/rustup.exe")
17+
: new File(home, ".cargo/bin/rustup")
18+
19+
if (rustupPath.exists() && rustupPath.canExecute()) {
20+
return true
2121
}
22+
23+
// If not, check on user $PATH/%PATH%
24+
try {
25+
def process = new ProcessBuilder("rustup")
26+
.redirectErrorStream(true)
27+
.start()
28+
process.waitFor()
29+
return process.exitValue() == 0
30+
} catch (IOException ignored) {
31+
return false
32+
}
33+
}()
34+
35+
if (!rustupExists) {
36+
throw new GradleException("rustup is not installed or not found in PATH. Please install rustup from https://rustup.rs/ and ensure it is accessible.")
2237
}
2338

2439
doLast {

gradle/tools.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[versions]
22
compileSdk = "34"
33
jvmTarget = "17"
4-
ndk = "29.0.14206865" #r29
4+
ndk = "27.3.13750724" #r27d LTS

0 commit comments

Comments
 (0)