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

Use explicit kotlin-stdlib and kotlin-test versions from version catalog #2818

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 4 additions & 39 deletions buildSrc/src/main/kotlin/source-sets-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ tasks.withType<JavaCompile>().configureEach {
options.release = 8
}

internal fun Project.versionCatalog(): VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is versionCatalogs works instead of extensions.getByType<VersionCatalogsExtension>()?


kotlin {
explicitApi()

Expand Down Expand Up @@ -73,38 +75,13 @@ kotlin {
sourceSets {
commonMain {
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib-common")
api(versionCatalog().findLibrary("kotlin.stdlib").get())
}
}

commonTest {
dependencies {
api("org.jetbrains.kotlin:kotlin-test-common")
api("org.jetbrains.kotlin:kotlin-test-annotations-common")
}
}

jvmMain {
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib")
}
}

jvmTest {
dependencies {
api("org.jetbrains.kotlin:kotlin-test-junit")
}
}

jsMain {
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib-js")
}
}

jsTest {
dependencies {
api("org.jetbrains.kotlin:kotlin-test-js")
api(versionCatalog().findLibrary("kotlin.test").get())
}
}

Expand All @@ -117,30 +94,18 @@ kotlin {

named("wasmJsMain") {
dependsOn(named("wasmMain").get())
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib-wasm-js")
}
}

named("wasmJsTest") {
dependsOn(named("wasmTest").get())
dependencies {
api("org.jetbrains.kotlin:kotlin-test-wasm-js")
}
}

named("wasmWasiMain") {
dependsOn(named("wasmMain").get())
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib-wasm-wasi")
}
}

named("wasmWasiTest") {
dependsOn(named("wasmTest").get())
dependencies {
api("org.jetbrains.kotlin:kotlin-test-wasm-wasi")
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ gradlePlugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", versi
gradlePlugin-animalsniffer = { module = "ru.vyarus:gradle-animalsniffer-plugin", version.ref = "animalsniffer"}
gradlePlugin-binaryCompatibilityValidator = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version.ref = "bcv"}

kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }

dokka-pathsaver = { module = "org.jetbrains.kotlinx:dokka-pathsaver-plugin", version.ref = "knit"}
knitTest = { module = "org.jetbrains.kotlinx:kotlinx-knit-test", version.ref = "knit"}
jmhCore = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh-core"}
Expand Down