Skip to content

Commit 018a1b2

Browse files
committed
Add javadoc jar and sources jar to make Maven Central happy
1 parent 800eec4 commit 018a1b2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

build.gradle.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ val nativeLibDir = layout.buildDirectory.dir("generated/libs/native/")
5353
val treeSitterPklRepoDir = layout.buildDirectory.dir("repos/tree-sitter-pkl")
5454
val treeSitterRepoDir = layout.buildDirectory.dir("repos/tree-sitter")
5555

56+
val dummy: SourceSet by sourceSets.creating
57+
5658
dependencies {
5759
implementation(kotlin("reflect"))
5860
implementation(libs.clikt)
@@ -137,6 +139,22 @@ tasks.shadowJar {
137139
from(pklStdlibFiles) { rename("(.*).zip", "$1.jar") }
138140
}
139141

142+
val javadocDummy by tasks.creating(Javadoc::class) { source = dummy.allJava }
143+
144+
// create a dummy javadoc jar to make maven central happy
145+
val javadocJar by
146+
tasks.registering(Jar::class) {
147+
dependsOn(javadocDummy)
148+
archiveClassifier = "javadoc"
149+
from(javadocDummy.destinationDir)
150+
}
151+
152+
val sourcesJar by
153+
tasks.registering(Jar::class) {
154+
from(sourceSets.main.get().allSource)
155+
archiveClassifier = "sources"
156+
}
157+
140158
fun configureRepo(
141159
repo: String,
142160
simpleRepoName: String,
@@ -397,6 +415,8 @@ publishing {
397415
classifier = null
398416
extension = "jar"
399417
}
418+
artifact(javadocJar.flatMap { it.archiveFile }) { classifier = "javadoc" }
419+
artifact(sourcesJar.flatMap { it.archiveFile }) { classifier = "sources" }
400420
pom {
401421
name.set("pkl-lsp")
402422
url.set("https://github.com/apple/pkl-lsp")

0 commit comments

Comments
 (0)