Recently Written · git

subread-android

SubRead for Android: times an audiobook against its ebook on the device

git clone https://github.com/equwal/subread-android

Log | Files | Refs


app/build.gradle.kts (4303 bytes)

1 plugins {
2     alias(libs.plugins.android.application)
3     alias(libs.plugins.kotlin.compose)
4 }
5 
6 // Release signing comes from the environment, so the key never lives in the
7 // repository. CI supplies it from repository secrets; without it the release
8 // build is simply left unsigned.
9 val keystorePath = providers.environmentVariable("SUBREAD_KEYSTORE_FILE").orNull
10 val keystorePassword = providers.environmentVariable("SUBREAD_KEYSTORE_PASSWORD").orNull
11 val signingReady = !keystorePath.isNullOrBlank() && !keystorePassword.isNullOrBlank() &&
12     file(keystorePath).isFile
13 
14 android {
15     namespace = "space.subread.app"
16     compileSdk = 36
17     ndkVersion = "29.0.14206865"
18 
19     // No list of dependencies, encrypted for Google alone, inside the app: F-Droid
20     // does not accept a part of the app that nobody else can read.
21     dependenciesInfo {
22         includeInApk = false
23         includeInBundle = false
24     }
25 
26     defaultConfig {
27         applicationId = "space.subread.app"
28         minSdk = 26
29         targetSdk = 36
30         // Plain numbers, in this file: F-Droid reads them from here to find a new release.
31         versionCode = 11
32         versionName = "0.9.1"
33         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
34 
35         // A link to the Ko-fi page. Google Play is not given it (-PplayStore=true): its
36         // rules on payments outside the store are read differently by each reviewer, and
37         // a first listing is not the place to find out. F-Droid and GitHub builds have it.
38         buildConfigField("boolean", "DONATE_LINK", (providers.gradleProperty("playStore").orNull != "true").toString())
39         // A link to honjimaku.com, a library of subtitles that users share. Not for Google Play either.
40         buildConfigField("boolean", "HONJIMAKU_LINK", (providers.gradleProperty("playStore").orNull != "true").toString())
41 
42         // Every phone worth transcribing on is 64-bit ARM; the speech library
43         // is built for ARMv8.2 specifically (see src/main/cpp/CMakeLists.txt).
44         ndk { abiFilters += "arm64-v8a" }
45         externalNativeBuild {
46             cmake { arguments += listOf("-DANDROID_STL=c++_static") }
47         }
48     }
49 
50     if (signingReady) {
51         signingConfigs {
52             create("release") {
53                 storeFile = file(keystorePath!!)
54                 storePassword = keystorePassword
55                 keyAlias = "subread"
56                 keyPassword = keystorePassword
57             }
58         }
59     }
60 
61     buildTypes {
62         debug { applicationIdSuffix = ".debug" }
63         release {
64             // Not shrunk yet: R8 rules want a device to be verified against.
65             isMinifyEnabled = false
66             if (signingReady) signingConfig = signingConfigs.getByName("release")
67         }
68     }
69 
70     compileOptions {
71         sourceCompatibility = JavaVersion.VERSION_17
72         targetCompatibility = JavaVersion.VERSION_17
73     }
74     buildFeatures {
75         compose = true
76         buildConfig = true
77     }
78 
79     externalNativeBuild {
80         cmake {
81             path = file("src/main/cpp/CMakeLists.txt")
82             version = "3.31.6"
83         }
84     }
85 
86     // The model is copied out of the APK to a real file on first run; storing
87     // it uncompressed makes that a straight copy.
88     androidResources { noCompress += "bin" }
89 
90     lint { abortOnError = false }
91 }
92 
93 dependencies {
94     implementation(project(":core"))
95     implementation(platform(libs.androidx.compose.bom))
96     implementation(libs.androidx.activity.compose)
97     implementation(libs.androidx.compose.material3)
98     implementation(libs.androidx.compose.ui)
99     implementation(libs.androidx.compose.ui.graphics)
100     implementation(libs.androidx.core.ktx)
101     implementation(libs.androidx.lifecycle.runtime.ktx)
102     implementation(libs.androidx.lifecycle.runtime.compose)
103     implementation(libs.kotlinx.coroutines.android)
104     // The intent API decides on plain strings, so JUnit alone tests it on a laptop.
105     testImplementation(libs.junit)
106     androidTestImplementation(libs.androidx.test.runner)
107     androidTestImplementation(libs.androidx.test.junit)
108     androidTestImplementation(platform(libs.androidx.compose.bom))
109     androidTestImplementation(libs.androidx.compose.ui.test.junit4)
110     debugImplementation(libs.androidx.compose.ui.test.manifest)
111 }