From a6b3e97cda29dd42e1395d7cb23c952b66103241 Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Wed, 2 Jun 2021 23:26:27 +0200 Subject: [PATCH] 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 * feat: aggregate javadocs on root build task Signed-off-by: Mariell Hoversholm * Address changes requested Co-authored-by: NotMyFault --- Bukkit/build.gradle.kts | 12 ++++++++++++ build.gradle.kts | 36 +++++++++++++++++++++++++++++++++++- gradle/libs.versions.toml | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Bukkit/build.gradle.kts b/Bukkit/build.gradle.kts index f7c2010df..bc5582b08 100644 --- a/Bukkit/build.gradle.kts +++ b/Bukkit/build.gradle.kts @@ -101,3 +101,15 @@ tasks.named("shadowJar") { mergeServiceFiles() } + +tasks { + withType { + 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/") + } +} diff --git a/build.gradle.kts b/build.gradle.kts index 782897e09..47736acbf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -76,6 +76,7 @@ subprojects { } } +val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name) allprojects { dependencies { // Tests @@ -173,7 +174,6 @@ allprojects { } } - val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name) tasks { named("clean") { doFirst { @@ -217,3 +217,37 @@ allprojects { } } } + +tasks { + val aggregatedJavadocs = create("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().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) + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 15572789a..88e8bc1dc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -checker-qual = "3.13.0" +checker-qual = "3.14.0" guava = "21.0" gson = "2.8.0"