Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Kotlin source set access in publishing script.
Browse files Browse the repository at this point in the history
Replaced direct access to `kotlin.sourceSets` with `KotlinJvmExtension` to improve type safety and maintainability. This ensures better integration with Kotlin DSL conventions and avoids potential runtime issues.
lamba92 committed Dec 27, 2024
1 parent 0c3a27b commit 5ab68cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/publishing-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gradle.kotlin.dsl.accessors._5110d0ad46c3465a3034c0fe268105a5.kotlin
import kotlin.io.path.Path
import kotlin.io.path.readText
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmExtension

plugins {
id("org.jlleitschuh.gradle.ktlint")
@@ -31,7 +31,7 @@ kotlinPlugins.forEach { kotlinPluginId ->
if ("jvm" in kotlinPluginId) {
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier = "sources"
from(kotlin.sourceSets.getByName("main").kotlin)
from(the<KotlinJvmExtension>().sourceSets.getByName("main").kotlin)
destinationDirectory = layout.buildDirectory.dir("artifacts")
}
publishing {

0 comments on commit 5ab68cf

Please sign in to comment.