Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / e2ee-p2p / build.gradle.kts
build.gradle.kts56 lines · 2.3 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-library") |
| 3 | } |
| 4 | |
| 5 | android { |
| 6 | // The convention plugin derives the namespace from the module name, which contains a hyphen |
| 7 | // ("e2ee-p2p") and is not a valid package segment — so set it explicitly. |
| 8 | namespace = "com.vayunmathur.e2ee" |
| 9 | } |
| 10 | |
| 11 | androidComponents { |
| 12 | onVariants { variant -> |
| 13 | variant.sources.jniLibs?.addStaticSourceDirectory( |
| 14 | layout.buildDirectory.dir("rustJniLibs").get().asFile.absolutePath |
| 15 | ) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | // Native post-quantum crypto (Rust: fips203 ML-KEM-768 + fips204 ML-DSA-65). |
| 20 | // See library/e2ee-p2p/src/main/rust/. Replaces Bouncy Castle; keys cross as DER, |
| 21 | // byte-compatible with the previously-deployed BC encoding. |
| 22 | // OpenPGP (rPGP) used to live in this crate too; it moved to :library:e2ee-openpgp's |
| 23 | // `e2ee_pgp` crate so non-mail apps don't link the PGP cipher suite (#873). |
| 24 | // armeabi-v7a as well as arm64: :cast:tv runs on 32-bit-userspace Google TV hardware |
| 25 | // and links this .so. Phone apps filter it back out via their arm64-only abiFilters. |
| 26 | // `-PemulatorAbi=x86_64` additionally builds x86_64 so consumers (notably |
| 27 | // :games:voxels' on-emulator screenshot capture) can run on an x86_64 emulator. |
| 28 | rustNativeLib( |
| 29 | "e2ee_pqc", |
| 30 | "e2ee-pqc", |
| 31 | extraAbis = listOf(ABI_ARMV7) + if (providers.gradleProperty("emulatorAbi").orNull == ABI_X86_64) { |
| 32 | listOf(ABI_X86_64) |
| 33 | } else { |
| 34 | emptyList() |
| 35 | }, |
| 36 | ) |
| 37 | |
| 38 | // Only the classes below actually load a native library: PqcTest drives |
| 39 | // Pqc.generateKem/generateDsa/encryptTo/signWith directly (libe2ee_pqc via |
| 40 | // PqcNative), and E2eeHkdfIdentityTest's identity tests mint and reload a |
| 41 | // PqcIdentity through the same bridge (its HKDF/AES/security-code tests |
| 42 | // are pure, but the class cannot be split below class granularity). |
| 43 | // InviteFingerprintTest is pure hashing over a fixed bundle and never |
| 44 | // touches Pqc. Quarantine the loaders into testDebugUnitTestNative |
| 45 | // (forkEvery = 1); InviteFingerprintTest batches 20-per-JVM in |
| 46 | // testDebugUnitTest, which depends on the quarantine task so the usual |
| 47 | // invocation still runs everything. No isolatedClasses: no |
| 48 | // DataStore/ViewModel or process-wide singleton here. |
| 49 | rustNativeTests { |
| 50 | nativeClasses.addAll( |
| 51 | listOf( |
| 52 | "com.vayunmathur.e2ee.E2eeHkdfIdentityTest", |
| 53 | "com.vayunmathur.e2ee.PqcTest", |
| 54 | ) |
| 55 | ) |
| 56 | } |