feat: re-add aggregated javadocs task (#3077)

* feat: re-add aggregated javadocs task

This was removed by IntellectualSites/PlotSquared#2922.
Closes IntellectualSites/PlotSquared#3037.

Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>

* feat: aggregate javadocs on root build task

Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>

* Address changes requested

Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
Mariell Hoversholm 2021-06-02 23:26:27 +02:00 committed by GitHub
parent 8a244d12fc
commit a6b3e97cda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 2 deletions

View File

@ -101,3 +101,15 @@ tasks.named<ShadowJar>("shadowJar") {
mergeServiceFiles() mergeServiceFiles()
} }
tasks {
withType<Javadoc> {
val opt = options as StandardJavadocDocletOptions
opt.links("https://papermc.io/javadocs/paper/1.16/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.5/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.5/")
opt.links("https://jd.adventure.kyori.net/api/4.7.0/")
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/")
opt.links("https://checkerframework.org/api/")
}
}

View File

@ -76,6 +76,7 @@ subprojects {
} }
} }
val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name)
allprojects { allprojects {
dependencies { dependencies {
// Tests // Tests
@ -173,7 +174,6 @@ allprojects {
} }
} }
val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name)
tasks { tasks {
named<Delete>("clean") { named<Delete>("clean") {
doFirst { doFirst {
@ -217,3 +217,37 @@ allprojects {
} }
} }
} }
tasks {
val aggregatedJavadocs = create<Javadoc>("aggregatedJavadocs") {
title = "${project.name} ${project.version} API"
setDestinationDir(javadocDir)
options.destinationDirectory = javadocDir
doFirst {
javadocDir.deleteRecursively()
}
}.also {
it.group = "Documentation"
it.description = "Generate javadocs from all child projects as if it was a single project"
}
subprojects.forEach { subProject ->
subProject.afterEvaluate {
subProject.tasks.withType<Javadoc>().forEach { task ->
aggregatedJavadocs.source += task.source
aggregatedJavadocs.classpath += task.classpath
aggregatedJavadocs.excludes += task.excludes
aggregatedJavadocs.includes += task.includes
val rootOptions = aggregatedJavadocs.options as StandardJavadocDocletOptions
val subOptions = task.options as StandardJavadocDocletOptions
rootOptions.links(*subOptions.links.orEmpty().minus(rootOptions.links.orEmpty()).toTypedArray())
}
}
}
build {
dependsOn(aggregatedJavadocs)
}
}

View File

@ -1,5 +1,5 @@
[versions] [versions]
checker-qual = "3.13.0" checker-qual = "3.14.0"
guava = "21.0" guava = "21.0"
gson = "2.8.0" gson = "2.8.0"