Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gradle version catalog #249

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
24 changes: 12 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import com.vanniktech.maven.publish.MavenPublishPluginExtension
import io.gitlab.arturbosch.detekt.Detekt

plugins {
id(Config.gradleMavenPublishPlugin).version(Config.gradleMavenPublishPluginVersion)
id(Config.QualityPlugins.spotless).version(Config.QualityPlugins.spotlessVersion)
id(Config.QualityPlugins.detekt).version(Config.QualityPlugins.detektVersion)
id(Config.dokka).version(Config.dokkaVersion)
kotlin(Config.multiplatform).version(Config.kotlinVersion).apply(false)
kotlin(Config.cocoapods).version(Config.kotlinVersion).apply(false)
id(Config.jetpackCompose).version(Config.composeVersion).apply(false)
id(Config.androidGradle).version(Config.agpVersion).apply(false)
id(Config.BuildPlugins.buildConfig).version(Config.BuildPlugins.buildConfigVersion).apply(false)
kotlin(Config.kotlinSerializationPlugin).version(Config.kotlinVersion).apply(false)
id(Config.QualityPlugins.kover).version(Config.QualityPlugins.koverVersion).apply(false)
id(Config.QualityPlugins.binaryCompatibility).version(Config.QualityPlugins.binaryCompatibilityVersion).apply(false)
alias(libs.plugins.maven.publish)
alias(libs.plugins.spotless)
alias(libs.plugins.detekt)
alias(libs.plugins.dokka)
alias(libs.plugins.kotlin.multiplatform).apply(false)
alias(libs.plugins.kotlin.native.cocoapods).apply(false)
alias(libs.plugins.compose).apply(false)
alias(libs.plugins.android.library).apply(false)
alias(libs.plugins.build.konfig).apply(false)
alias(libs.plugins.kotlin.serialization).apply(false)
alias(libs.plugins.kover).apply(false)
alias(libs.plugins.binary.compatibility).apply(false)
}

