ci: Register javadoc jar for lib artifacts

This commit is contained in:
NotMyFault 2021-11-23 14:14:01 +01:00
parent 64f393201f
commit 121bd58029
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C

View File

@ -96,8 +96,14 @@ fun Project.applyLibrariesConfiguration() {
archiveClassifier.set("sources") archiveClassifier.set("sources")
} }
// This a dummy jar to comply with the requirements of the OSSRH,
// libs are not API and therefore no "proper" javadoc jar is necessary
tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
}
tasks.named("assemble").configure { tasks.named("assemble").configure {
dependsOn("jar", "sourcesJar") dependsOn("jar", "sourcesJar", "javadocJar")
} }
project.apply<LibsConfigPluginHack>() project.apply<LibsConfigPluginHack>()
@ -148,6 +154,20 @@ fun Project.applyLibrariesConfiguration() {
outgoing.artifact(tasks.named("sourcesJar")) outgoing.artifact(tasks.named("sourcesJar"))
} }
val javadocElements = project.configurations.register("javadocElements") {
isVisible = false
description = "Javadoc elements for libs"
isCanBeResolved = false
isCanBeConsumed = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.DOCUMENTATION))
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, project.objects.named(DocsType.JAVADOC))
}
outgoing.artifact(tasks.named("javadocJar"))
}
libsComponent.addVariantsFromConfiguration(apiElements.get()) { libsComponent.addVariantsFromConfiguration(apiElements.get()) {
mapToMavenScope("compile") mapToMavenScope("compile")
} }
@ -160,6 +180,10 @@ fun Project.applyLibrariesConfiguration() {
mapToMavenScope("runtime") mapToMavenScope("runtime")
} }
libsComponent.addVariantsFromConfiguration(javadocElements.get()) {
mapToMavenScope("runtime")
}
configure<SigningExtension> { configure<SigningExtension> {
if (!version.toString().endsWith("-SNAPSHOT")) { if (!version.toString().endsWith("-SNAPSHOT")) {
val signingKey: String? by project val signingKey: String? by project