Skip to content

Commit

Permalink
Add sources jar
Browse files Browse the repository at this point in the history
  • Loading branch information
Com6235 committed Apr 29, 2024
1 parent 5d3d21f commit 2f8c1c3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ tasks.register<Jar>("dokkaJavadocJar") {
archiveClassifier.set("javadoc")
}

tasks.register<Jar>("sourcesJar") {
from(sourceSets.main.get().allSource)
archiveClassifier.set("sources")
}

idea {
module {
isDownloadJavadoc = true
Expand All @@ -48,6 +53,7 @@ idea {

configurations {
create("javadoc")
create("sources")
}

val jdFile = layout.buildDirectory.file("libs/$name-$version-javadoc.jar")
Expand All @@ -56,11 +62,18 @@ val jdArtifact = artifacts.add("javadoc", jdFile.get().asFile) {
builtBy("dokkaJavadocJar")
}

val srcFile = layout.buildDirectory.file("libs/$name-$version-sources.jar")
val srcArtifact = artifacts.add("sources", srcFile.get().asFile) {
type = "jar"
builtBy("sourcesJar")
}

publishing {
publications {
create<MavenPublication>("kotlin") {
from(components["kotlin"])
artifact(jdArtifact)
artifact(srcArtifact)
}
}

Expand Down

0 comments on commit 2f8c1c3

Please sign in to comment.