Skip to content

Commit

Permalink
Version catalog (#57)
Browse files Browse the repository at this point in the history
* migrate to version catalog

* use the proper path for app data on the desktop
  • Loading branch information
psuzn authored Dec 24, 2023
1 parent f9f628c commit d322334
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 100 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/lint.yaml → .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Lint and verify
name: CI

on:
pull_request:
workflow_dispatch:
jobs:
lint:
ci:
runs-on: ubuntu-latest

steps:
Expand All @@ -20,15 +20,9 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/[email protected]

- name: Build Project with Gradle
- name: Setup Gradle Gradle
uses: gradle/[email protected]

- name: Lint
run: ./gradlew clean ktlintCheck

- name: Tests
run: ./gradlew :shared:testReleaseUnitTest

- name: Build Project
run: ./gradlew build

Expand Down
20 changes: 10 additions & 10 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
kotlin("multiplatform")
id("com.android.application")
id("org.jetbrains.compose")
id("com.google.gms.google-services")
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.android.application)
alias(libs.plugins.compose)
alias(libs.plugins.google.services)
}

kotlin {
Expand All @@ -11,12 +11,12 @@ kotlin {
androidMain {
dependencies {
implementation(project(":shared"))
implementation("androidx.activity:activity-compose:1.8.1")
implementation("androidx.core:core-ktx:1.12.0")
implementation(libs.activity.compose)
implementation(libs.core.ktx)

implementation(project.dependencies.platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}"))
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-messaging-ktx")
implementation(project.dependencies.platform(libs.firebase.bom))
implementation(libs.firebase.analytics)
implementation(libs.firebase.messaging)
}
}
}
Expand All @@ -30,7 +30,7 @@ android {
defaultConfig {
applicationId = Artifact.APP_ID

minSdk = Artifact.ANDROID_MIN_SDK
minSdk = Artifact.ANDROID_MIN_SDK
targetSdk = Artifact.ANDROID_TARGET_SDK

versionCode = Artifact.VERSION_CODE
Expand Down
24 changes: 12 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.KtlintPlugin

plugins {
kotlin("jvm") version Versions.KOTLIN apply false
kotlin("multiplatform") version Versions.KOTLIN apply false
kotlin("android") version Versions.KOTLIN apply false
kotlin("plugin.serialization") version Versions.KOTLIN apply false
id("com.android.application") version Versions.AGP apply false
id("com.android.library") version Versions.AGP apply false
id("org.jetbrains.compose") version Versions.COMPOSE apply false
id("com.adarshr.test-logger") version "3.2.0" apply false
id("org.jlleitschuh.gradle.ktlint") version "11.5.0" apply true
id("com.codingfeline.buildkonfig") version "0.14.0" apply false
id("app.cash.sqldelight") version Versions.SQLDELIGHT apply false
id("com.google.gms.google-services") version "4.3.15" apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.compose) apply false
alias(libs.plugins.test.logger) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.buildkonfig) apply false
alias(libs.plugins.sqldelight) apply false
alias(libs.plugins.google.services) apply false
}

allprojects {
Expand Down
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
1 change: 0 additions & 1 deletion buildSrc/src/main/kotlin/Artifacts.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
object Artifact {
const val APP_ID = "me.sujanpoudel.playdeals"
const val APP_NAME = "App Deals"
const val VERSION_CODE = 30
const val VERSION_NAME = "2.1.5"
const val MAJOR_RELEASE = false
Expand Down
18 changes: 0 additions & 18 deletions buildSrc/src/main/kotlin/Versions.kt

This file was deleted.

6 changes: 3 additions & 3 deletions desktopApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.compose)
}

kotlin {
Expand All @@ -13,7 +13,7 @@ kotlin {
dependencies {
implementation(compose.desktop.currentOs)
implementation(project(":shared"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:${Versions.COROUTINE}")
implementation(libs.kotlinx.coroutines.swing)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
kotlin.code.style=official
# gradle
org.gradle.jvmargs=-Xmx3g
org.gradle.caching=true
# android
android.useAndroidX=true
android.nonTransitiveRClass=true
Expand Down
101 changes: 101 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
[versions]

# Plugins
kotlin = "1.9.21"
agp = "8.2.0"
compose = "1.5.11"
test-logger = "3.2.0"
klint = "11.5.0"
buildkonfig = "0.14.0"
sqldelight = "2.0.0"
google-services = "4.4.0"

# Libraries
compose-compiler = "1.5.6"
accompanist-permissions = "0.32.0"
activity-compose = "1.8.2"
appcompat = "1.6.1"
core-ktx = "1.12.0"
startup-runtime = "1.1.1"

kotlinx-coroutines-core = "1.7.3"
kotlinx-datetime = "0.5.0"
coroutines-extensions = "2.0.0-alpha05"
kotlinxIoCore = "0.3.0"

firebase-bom = "32.7.0"

ktor-client-logging = "2.3.6"
ktor-serialization-kotlinx-json = "2.3.6"
ktor-client-content-negotiation = "2.3.6"
ktor-client-core = "2.3.6"

kamel-image = "0.8.3"
kodein-di = "7.20.2"
multiplatform-markdown-renderer = "0.7.2"
multiplatform-settings = "1.0.0"
mp-utils = "0.1.0"

# Testing
junit-jupiter = "5.9.3"
kotest-assertions-core = "5.5.5"
mockk = "1.13.8"

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
google-services = { id = "com.google.gms.google-services", version.ref = "google-services" }
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "klint" }
test-logger = { id = "com.adarshr.test-logger", version.ref = "test-logger" }
buildkonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildkonfig" }
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }


[libraries]
accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanist-permissions" }
activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" }
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
core-ktx = { module = "androidx.core:core-ktx", version.ref = "core-ktx" }
startup-runtime = { module = "androidx.startup:startup-runtime", version.ref = "startup-runtime" }

kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines-core" }
kotlinx-io-core = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version.ref = "kotlinxIoCore" }

firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase-bom" }
firebase-analytics = { module = "com.google.firebase:firebase-analytics-ktx" }
firebase-messaging = { module = "com.google.firebase:firebase-messaging-ktx" }

ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor-client-logging" }
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor-serialization-kotlinx-json" }
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor-client-content-negotiation" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor-client-core" }
ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor-client-logging" }
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor-client-logging" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor-client-logging" }

sqldelight-coroutines-extensions = { module = "app.cash.sqldelight:coroutines-extensions", version.ref = "coroutines-extensions" }
sqldelight-primitive-adapters = { module = "app.cash.sqldelight:primitive-adapters", version.ref = "coroutines-extensions" }
sqldelight-android-driver = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
sqldelight-native-driver = { module = "app.cash.sqldelight:native-driver", version.ref = "sqldelight" }
sqldelight-sqlite-driver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqldelight" }
kamel-image = { module = "media.kamel:kamel-image", version.ref = "kamel-image" }
kodein-di = { module = "org.kodein.di:kodein-di", version.ref = "kodein-di" }
multiplatform-markdown-renderer = { module = "com.mikepenz:multiplatform-markdown-renderer", version.ref = "multiplatform-markdown-renderer" }
multiplatform-settings = { module = "com.russhwolf:multiplatform-settings", version.ref = "multiplatform-settings" }
multiplatform-settings-no-arg = { module = "com.russhwolf:multiplatform-settings-no-arg", version.ref = "multiplatform-settings" }

mputils-paths = { module = "me.sujanpoudel.mputils:paths", version.ref = "mp-utils" }

kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines-core" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest-assertions-core" }
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
multiplatform-settings-test = { module = "com.russhwolf:multiplatform-settings-test", version.ref = "multiplatform-settings" }

Loading

0 comments on commit d322334

Please sign in to comment.