app/build.gradle.kts (2615 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 // No list of dependencies, encrypted for Google alone, in the signed APK. 25 // F-Droid does not accept it, and it would stop the reproducible build check. 26 dependenciesInfo { 27 includeInApk = false 28 includeInBundle = false 29 } 30 31 defaultConfig { 32 applicationId = "dev.equwal.inkupdate" 33 minSdk = 31 34 targetSdk = 36 35 versionCode = 4 36 versionName = "0.1.3" 37 } 38 39 signingConfigs { 40 if (hasSigning) { 41 create("release") { 42 storeFile = rootProject.file(keystoreProps.getProperty("storeFile")) 43 storePassword = keystoreProps.getProperty("storePassword") 44 keyAlias = keystoreProps.getProperty("keyAlias") 45 keyPassword = keystoreProps.getProperty("keyPassword") 46 } 47 } 48 } 49 50 buildTypes { 51 release { 52 // R8 removes unused code and resources. F-Droid asks for it. 53 isMinifyEnabled = true 54 isShrinkResources = true 55 proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) 56 if (hasSigning) signingConfig = signingConfigs.getByName("release") 57 } 58 debug { 59 applicationIdSuffix = ".debug" 60 versionNameSuffix = "-debug" 61 } 62 } 63 64 buildFeatures { 65 buildConfig = true 66 } 67 68 compileOptions { 69 sourceCompatibility = JavaVersion.VERSION_17 70 targetCompatibility = JavaVersion.VERSION_17 71 } 72 73 kotlinOptions { 74 jvmTarget = "17" 75 } 76 } 77 78 // The APK has no dependency. The app uses java.net.HttpURLConnection for the 79 // requests, org.json from the platform for the answers, and JobScheduler for 80 // the daily check. 81 dependencies { 82 // Tests only, never in the APK. android.jar gives the unit tests an 83 // org.json that throws, so the tests use the real one. 84 testImplementation("junit:junit:4.13.2") 85 testImplementation("org.json:json:20240303") 86 }