diff --git a/pkl-tools/pkl-tools.gradle.kts b/pkl-tools/pkl-tools.gradle.kts index a464aa9f..41639391 100644 --- a/pkl-tools/pkl-tools.gradle.kts +++ b/pkl-tools/pkl-tools.gradle.kts @@ -7,12 +7,9 @@ plugins { signing } -val firstPartySourcesJars by configurations.existing +val dummy: SourceSet by sourceSets.creating -java { - // create an empty javadoc jar so Maven Central is happy - withJavadocJar() -} +val firstPartySourcesJars by configurations.existing // Note: pkl-tools cannot (easily) contain pkl-config-kotlin // because pkl-tools ships with a shaded Kotlin stdlib. @@ -37,6 +34,21 @@ dependencies { firstPartySourcesJars(project(":pkl-doc", "sourcesJar")) } +// TODO: need to figure out how to properly generate javadoc here. +// For now, we'll include a dummy javadoc jar. +val javadocDummy by tasks.creating(Javadoc::class) { + source = dummy.allJava +} + +java { + withJavadocJar() +} + +val javadocJar by tasks.existing(Jar::class) { + from(javadocDummy.outputs.files) + archiveBaseName.set("pkl-tools-all") +} + tasks.shadowJar { archiveBaseName.set("pkl-tools-all") } @@ -46,6 +58,10 @@ publishing { named("fatJar") { // don't use `-all` suffix because this is the only JAR we publish artifactId = "pkl-tools" + // add dummy javadoc jar to publication + artifact(javadocJar.flatMap { it.archiveFile }) { + classifier = "javadoc" + } pom { url.set("https://github.com/apple/pkl/tree/main/pkl-tools") description.set("Fat Jar containing pkl-cli, pkl-codegen-java, " + diff --git a/pkl-tools/src/dummy/java/org/pkl/tools/Empty.java b/pkl-tools/src/dummy/java/org/pkl/tools/Empty.java new file mode 100644 index 00000000..0e7d5a8e --- /dev/null +++ b/pkl-tools/src/dummy/java/org/pkl/tools/Empty.java @@ -0,0 +1,24 @@ +/** + * Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.pkl.tools; + +/** + * This is an intentionally empty class. + */ +// TODO: figure out how to generate javadoc for a shadow jar. +@SuppressWarnings("unused") +public class Empty { +}