Skip to content

Commit

Permalink
Refactor Kotlin source set access in publishing script. (#38)
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.
  • Loading branch information
lamba92 authored Dec 27, 2024
1 parent 5fe936a commit 1b49cab
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")
Expand Down Expand Up @@ -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(project.the<KotlinJvmExtension>().sourceSets.getByName("main").kotlin)
destinationDirectory = layout.buildDirectory.dir("artifacts")
}
publishing {
Expand Down

0 comments on commit 1b49cab

Please sign in to comment.