Fix Javadoc generation.

Accessing task providers (like javaCompileProvider) at sync time is not
possible. That's why the source sets of all generateJavadoc tasks is empty.

The set of source directories can also be accessed directly through the static
sourceSets field. Combining these allows to statically provide the relevant
source files to the javadoc task without needing to access the run-time task
provider.

PiperOrigin-RevId: 247938176
This commit is contained in:
tonihei 2019-05-13 16:21:33 +01:00 committed by Oliver Woodman
parent 0612d9f6d5
commit 15688e3e6f

View File

@ -18,10 +18,13 @@ android.libraryVariants.all { variant ->
if (!name.equals("release")) {
return; // Skip non-release builds.
}
def allSourceDirs = variant.sourceSets.inject ([]) {
acc, val -> acc << val.javaDirectories
}
task("generateJavadoc", type: Javadoc) {
description = "Generates Javadoc for the ${javadocTitle}."
title = "ExoPlayer ${javadocTitle}"
source = variant.javaCompileProvider.get().source
source = allSourceDirs
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "https://developer.android.com/reference",