app/build.gradle.kts (2849 bytes)
1 plugins { 2 alias(libs.plugins.android.application) 3 } 4 5 // Release signing comes from the environment, so the key never lives in the repository. 6 val keystorePath = providers.environmentVariable("SUBREP_KEYSTORE_FILE").orNull 7 val keystorePassword = providers.environmentVariable("SUBREP_KEYSTORE_PASSWORD").orNull 8 // Not named keyAlias: inside signingConfigs, that name is the property of the config itself. 9 val signingAlias = providers.environmentVariable("SUBREP_KEY_ALIAS").orNull ?: "subrep" 10 val signingReady = !keystorePath.isNullOrBlank() && !keystorePassword.isNullOrBlank() && 11 file(keystorePath).isFile 12 13 android { 14 namespace = "com.honjimaku.subrep" 15 compileSdk = 36 16 ndkVersion = "29.0.14206865" 17 18 dependenciesInfo { 19 includeInApk = false 20 includeInBundle = false 21 } 22 23 defaultConfig { 24 applicationId = "com.honjimaku.subrep" 25 // The sound of other apps can be captured from Android 10 (API 29). Older devices get the microphone. 26 minSdk = 26 27 targetSdk = 36 28 versionCode = 7 29 versionName = "0.2.4" 30 31 // Each phone worth running Whisper on is 64-bit ARM; the speech library is built for 32 // ARMv8.2 (see src/main/cpp/CMakeLists.txt). 33 ndk { abiFilters += "arm64-v8a" } 34 externalNativeBuild { 35 cmake { arguments += listOf("-DANDROID_STL=c++_static") } 36 } 37 } 38 39 if (signingReady) { 40 signingConfigs { 41 create("release") { 42 storeFile = file(keystorePath!!) 43 storePassword = keystorePassword 44 keyAlias = signingAlias 45 keyPassword = keystorePassword 46 } 47 } 48 } 49 50 buildTypes { 51 debug { applicationIdSuffix = ".debug" } 52 release { 53 // R8 removes unused code and resources. F-Droid asks for it. The JNI 54 // methods of Whisper keep their names through the default rules. 55 isMinifyEnabled = true 56 isShrinkResources = true 57 proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) 58 if (signingReady) signingConfig = signingConfigs.getByName("release") 59 } 60 } 61 62 compileOptions { 63 sourceCompatibility = JavaVersion.VERSION_17 64 targetCompatibility = JavaVersion.VERSION_17 65 } 66 67 externalNativeBuild { 68 cmake { 69 path = file("src/main/cpp/CMakeLists.txt") 70 version = "3.31.6" 71 } 72 } 73 } 74 75 dependencies { 76 implementation(libs.okhttp) 77 78 testImplementation(libs.junit) 79 testImplementation(libs.kotest.property) 80 testImplementation(libs.kotlinx.coroutines.core) 81 testImplementation(libs.json) 82 } 83 84 tasks.withType<Test> { 85 testLogging { 86 events("failed") 87 exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL 88 } 89 }