Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
translate ▾

Modern-Apps.git / build-logic / src / main / kotlin / NativeAbis.kt

NativeAbis.kt42 lines · 1.6 KiBRaw
1import org.gradle.api.provider.Property
2
3/** arm64-v8a: every phone/tablet target and the Apple-Silicon emulator. */
4const val ABI_ARM64 = "arm64-v8a"
5
6/** armeabi-v7a: 32-bit-userspace devices, notably Google TV boxes. */
7const val ABI_ARMV7 = "armeabi-v7a"
8
9/**
10 * 64-bit x86, which no shipping device uses — it is what the Android emulator runs on an
11 * x86_64 host.
12 *
13 * No app should package this: `arm64-v8a` covers every phone and tablet, and on Apple
14 * Silicon the emulator is arm64 too. It exists so a native module can be *tested* in an
15 * emulator on an x86_64 host, where the alternative is a full-system QEMU translation of an
16 * arm64 image. Opt in per module through `rustNativeLib`'s `extraAbis`, and gate it on a
17 * Gradle property so release builds never carry it.
18 */
19const val ABI_X86_64 = "x86_64"
20
21/**
22 * Per-app ABI opt-in, consumed by `common-conventions-app`. Apps stay arm64-only
23 * unless they declare otherwise:
24 *
25 * ```
26 * nativeAbis { armv7 = true }
27 * ```
28 */
29interface NativeAbisExtension {
30 /**
31 * Also package [ABI_ARMV7]. Needed by apps that must run on 32-bit-userspace
32 * devices: the onn 4K Streaming Box and most Google TV hardware report only
33 * `armeabi-v7a,armeabi` in `ro.product.cpu.abilist`, so an arm64-only APK is
34 * rejected at install with "Could not find build of variant which supports
35 * density N and an ABI in armeabi-v7a, armeabi".
36 *
37 * Native (Rust) dependencies must opt in separately via `rustNativeLib`'s
38 * `extraAbis`, since `abiFilters` only filters what was built - it cannot
39 * conjure an .so for an ABI that was never cross-compiled.
40 */
41 val armv7: Property<Boolean>
42}