S.H.O.N.A.R./android/app/build.gradle.kts
avi 5235707de5 Library folder setting + title-time restore + notification heads-up/lockscreen + version stamp
- Settings: editable Library folder (blank = default Music/Recordings);
  bad/unusable paths keep previous folder, Current path shown, toast on update/reset
- Repository: refreshRoot never resets behind user; migrateRestoreTimes()
  restores HH-mm from createdAt for date-only titles, handles (2) collisions, once
- Notification: fresh v2 channel IMPORTANCE_HIGH (banner on record start),
  PRIVATE + publicVersion for secure lockscreen (single mic row, no pills)
- Build: versionCode = git commit count, versionName 0.1.<count>
- README: library folder note
- Tests: LibraryRootTest, TitleRestoreTest, updated layout + settings tests
2026-09-15 10:41:17 -05:00

99 lines
3.8 KiB
Kotlin

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.kapt")
id("org.jetbrains.kotlin.plugin.compose")
id("org.jetbrains.kotlin.plugin.serialization")
}
android {
namespace = "com.shonar"
compileSdk = 35
defaultConfig {
applicationId = "com.shonar"
minSdk = 26
targetSdk = 35
// Every iteration stamps its version: code = commit count (monotonic),
// name carries it. Falls back to 1 when git is unavailable.
val gitCount = runCatching {
providers.exec { commandLine("git", "rev-list", "--count", "HEAD") }
.standardOutput.asText.get().trim().toInt()
}.getOrDefault(1)
versionCode = gitCount
versionName = "0.1.$gitCount"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
// Local release key (never committed): passwords live in
// ~/.gradle/gradle.properties as SHONAR_STORE_PASSWORD /
// SHONAR_KEY_PASSWORD. Debug builds are unaffected.
val ksProps = mapOf(
"store" to (project.findProperty("SHONAR_STORE_PASSWORD") as String?),
"key" to (project.findProperty("SHONAR_KEY_PASSWORD") as String?),
)
if (ksProps.values.all { !it.isNullOrBlank() }) {
signingConfig = signingConfigs.maybeCreate("localRelease").apply {
storeFile = rootProject.file("keystores/shonar-release.jks")
storePassword = ksProps["store"]
keyAlias = "shonar"
keyPassword = ksProps["key"]
}
}
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
buildFeatures {
compose = true
}
packaging {
resources.excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
dependencies {
val composeBom = platform("androidx.compose:compose-bom:2024.12.01")
implementation(composeBom)
implementation("androidx.core:core-ktx:1.15.0")
implementation("androidx.activity:activity-compose:1.9.3")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.7")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7")
implementation("androidx.navigation:navigation-compose:2.8.4")
implementation("androidx.room:room-runtime:2.6.1")
implementation("androidx.room:room-ktx:2.6.1")
kapt("androidx.room:room-compiler:2.6.1")
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material-icons-extended")
implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")
// persistence
implementation("androidx.datastore:datastore-preferences:1.1.1")
// background work (none — local-only app keeps no workers)
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
// tests
testImplementation("junit:junit:4.13.2")
// Real org.json for JVM unit tests: the android.jar stubs throw
// ("Method ... not mocked"), which would kill any MockWebServer
// dispatcher or provider JSON parsing under test.
testImplementation("org.json:json:20240303")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testImplementation("androidx.room:room-testing:2.6.1")
androidTestImplementation(composeBom)
}