Javadoc exclusion question

(Ryan Bis) #1

I’m looking to tweak the javadocs for the library my company produces. We’re looking to exclude javadocs from classes that aren’t really meant for public consumption (mostly classes used internally).

I’ve marked the packages/classes that we want to exclude in the build.gradle file. However, this is causing errors to happen. I expect to get a warning, or error if there’s @link to a class which is excluded, but it’s also throwing errors when those excluded classes are simply imported. Is there a way to “include” the classes/packages, but NOT export the javadoc for them?


SweetBlue/src/com/idevicesinc/sweetblue/ error: cannot find symbol
import com.idevicesinc.sweetblue.utils.Utils;                                      
symbol:   class Utils
location: package com.idevicesinc.sweetblue.utils

javadoc task:

task gendocs(type: Javadoc) {
    options.stylesheetFile = new File("./assets/doc_style.css")
    String v = "${SEMVER}"
    version = v.replace("_", '.')
    title = "SweetBlue ${version} API"
    options.windowTitle = "SweetBlue"
    options.memberLevel = JavadocMemberLevel.PROTECTED = true
    options.linksOffline('', System.getenv("ANDROID_HOME") + '/docs/reference')    
    destinationDir = new File("${BUNDLE_FOLDER}/docs/api")
    source = sourceSets.main.allJava
    classpath += configurations.compile
    exclude "com/idevicesinc/sweetblue/backend"
    exclude "com/idevicesinc/sweetblue/utils/Utils**.java"
    exclude "com/idevicesinc/sweetblue/utils/"
    exclude "com/idevicesinc/sweetblue/utils/"
    exclude "com/idevicesinc/sweetblue/utils/"

(Ryan Bis) #2

So it seems that exclude in gradle does NOT do the same thing as -exclude when using javadoc on the command line.

When using the command line, I don’t get the errors. When using gradle, I do.

(Ryan Bis) #3

So is there any reason why gradle fails at this task, compared to doing it in the command line? We were hoping to keep as much as possible in our gradle script, but if it can’t exclude packages/classes properly without screwing up the whole build, then we’ll have to just generate the docs outside of gradle.

(Ross Wang) #4

I’m not positive, but I think this might be related to gradle feeding javadoc individual files rather than whole packages, and the exclude directive being gradle SourceTask's rather than javadoc’s.

(Fabian Zeindl) #5

I solved this by adding compilation output to javadocs input like so:

classpath = it.sourceSets.main.compileClasspath + it.sourceSets.main.output