Skip to content

Commit 9fd19c1

Browse files
authoredOct 14, 2024
Merge pull request #115 from serjsysoev/fix_sources
Fix sources jar (#114)
2 parents 0d04181 + b7311e2 commit 9fd19c1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

Diff for: ‎build.gradle.kts

+13-1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ tasks {
183183
}
184184
}
185185

186+
val javaOnlySourcesJar by creating(Jar::class) {
187+
from(kotlin.sourceSets["jvmMain"].kotlin) {
188+
into(".")
189+
}
190+
archiveClassifier.set("sources")
191+
}
192+
186193
val allMetadataJar by existing(Jar::class) {
187194
archiveClassifier.set("common")
188195
}
@@ -203,6 +210,10 @@ nexusPublishing {
203210
}
204211

205212
configurations {
213+
create("javaOnlySourcesElements") {
214+
copyAttributes(configurations.findByName("jvmSourcesElements")!!.attributes, attributes)
215+
}
216+
206217
create("javadocElements") {
207218
attributes {
208219
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category::class.java, Category.DOCUMENTATION))
@@ -214,6 +225,7 @@ configurations {
214225
}
215226

216227
artifacts {
228+
add("javaOnlySourcesElements", tasks.getByName("javaOnlySourcesJar"))
217229
add("javadocElements", tasks.getByName("javadocJar"))
218230
}
219231

@@ -244,7 +256,7 @@ publishing {
244256
variant("jvmRuntimeElements") {
245257
configureVariantDetails { mapToMavenScope("runtime") }
246258
}
247-
variant("jvmSourcesElements")
259+
variant("javaOnlySourcesElements")
248260
variant("javadocElements")
249261
}
250262
val targetModules = kotlin.targets.filter { it.targetName != "jvm" && it.targetName != "metadata" }.map { target ->

0 commit comments

Comments
 (0)
Please sign in to comment.