app/build.gradle.kts (2242 bytes)
1 import java.util.Properties 2 3 plugins { 4 id("com.android.application") 5 id("org.jetbrains.kotlin.android") 6 } 7 8 /** 9 * Release signing is optional. The keys come from keystore.properties in the 10 * root of the project, which is not in the repository. Without that file the 11 * release build still runs and makes an unsigned APK, so a fresh clone always 12 * builds. 13 */ 14 val keystoreProps = Properties().apply { 15 val f = rootProject.file("keystore.properties") 16 if (f.exists()) f.inputStream().use { load(it) } 17 } 18 val hasSigning = keystoreProps.getProperty("storeFile") != null 19 20 android { 21 namespace = "dev.equwal.inkupdate" 22 compileSdk = 36 23 24 defaultConfig { 25 applicationId = "dev.equwal.inkupdate" 26 minSdk = 31 27 targetSdk = 36 28 versionCode = 1 29 versionName = "0.1.0" 30 } 31 32 signingConfigs { 33 if (hasSigning) { 34 create("release") { 35 storeFile = rootProject.file(keystoreProps.getProperty("storeFile")) 36 storePassword = keystoreProps.getProperty("storePassword") 37 keyAlias = keystoreProps.getProperty("keyAlias") 38 keyPassword = keystoreProps.getProperty("keyPassword") 39 } 40 } 41 } 42 43 buildTypes { 44 release { 45 // No shrinking: the app is small, and R8 adds nothing here. 46 isMinifyEnabled = false 47 if (hasSigning) signingConfig = signingConfigs.getByName("release") 48 } 49 debug { 50 applicationIdSuffix = ".debug" 51 versionNameSuffix = "-debug" 52 } 53 } 54 55 buildFeatures { 56 buildConfig = true 57 } 58 59 compileOptions { 60 sourceCompatibility = JavaVersion.VERSION_17 61 targetCompatibility = JavaVersion.VERSION_17 62 } 63 64 kotlinOptions { 65 jvmTarget = "17" 66 } 67 } 68 69 // The APK has no dependency. The app uses java.net.HttpURLConnection for the 70 // requests, org.json from the platform for the answers, and JobScheduler for 71 // the daily check. 72 dependencies { 73 // Tests only, never in the APK. android.jar gives the unit tests an 74 // org.json that throws, so the tests use the real one. 75 testImplementation("junit:junit:4.13.2") 76 testImplementation("org.json:json:20240303") 77 }