Skip to content

Commit

Permalink
Fix sources jar
Browse files Browse the repository at this point in the history
Remove multiplatform sources structure from jvm-only sources jar
  • Loading branch information
serjsysoev committed Oct 11, 2024
1 parent b1d593d commit b7311e2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ tasks {
}
}

val javaOnlySourcesJar by creating(Jar::class) {
from(kotlin.sourceSets["jvmMain"].kotlin) {
into(".")
}
archiveClassifier.set("sources")
}

val allMetadataJar by existing(Jar::class) {
archiveClassifier.set("common")
}
Expand All @@ -203,6 +210,10 @@ nexusPublishing {
}

configurations {
create("javaOnlySourcesElements") {
copyAttributes(configurations.findByName("jvmSourcesElements")!!.attributes, attributes)
}

create("javadocElements") {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category::class.java, Category.DOCUMENTATION))
Expand All @@ -214,6 +225,7 @@ configurations {
}

artifacts {
add("javaOnlySourcesElements", tasks.getByName("javaOnlySourcesJar"))
add("javadocElements", tasks.getByName("javadocJar"))
}

Expand Down Expand Up @@ -244,7 +256,7 @@ publishing {
variant("jvmRuntimeElements") {
configureVariantDetails { mapToMavenScope("runtime") }
}
variant("jvmSourcesElements")
variant("javaOnlySourcesElements")
variant("javadocElements")
}
val targetModules = kotlin.targets.filter { it.targetName != "jvm" && it.targetName != "metadata" }.map { target ->
Expand Down

0 comments on commit b7311e2

Please sign in to comment.