Skip to content

chore: switch to libs.versions.toml file and add dependabot #390

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
31 changes: 12 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ import io.gitlab.arturbosch.detekt.Detekt
import java.util.zip.ZipFile

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.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.native.cocoapods) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlinx.kover) apply false
alias(libs.plugins.kotlinx.binary.compatibility) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.compose) apply false
alias(libs.plugins.buildKonfig) apply false
alias(libs.plugins.vanniktech.mavenPublish)
alias(libs.plugins.spotless)
alias(libs.plugins.dokka)
alias(libs.plugins.detekt)
}

allprojects {
Expand Down Expand Up @@ -155,12 +154,6 @@ private fun Project.validateKotlinMultiplatformCoreArtifacts() {
}
}

subprojects {
if (project.name.contains("sentry-kotlin-multiplatform")) {
apply(plugin = Config.dokka)
}
}

spotless {
lineEndings = LineEnding.UNIX

Expand Down
64 changes: 0 additions & 64 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
@@ -1,75 +1,11 @@
object Config {
val agpVersion = "7.4.2"
val kotlinVersion = "1.9.23"
val composeVersion = "1.6.1"
val gradleMavenPublishPluginVersion = "0.18.0"

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 = "8.11.1"
val sentryAndroid = "io.sentry:sentry-android:$sentryJavaVersion"
val sentryJava = "io.sentry:sentry:$sentryJavaVersion"

val sentryCocoaVersion = "8.49.1"
val sentryCocoa = "Sentry"

object Samples {
val koinVersion = "3.5.2-RC1"
val koinCore = "io.insert-koin:koin-core:$koinVersion"
val koinAndroid = "io.insert-koin:koin-android:$koinVersion"
}
}

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

val minSdkVersion = 21
val targetSdkVersion = sdkVersion
val compileSdkVersion = sdkVersion
}

object Cocoa {
Expand Down
48 changes: 48 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[versions]
agp = "7.4.2"
kotlin = "1.9.23"
spotless = "7.0.3"
dokka = "1.8.10"
vanniktech-mavenPublish = "0.18.0"
kover = "0.7.3"
detekt = "1.22.0"
binaryCompatibility = "0.13.1"
buildKonfig = "0.13.3"
compose = "1.6.1"
android-compileSdk = "33"
android-minSdk = "21"
kotlinx-serialization = "1.5.0"
kotlinx-coroutines = "1.7.0-RC"
ktor-client = "2.3.6"
mockito = "5.4.0"
roboelectric = "4.9"
androidx-test-junitx = "1.1.5"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization"}
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines"}
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines"}
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor-client" }
ktor-client-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor-client" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor-client" }
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor-client" }
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
roboelectric = { module = "org.robolectric:robolectric", version.ref = "roboelectric" }
androidx-test-junitx = { module = "androidx.test.ext:junit-ktx", version.ref = "androidx-test-junitx" }

[plugins]
android-library = { id = "com.android.library", version.ref = "agp" }
android-application = { id = "com.android.application", version.ref = "agp" }
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" }
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
kotlinx-binary-compatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompatibility" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
vanniktech-mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-mavenPublish" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
buildKonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildKonfig" }
60 changes: 28 additions & 32 deletions sentry-kotlin-multiplatform/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin(Config.multiplatform)
kotlin(Config.cocoapods)
id(Config.androidGradle)
id(Config.BuildPlugins.buildConfig)
kotlin(Config.kotlinSerializationPlugin)
id(Config.QualityPlugins.kover)
id(Config.QualityPlugins.binaryCompatibility)
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.kotlin.native.cocoapods)
alias(libs.plugins.android.library)
alias(libs.plugins.kotlinx.kover)
alias(libs.plugins.kotlinx.binary.compatibility)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.buildKonfig)
alias(libs.plugins.dokka)
`maven-publish`
}

koverReport {
defaults {
// adds the contents of the reports of `release` Android build variant to default reports
mergeWith("release")
}
}
//kover {
// defaults {
// // adds the contents of the reports of `release` Android build variant to default reports
// mergeWith("release")
// }
//}

android {
compileSdk = Config.Android.compileSdkVersion
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
minSdk = Config.Android.minSdkVersion
minSdk = libs.versions.android.minSdk.get().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down Expand Up @@ -78,18 +79,13 @@ kotlin {
}
}

commonMain.dependencies {
implementation(Config.Libs.kotlinStd)
}

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.ktor.client.core)
implementation(libs.ktor.client.serialization)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.coroutines.test)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlin.test)
}

androidMain.dependencies {
Expand All @@ -99,9 +95,9 @@ kotlin {
// androidUnitTest.dependencies doesn't exist
val androidUnitTest by getting {
dependencies {
implementation(Config.TestLibs.roboelectric)
implementation(Config.TestLibs.junitKtx)
implementation(Config.TestLibs.mockitoCore)
implementation(libs.roboelectric)
implementation(libs.androidx.test.junitx)
implementation(libs.mockito.core)
}
}

Expand All @@ -118,16 +114,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.client.okhttp)
}
}

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

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

val commonTvWatchMacOsMain by creating {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ Pod::Spec.new do |spec|
}
]

end
end
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ plugins {
}

android {
compileSdk = Config.Android.compileSdkVersion
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
applicationId = "sample.kmp.app.android"
minSdk = Config.Android.minSdkVersion
targetSdk = Config.Android.targetSdkVersion
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.compileSdk.get().toInt()
versionCode = 1
versionName = "1.0"
}
Expand Down
4 changes: 2 additions & 2 deletions sentry-samples/kmp-app-cocoapods/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ kotlin {
}

android {
compileSdk = Config.Android.compileSdkVersion
compileSdk = libs.versions.android.compileSdk.get().toInt()
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = Config.Android.minSdkVersion
minSdk = libs.versions.android.minSdk.get().toInt()
}
}

Expand Down
6 changes: 3 additions & 3 deletions sentry-samples/kmp-app-spm/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ tasks.withType<KotlinCompile> {
}

android {
compileSdk = Config.Android.compileSdkVersion
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
applicationId = "sample.kmp.app.android"
minSdk = Config.Android.minSdkVersion
targetSdk = Config.Android.targetSdkVersion
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.compileSdk.get().toInt()
versionCode = 1
versionName = "1.0"
}
Expand Down
4 changes: 2 additions & 2 deletions sentry-samples/kmp-app-spm/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ kotlin {
}

android {
compileSdk = Config.Android.compileSdkVersion
compileSdk = libs.versions.android.compileSdk.get().toInt()
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = Config.Android.minSdkVersion
minSdk = libs.versions.android.minSdk.get().toInt()
}
}

Expand Down
Loading