allprojects {
Expand Down
28 changes: 0 additions & 28 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,22 @@ object Config {

val multiplatform = "multiplatform"
val cocoapods = "native.cocoapods"
val jetpackCompose = "org.jetbrains.compose"
val gradleMavenPublishPlugin = "com.vanniktech.maven.publish"
val androidGradle = "com.android.library"
val kotlinSerializationPlugin = "plugin.serialization"
val dokka = "org.jetbrains.dokka"
val dokkaVersion = "1.8.10"

object BuildPlugins {
val buildConfig = "com.codingfeline.buildkonfig"
val buildConfigVersion = "0.13.3"
}

object QualityPlugins {
val spotless = "com.diffplug.spotless"
val spotlessVersion = "6.11.0"
val kover = "org.jetbrains.kotlinx.kover"
val koverVersion = "0.7.3"
val detekt = "io.gitlab.arturbosch.detekt"
val detektVersion = "1.22.0"
val binaryCompatibility = "org.jetbrains.kotlinx.binary-compatibility-validator"
val binaryCompatibilityVersion = "0.13.1"
}

object Libs {
val kotlinStd = "org.jetbrains.kotlin:kotlin-stdlib"

val sentryJavaVersion = "7.13.0"
val sentryAndroid = "io.sentry:sentry-android:$sentryJavaVersion"
val sentryJava = "io.sentry:sentry:$sentryJavaVersion"
Expand All @@ -46,24 +36,6 @@ object Config {
}
}

object TestLibs {
val kotlinCommon = "org.jetbrains.kotlin:kotlin-test-common"
val kotlinCommonAnnotation = "org.jetbrains.kotlin:kotlin-test-annotations-common"
val kotlinJunit = "org.jetbrains.kotlin:kotlin-test-junit"
val kotlinCoroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-RC"
val kotlinCoroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.0-RC"
val kotlinxSerializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0"

val ktorClientCore = "io.ktor:ktor-client-core:2.3.6"
val ktorClientSerialization = "io.ktor:ktor-client-serialization:2.3.6"
val ktorClientOkHttp = "io.ktor:ktor-client-okhttp:2.3.6"
val ktorClientDarwin = "io.ktor:ktor-client-darwin:2.3.6"

val roboelectric = "org.robolectric:robolectric:4.9"
val junitKtx = "androidx.test.ext:junit-ktx:1.1.5"
val mockitoCore = "org.mockito:mockito-core:5.4.0"
}

object Android {
private val sdkVersion = 33

Expand Down
56 changes: 56 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[versions]
ktor = "2.3.12"
roboletric = "4.13"
kotlinx-coroutines = "1.8.1"
kotlinx-serialization = "1.7.1"
mockito = "5.12.0"
junit-ktx = "1.2.1"
koin = "3.5.6"
sentry = "7.13.0"
spotless = "6.25.0"
kover = "0.7.3"
detekt = "1.22.0"
binary-compatibility = "0.16.2"
build-konfig = "0.13.3"
agp = "7.4.2"
dokka = "1.9.20"
kotlin = "1.9.23"
publish = "0.18.0"
jp-compose = "1.6.1"

[libraries]
ktor = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
ktor-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" }
roboletric = { module = "org.robolectric:robolectric", version.ref = "roboletric" }
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlin-test-common = { module = "org.jetbrains.kotlin:kotlin-test-common" }
kotlin-test-annotations = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit" }
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
junit-ktx = { module = "androidx.test.ext:junit-ktx", version.ref = "junit-ktx" }
koin = { module = "io.insert-koin:koin-core", version.ref = "koin" }
koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" }
sentry-android = { module = "io.sentry:sentry-android", version.ref = "sentry" }
sentry-java = { module = "io.sentry:sentry", version.ref = "sentry" }

[bundles]

[plugins]
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
binary-compatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility" }
build-konfig = { id = "com.codingfeline.buildkonfig", version.ref = "build-konfig" }
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" }
compose = { id = "org.jetbrains.compose", version.ref = "jp-compose" }
32 changes: 16 additions & 16 deletions sentry-kotlin-multiplatform/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,36 +79,36 @@ kotlin {
}

commonMain.dependencies {
implementation(Config.Libs.kotlinStd)
implementation(libs.kotlin.stdlib)
}

commonTest.dependencies {
implementation(Config.TestLibs.kotlinCoroutinesCore)
implementation(Config.TestLibs.kotlinCoroutinesTest)
implementation(Config.TestLibs.ktorClientCore)
implementation(Config.TestLibs.ktorClientSerialization)
implementation(Config.TestLibs.kotlinxSerializationJson)
implementation(Config.TestLibs.kotlinCommon)
implementation(Config.TestLibs.kotlinCommonAnnotation)
implementation(libs.coroutines.core)
implementation(libs.coroutines.test)
implementation(libs.ktor)
implementation(libs.ktor.serialization)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlin.test.common)
implementation(libs.kotlin.test.annotations)
}

androidMain.dependencies {
api(Config.Libs.sentryAndroid)
api(libs.sentry.android)
}

// androidUnitTest.dependencies doesn't exist
val androidUnitTest by getting {
dependencies {
implementation(Config.TestLibs.roboelectric)
implementation(Config.TestLibs.junitKtx)
implementation(Config.TestLibs.mockitoCore)
implementation(libs.roboletric)
implementation(libs.junit.ktx)
implementation(libs.mockito.core)
}
}

val commonJvmMain by creating {
dependsOn(commonMain.get())
dependencies {
api(Config.Libs.sentryJava)
api(libs.sentry.java)
}
}

Expand All @@ -118,16 +118,16 @@ kotlin {
val commonJvmTest by creating {
dependsOn(commonTest.get())
dependencies {
implementation(Config.TestLibs.kotlinJunit)
implementation(Config.TestLibs.ktorClientOkHttp)
implementation(libs.kotlin.test.junit)
implementation(libs.ktor.okhttp)
}
}

androidUnitTest.dependsOn(commonJvmTest)
jvmTest.get().dependsOn(commonJvmTest)

appleTest.dependencies {
implementation(Config.TestLibs.ktorClientDarwin)
implementation(libs.ktor.darwin)
}

val commonTvWatchMacOsMain by creating {
Expand Down