Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.INT
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING

// todo ios version
val appVersion = "1.0.0"
val appVersionCode = 1

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath(libs.kotlin.gradle.plugin)
classpath(libs.buildkonfig.gradle.plugin)
}
}

plugins {
alias(libs.plugins.kotlinMultiplatform)
Expand All @@ -9,6 +25,7 @@ plugins {
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.completeKotlin)
alias(libs.plugins.sqldelight)
alias(libs.plugins.buildkonfig)
}

sqldelight {
Expand Down Expand Up @@ -118,8 +135,8 @@ kotlin {

// Proguard
// Eventually needed everywhere and not just desktop, check proguard
implementation("org.slf4j:slf4j-api:2.0.5")
implementation("org.slf4j:slf4j-simple:1.6.1")
implementation(libs.slf4j.api)
implementation(libs.slf4j.simple)
}
}
}
Expand All @@ -132,8 +149,8 @@ android {
applicationId = "org.overengineer.talelistener"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"
versionCode = appVersionCode
versionName = appVersion
}
packaging {
resources {
Expand All @@ -160,7 +177,7 @@ compose.desktop {
mainClass = "org.overengineer.talelistener.MainKt"

nativeDistributions {
val osName = System.getProperty("os.name").toLowerCase()
val osName = System.getProperty("os.name").lowercase()
val targetFormats = when {
osName.contains("win") -> listOf(TargetFormat.Exe)
osName.contains("mac") -> listOf(TargetFormat.Dmg)
Expand All @@ -170,8 +187,8 @@ compose.desktop {
targetFormats(*targetFormats.toTypedArray())

packageName = "TaleListener"
packageVersion = "1.0.0"
copyright = "Copyright (C) 2025 Julian Hackinger"
packageVersion = appVersion
copyright = "Copyright (C) 2024 - 2025 Julian Hackinger"
vendor = "OverEngineer"

modules("java.net.http", "java.sql")
Expand Down Expand Up @@ -206,3 +223,15 @@ compose.desktop {
}
}
}

buildkonfig {
packageName = "org.overengineer.talelistener"
exposeObjectWithName = "BuildConfig"

defaultConfigs {
buildConfigField(STRING, "packageName", "org.overengineer.talelistener")
buildConfigField(STRING, "appName", "TaleListener")
buildConfigField(STRING, "version", appVersion)
buildConfigField(INT, "versionCode", appVersionCode.toString())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import io.ktor.http.URLBuilder
import io.ktor.http.Url
import io.ktor.http.path
import okio.BufferedSource
import org.overengineer.talelistener.BuildConfig
import org.overengineer.talelistener.channel.audiobookshelf.common.api.AudioBookshelfDataRepository
import org.overengineer.talelistener.channel.audiobookshelf.common.api.AudioBookshelfMediaRepository
import org.overengineer.talelistener.channel.audiobookshelf.common.api.AudioBookshelfSyncService
Expand Down Expand Up @@ -87,6 +88,7 @@ abstract class AudiobookshelfChannel(
.fetchConnectionInfo()
.map { connectionInfoResponseToConnectionInfo(it) }

// TODO: Add build config support instead of hardcoding
protected fun getClientName() = "TaleListener App 0.0.1"
protected fun getClientName(): String {
return "${BuildConfig.appName} ${BuildConfig.version}"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import me.sujanpoudel.utils.paths.appCacheDirectory
import me.sujanpoudel.utils.paths.appDataDirectory
import okio.Path
import okio.Path.Companion.toPath
import org.overengineer.talelistener.BuildConfig
import org.overengineer.talelistener.content.cache.converter.bookEntityToBook
import org.overengineer.talelistener.content.cache.converter.bookEntityToDetailedItem
import org.overengineer.talelistener.content.cache.converter.bookEntityToRecentBook
Expand All @@ -27,9 +28,7 @@ class CachedBookRepository(
private val settings: TaleListenerSharedPreferences,
private val dbHolder: DBHolder
) {

// Todo: Static value set on build from gradle
private val packageName = "org.overengineer.talelistener"
private val packageName = BuildConfig.packageName

fun provideFilePath(bookId: String, fileId: String): Path {
val path = appDataDirectory(packageName, true).toString() + "/$bookId/$fileId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import org.overengineer.talelistener.BuildConfig

@Composable
fun AdditionalComposable() {
Expand All @@ -46,8 +47,7 @@ fun AdditionalComposable() {
.padding(top = 16.dp)
.clickable { uriHandler.openUri("https://github.com/0verEngineer/TaleListener") }
.align(Alignment.CenterHorizontally),
// todo build variables
text = "TaleListener 0.0.1",
text = "${BuildConfig.appName} ${BuildConfig.version}",
style = TextStyle(
fontFamily = FontFamily.Monospace,
textAlign = TextAlign.Center,
Expand Down
8 changes: 8 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ android-targetSdk = "35"
androidDriver = "2.0.2"
androidx-activityCompose = "1.9.3"
androidx-lifecycle = "2.8.3"
buildkonfigGradlePlugin = "0.17.0"
coilCompose = "3.0.4"
compose-multiplatform = "1.7.3"
composeShimmer = "1.3.1"
Expand All @@ -26,6 +27,8 @@ napier = "2.7.1"
okio = "3.9.1"
pagingCommon = "3.3.0-alpha02-0.5.1"
pagingRuntime = "3.3.0-alpha02"
slf4jApi = "2.0.9"
slf4jSimple = "1.6.1"
sonner = "0.3.8"
vlcj = "4.8.2" # MacOS discovery broken singe 4.9.x
voyagerNavigator = "1.0.0"
Expand All @@ -41,6 +44,7 @@ androidx-media3-datasource-okhttp = { module = "androidx.media3:media3-datasourc
androidx-paging-compose = { module = "androidx.paging:paging-compose", version.ref = "pagingRuntime" }
androidx-paging-runtime = { module = "androidx.paging:paging-runtime", version.ref = "pagingRuntime" }
androidx-paging-rxjava3 = { module = "androidx.paging:paging-rxjava3", version.ref = "pagingRuntime" }
buildkonfig-gradle-plugin = { module = "com.codingfeline.buildkonfig:buildkonfig-gradle-plugin", version.ref = "buildkonfigGradlePlugin" }
coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" }
coil-network-ktor2 = { module = "io.coil-kt.coil3:coil-network-ktor2", version.ref = "coilCompose" }
compose-shimmer = { module = "com.valentinilk.shimmer:compose-shimmer", version.ref = "composeShimmer" }
Expand All @@ -50,6 +54,7 @@ koin-core = { module = "io.insert-koin:koin-core", version.ref = "koinCore" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
androidx-lifecycle-viewmodel = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-viewmodel", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtime-compose = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-swing = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
Expand All @@ -69,6 +74,8 @@ okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
paging-common = { module = "app.cash.paging:paging-common", version.ref = "pagingCommon" }
paging-compose-common = { module = "app.cash.paging:paging-compose-common", version.ref = "pagingCommon" }
paging-runtime-uikit = { module = "app.cash.paging:paging-runtime-uikit", version.ref = "pagingCommon" }
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4jApi" }
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4jSimple" }
sonner = { module = "io.github.dokar3:sonner", version.ref = "sonner" }
sqlite-driver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "androidDriver" }
vlcj = { module = "uk.co.caprica:vlcj", version.ref = "vlcj" }
Expand All @@ -83,3 +90,4 @@ kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref =
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version = "2.1.0" }
completeKotlin = { id = "com.louiscad.complete-kotlin", version = "1.1.0" }
sqldelight = { id = "app.cash.sqldelight", version = "2.0.2" }
buildkonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildkonfigGradlePlugin" }