1plugins {2 id "com.android.application"3 id "org.jetbrains.kotlin.android"4 id "org.jetbrains.kotlin.plugin.compose"5 id "org.jetbrains.kotlin.plugin.parcelize"6 id "org.jetbrains.kotlin.plugin.serialization"7 id "kotlin-kapt"8 id "com.google.dagger.hilt.android"9}1011dependencyLocking {12 lockAllConfigurations()13}1415android {16 namespace "com.peachpasswords"17 compileSdk 351819 // VERSION is the single semantic-version authority. versionCode remains20 // Android/Gradle metadata because Kepr's manifest does not carry it; the21 // updater enforces exact VERSION plus a strictly newer code.22 def versionAuthorityFile = rootProject.file("VERSION")23 if (!versionAuthorityFile.isFile()) {24 throw new GradleException("VERSION is missing; it is the semantic-version authority")25 }26 def semanticVersion = versionAuthorityFile.getText("UTF-8").trim()27 if (!(semanticVersion ==~ /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/)) {28 throw new GradleException("VERSION must contain exactly one strict major.minor.patch value")29 }30 def versionParts = semanticVersion.split("\\.")31 def vMajor = versionParts[0].toInteger()32 def vMinor = versionParts[1].toInteger()33 def vPatch = versionParts[2].toInteger()34 if (vMajor > 99 || vMinor > 99 || vPatch > 999) {35 throw new GradleException("VERSION components exceed versionCode encoding range (major/minor <= 99, patch <= 999)")36 }37 // Derive a strictly-monotonic versionCode from semver so it can never38 // accidentally stay flat across releases (which breaks the updater's39 // versionCode > currentVersionCode identity gate).40 def derivedVersionCode = vMajor * 1000000 + vMinor * 10000 + vPatch * 104142 defaultConfig {43 applicationId "com.peachpasswords"44 minSdk 2645 targetSdk 3546 versionCode derivedVersionCode47 versionName semanticVersion4849 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"50 vectorDrawables {51 useSupportLibrary true52 }53 }5455 splits {56 abi {57 enable true58 reset()59 include "arm64-v8a", "x86_64"60 universalApk false61 }62 }6364 signingConfigs {65 release {66 def props = new Properties()67 def localPropertiesFile = rootProject.file("local.properties")68 if (localPropertiesFile.isFile()) {69 localPropertiesFile.withInputStream { props.load(it) }70 }71 if (props.getProperty("peachStoreFile")) {72 storeFile file(props.getProperty("peachStoreFile"))73 storePassword props.getProperty("peachStorePassword")74 keyAlias props.getProperty("peachKeyAlias")75 keyPassword props.getProperty("peachKeyPassword")76 }77 enableV2Signing true78 enableV3Signing true79 }80 }8182 buildTypes {83 debug {84 applicationIdSuffix ".debug"85 versionNameSuffix "-debug"86 debuggable true87 }88 release {89 minifyEnabled true90 shrinkResources true91 proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"92 signingConfig signingConfigs.release93 }94 }9596 // Kepr Beta APKs use the established certificate so installed users can update.9798 compileOptions {99 sourceCompatibility JavaVersion.VERSION_17100 targetCompatibility JavaVersion.VERSION_17101 }102103 kotlinOptions {104 jvmTarget = "17"105 }106107 buildFeatures {108 compose true109 buildConfig true110 }111112 composeOptions {113 kotlinCompilerExtensionVersion "1.5.15"114 }115116 packaging {117 resources {118 excludes += [119 "/META-INF/{AL2.0,LGPL2.1}",120 "META-INF/DEPENDENCIES",121 "META-INF/LICENSE*",122 "META-INF/NOTICE*",123 ]124 }125 }126127 testOptions {128 unitTests.returnDefaultValues = true129 unitTests.all {130 def coreDir = rootProject.file("../peach-browser/crypto-core")131 def nativeLibrary = new File(132 coreDir,133 "target/release/libpeach_noise_core.dylib",134 )135 if (coreDir.exists()) {136 dependsOn rootProject.tasks.named(name.contains("Test") ? "buildRustNoiseHostTest" : "buildRustNoiseHost")137 systemProperty "peach.noise.library.path", nativeLibrary.absolutePath138 }139 }140 }141}142143dependencies {144 implementation platform("androidx.compose:compose-bom:2024.06.00")145 androidTestImplementation platform("androidx.compose:compose-bom:2024.06.00")146147 implementation "androidx.activity:activity-compose:1.9.2"148 implementation "androidx.autofill:autofill:1.1.0"149 implementation "androidx.biometric:biometric:1.1.0"150 implementation "androidx.core:core-splashscreen:1.0.1"151 implementation "androidx.appcompat:appcompat:1.7.0"152 implementation "androidx.credentials:credentials:1.5.0"153 implementation "androidx.credentials:credentials-play-services-auth:1.5.0"154 implementation "androidx.glance:glance-appwidget:1.1.0"155 implementation "androidx.glance:glance-material3:1.1.0"156 implementation "androidx.hilt:hilt-navigation-compose:1.2.0"157 // In-app updates: a periodic release check that survives Doze without a158 // service. hilt-work lets the worker take UpdateRepository by injection159 // rather than reaching for a global.160 implementation "androidx.hilt:hilt-work:1.2.0"161 kapt "androidx.hilt:hilt-compiler:1.2.0"162 implementation "androidx.work:work-runtime-ktx:2.9.1"163 implementation "androidx.lifecycle:lifecycle-runtime-compose:2.8.4"164 implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4"165 implementation "androidx.lifecycle:lifecycle-process:2.8.4"166 implementation "androidx.navigation:navigation-compose:2.8.0"167 // Deliberately pinned to 1.1.0-alpha06 (audit M-12). 1.1.0 stable exists168 // now and GradleDependency lint flags this coordinate; a bump is a policy169 // choice (Tink runtime vs. baseline AES, master-key rotation semantics),170 // not an oversight, and is tracked separately. Exact alpha (never a floating171 // range) so the resolved artifact is reproducible. Used only for the172 // duress/license EncryptedSharedPreferences; the vault slots are sealed by173 // VaultCrypto, not this.174 implementation "androidx.security:security-crypto:1.1.0-alpha06"175 implementation "androidx.compose.material3:material3"176 implementation "androidx.compose.ui:ui"177 implementation "androidx.compose.ui:ui-tooling-preview"178 implementation "androidx.compose.foundation:foundation"179 implementation "androidx.compose.material:material-icons-extended"180 implementation "androidx.core:core-ktx:1.13.1"181 implementation "com.google.android.material:material:1.12.0"182183 implementation "com.google.dagger:hilt-android:2.51.1"184 kapt "com.google.dagger:hilt-compiler:2.51.1"185 implementation "com.google.zxing:core:3.5.3"186 implementation "androidx.camera:camera-core:1.3.4"187 implementation "androidx.camera:camera-camera2:1.3.4"188 implementation "androidx.camera:camera-lifecycle:1.3.4"189 implementation "androidx.camera:camera-view:1.3.4"190 implementation "com.squareup.okhttp3:okhttp:4.12.0"191 implementation "org.bouncycastle:bcprov-jdk18on:1.84"192 // zstd-jni (reference libzstd) — per-section compression for the PeachScript193 // PCHS binary format (MF-2). Required for cross-platform interop with the194 // browser's zstd sections. The @aar variant ships the Android jniLibs195 // (lib/<abi>/libzstd-jni.so); the plain jar bundles only desktop natives and196 // would fail with UnsatisfiedLinkError on-device.197 implementation "com.github.luben:zstd-jni:1.5.6-3@aar"198 // The @aar ships only Android .so; the plain jar carries the desktop natives199 // the host JVM unit tests need.200 testImplementation "com.github.luben:zstd-jni:1.5.6-3"201 implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1"202 implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1"203204 debugImplementation "androidx.compose.ui:ui-tooling"205 debugImplementation "androidx.compose.ui:ui-test-manifest"206207 androidTestImplementation "androidx.test.ext:junit:1.2.1"208 androidTestImplementation "androidx.test:core:1.6.1"209 androidTestImplementation "androidx.test.espresso:espresso-core:3.6.1"210 androidTestImplementation "androidx.test.uiautomator:uiautomator:2.3.0"211 androidTestImplementation "androidx.compose.ui:ui-test-junit4"212213 testImplementation "junit:junit:4.13.2"214 // Real org.json on the unit-test classpath; android.jar's is a throwing stub,215 // so the release-manifest parser would otherwise be untestable off-device.216 testImplementation "org.json:json:20240303"217 testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1"218}