Skip to content

Commit

Permalink
Generate project javadocs in the ugliest way possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmuscaria committed May 31, 2023
1 parent d46cb43 commit 16017a9
Showing 1 changed file with 51 additions and 12 deletions.
63 changes: 51 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit 16017a9

Please sign in to comment.