Skip to content

Commit ae240b3

Browse files
romtsnclaude
andcommitted
fix(cli): Normalize Linux ARM64 arch name for sentry-cli binary lookup
The JVM can report `os.arch` as `"arm64"` on some systems (e.g., Docker on Apple Silicon), but the bundled binary is named `sentry-cli-Linux-aarch64`. Normalize both ARM (`arm64`/`aarch64`) and x86 (`amd64`/`x86_64`) arch names to match the bundled binary naming convention. Fixes #1168 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 84c808f commit ae240b3

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

plugin-build/src/main/kotlin/io/sentry/android/gradle/SentryCliProvider.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,14 @@ internal object SentryCliProvider {
134134
val osArch = System.getProperty("os.arch")
135135
return when {
136136
"mac" in osName -> "Darwin-universal"
137-
"linux" in osName -> if (osArch == "amd64") "Linux-x86_64" else "Linux-$osArch"
137+
"linux" in osName -> {
138+
val normalizedArch = when (osArch) {
139+
"amd64", "x86_64" -> "x86_64"
140+
"arm64", "aarch64" -> "aarch64"
141+
else -> osArch
142+
}
143+
"Linux-$normalizedArch"
144+
}
138145
"win" in osName -> "Windows-i686.exe"
139146
else -> null
140147
}

plugin-build/src/test/kotlin/io/sentry/android/gradle/SentryCliProviderTest.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,24 @@ class SentryCliProviderTest {
159159
assertEquals("Linux-x86_64", getCliSuffix())
160160
}
161161

162+
@Test
163+
@WithSystemProperty(["os.name", "os.arch"], ["linux", "x86_64"])
164+
fun `getCliSuffix on linux x86_64 returns Linux-x86_64`() {
165+
assertEquals("Linux-x86_64", getCliSuffix())
166+
}
167+
168+
@Test
169+
@WithSystemProperty(["os.name", "os.arch"], ["linux", "arm64"])
170+
fun `getCliSuffix on linux arm64 returns Linux-aarch64`() {
171+
assertEquals("Linux-aarch64", getCliSuffix())
172+
}
173+
174+
@Test
175+
@WithSystemProperty(["os.name", "os.arch"], ["linux", "aarch64"])
176+
fun `getCliSuffix on linux aarch64 returns Linux-aarch64`() {
177+
assertEquals("Linux-aarch64", getCliSuffix())
178+
}
179+
162180
@Test
163181
@WithSystemProperty(["os.name", "os.arch"], ["linux", "armV7"])
164182
fun `getCliSuffix on linux armV7 returns Linux-armV7`() {

0 commit comments

Comments
 (0)