From 16017a93b1e6f25bfa485a9161425f718a58f485 Mon Sep 17 00:00:00 2001 From: Juan Patricio Date: Wed, 31 May 2023 11:13:15 -0300 Subject: [PATCH] Generate project javadocs in the ugliest way possible. --- build.gradle | 63 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index a219b004..763f916a 100644 --- a/build.gradle +++ b/build.gradle @@ -133,18 +133,10 @@ packageApi { include 'net/md_5/**' } -publishing { - publications { - crucible(MavenPublication) { - artifact packageApi - } - } - repositories { - maven { - url = buildDir.absolutePath + "/repo" - name = "filesystem" - } - } +tasks.register('packageJavadoc', Jar) { + dependsOn ':eclipse:cauldron:javadoc' + archiveClassifier = 'javadoc' + destinationDirectory = getLibsDirectory() } packageServer { @@ -191,6 +183,53 @@ tasks.register('packageLibraries', Zip) { description("Package all necessary libraries to run Crucible, in case the server is unable to download them at runtime") } +publishing { + publications { + crucible(MavenPublication) { + artifact packageApi + artifact packageJavadoc + } + } + repositories { + maven { + url = buildDir.absolutePath + "/repo" + name = "filesystem" + } + } +} + +// TODO: This is absolute awful +// Move this to the gradle plugin? +var actualProject = project +subprojects { + if (project.name.contains('cauldron')) { + // Here we are presented with an annoying situation. We need to configure the javadoc task within the cauldron project. + // However we can't modify the build gradle directly... Besides this "solution" a better alternative would be the following: + // * Create a cauldron.gradle file at the root of the project that will be appended over the generated file + // * Change this directly in the gradle plugin project gen + // For now I'll leave this quick hack here that will sure haunt me in the future + afterEvaluate { + //noinspection ConfigurationAvoidance + if (project.tasks.findByName("javadoc")) { + javadoc { + include 'org/bukkit/**' + include 'org/spigotmc/**' + include 'thermos/**' + include 'co/aikar/**' + include 'io/github/crucible/**' + include 'net/minecraftforge/cauldron/**' + include 'net/md_5/**' + } + + var cauldron = project + actualProject.tasks.named('packageJavadoc') { + from cauldron.javadoc.destinationDir + } + } + } + } +} + def gitInfo(String key) { if (!gitInfoCached) { if (file('.git').exists()) {