task operates on individual files rather than whole packages, a few Javadoc features don't seem to work:
private Set<File> sourceDirs
@Override
public void setSource(Object sourceDirs) {
this.sourceDirs = sourceDirs
super.setSource(sourceDirs)
}
@Override
protected void generate() {
...
Set<String> roots = new HashSet<>();
for (File sourceDir : sourceDirs) {
roots += sourceDir.absolutePath
}
/*Set<String> packages = new HashSet<>();
for (File sourceFile : getSource()) {
TODO
}*/
options.setSourceNames(Arrays.asList('<library package name>'));
options.addStringOption('subpackages', '<library package name>')
options.addStringsOption('sourcepath').value = new ArrayList<>(roots)
executeExternalJavadoc();
}
...
However, a more general solution (ex. one that doesn't hard-code the library package name) may require more effort. In general, it seems like processing entire packages instead of file sets is the way to go, but that presents complications with include/exclude filters. Perhaps modeling it as a SourceTask isn't quite correct, though it does make for easy integration for those who don't need the features that break like this.
Possibly related issue:
https://discuss.gradle.org/t/javadoc-task-doesnt-generate-package-links/10621
Loosely related issue:
https://discuss.gradle.org/t/javadoc-exclusion-question/11875
Also please let me know if there's a simpler workaround that I've missed.