app/build.gradle.kts (2651 bytes)
1 plugins { 2 id("com.android.application") 3 } 4 5 // Release signing comes from the environment, so the key never lives in the 6 // repository. Without it the release build is left unsigned. 7 val keystorePath = providers.environmentVariable("SBM_KEYSTORE_FILE").orNull 8 val keystorePassword = providers.environmentVariable("SBM_KEYSTORE_PASSWORD").orNull 9 val signingReady = !keystorePath.isNullOrBlank() && !keystorePassword.isNullOrBlank() && 10 file(keystorePath).isFile 11 12 // Google Play does not allow links to payments outside Google Play, so the 13 // Play build has no Ko-fi link: ./gradlew bundleRelease -PplayStore=true 14 val playStore = providers.gradleProperty("playStore").map { it.toBoolean() }.getOrElse(false) 15 16 android { 17 namespace = "com.equwal.sbm" 18 compileSdk = 36 19 20 defaultConfig { 21 applicationId = "com.equwal.sbm" 22 minSdk = 26 23 targetSdk = 36 24 versionCode = 1 25 versionName = "0.1.0" 26 buildConfigField("boolean", "DONATE", (!playStore).toString()) 27 } 28 29 buildFeatures { buildConfig = true } 30 31 if (signingReady) { 32 signingConfigs { 33 create("release") { 34 storeFile = file(keystorePath!!) 35 storePassword = keystorePassword 36 keyAlias = "sbm" 37 keyPassword = keystorePassword 38 } 39 } 40 } 41 42 buildTypes { 43 debug { applicationIdSuffix = ".debug" } 44 release { 45 isMinifyEnabled = true 46 isShrinkResources = true 47 proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) 48 if (signingReady) signingConfig = signingConfigs.getByName("release") 49 } 50 } 51 52 compileOptions { 53 sourceCompatibility = JavaVersion.VERSION_17 54 targetCompatibility = JavaVersion.VERSION_17 55 } 56 57 // Google encrypts this block into the APK. F-Droid does not accept it. 58 dependenciesInfo { 59 includeInApk = false 60 includeInBundle = false 61 } 62 63 testOptions { 64 unitTests.all { it.useJUnitPlatform() } 65 } 66 67 lint { 68 // These checks report newer versions of tools and platforms. Their 69 // result changes with the date, not with the code: upgrades are 70 // separate work. Google Play asks for target API 36 until August 2027. 71 disable += setOf("OldTargetApi", "GradleDependency", "AndroidGradlePluginVersion", "NewerVersionAvailable") 72 warningsAsErrors = true 73 } 74 } 75 76 dependencies { 77 // Property tests for the file format and the search. 78 testImplementation("net.jqwik:jqwik:1.10.1") 79 testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.14.4") 80 }