How to put all project classes into tagletPath for "aggregateJavadocs"?


(davidmichaelkarr) #1

I’m trying to use “gradle-aggregate-javadocs-plugin” in a multiproject build to aggregate javadocs. I don’t know whether it’s better to ask this here or file an issue in that repo. I don’t believe my question is an “issue” with the plugin, I’m just trying to figure out how to do something.

In my project, I’ve written a custom javadoc taglet which requires access to the class file for the source file the taglet is referenced from. I’ve gotten this to work for the regular “javadoc” task in each subproject, with something like this:

afterEvaluate {
tagletPath ((configurations.taglet.files + sourceSets.main.output) as File[])
}

However, the “aggregateJavadocs” task is associated with the root project. I had been defining the “taglet” configuration in the “subprojects” block, along with referencing the GAV for the taglet in the “dependencies” block within the “subprojects” block, but I guess I’ll have to move those to outside of the “subprojects” block so they are visible to the root project. That will let me reference “configurations.taglet.files” in the “aggregateJavadocs” task. However, I don’t know the best way to result in the class files for ALL subprojects being added to the “tagletPath”.


(davidmichaelkarr) #2

I know this is at least possible because I can write something like this at the “top level” (not in the subprojects block):

def allOutputs = new HashSet()

subprojects {
    println "project.name[${project.name}]"
    afterEvaluate {
        if (!(project.name in ["javadoc-aggregate"])) {
            allOutputs.add(sourceSets.main.output)
            println "allOutputs.0[${allOutputs}]"
        }
    }
}

The “add” functon is executed for all of the subprojects (except for the one that I know doesn’t have source files), and the println shows the value accumulating. However, I don’t understand how I can make a value like this available to the top level “tasks.withType(Javadoc) { options {” block.