fix(android): skip gradle resource tasks on linux arm

This commit is contained in:
Vincent Koc
2026-06-05 08:14:42 -07:00
parent 520992a1de
commit da88940c6c
3 changed files with 140 additions and 9 deletions

View File

@@ -0,0 +1,40 @@
import { describe, expect, it } from "vitest";
import {
linuxArmAndroidGradleSkipMessage,
shouldSkipLinuxArmAndroidGradle,
splitAndroidGradleArgs,
} from "../../scripts/run-android-gradle.mjs";
describe("run-android-gradle", () => {
it("splits Gradle args from an optional post command", () => {
expect(
splitAndroidGradleArgs([":app:installPlayDebug", "--", "adb", "shell", "am", "start"]),
).toEqual({
gradleArgs: [":app:installPlayDebug"],
postArgs: ["adb", "shell", "am", "start"],
});
});
it("skips Linux ARM hosts by default because AAPT2 is x86_64-only", () => {
expect(shouldSkipLinuxArmAndroidGradle({ arch: "arm64", platform: "linux" })).toBe(true);
expect(shouldSkipLinuxArmAndroidGradle({ arch: "arm", platform: "linux" })).toBe(true);
expect(shouldSkipLinuxArmAndroidGradle({ arch: "x64", platform: "linux" })).toBe(false);
expect(shouldSkipLinuxArmAndroidGradle({ arch: "arm64", platform: "darwin" })).toBe(false);
});
it("allows an explicit Linux ARM override", () => {
expect(
shouldSkipLinuxArmAndroidGradle({
arch: "arm64",
env: { OPENCLAW_ANDROID_GRADLE_ALLOW_LINUX_ARM: "1" },
platform: "linux",
}),
).toBe(false);
});
it("explains the skip with the override escape hatch", () => {
expect(linuxArmAndroidGradleSkipMessage("linux", "arm64")).toContain(
"OPENCLAW_ANDROID_GRADLE_ALLOW_LINUX_ARM=1",
);
});
});