[SuwLib] Generate javadocs

Configure javadocs so that it can be generated with `./gradlew docs`
Split self.gradle from build.gradle, so that self.gradle can be used
to configure tasks only available to a build on ub-setupwizard-*,
while build.gradle will be used for building from source in other
gradle projects (e.g. GMS core).

Bug: 21444334
Change-Id: Icec763ce7dcf8939b7918b580e17ae22353cb38c
This commit is contained in:
Maurice Lam 2015-08-05 21:10:19 -07:00
parent 899caf2cf4
commit a211294e1c
8 changed files with 58884 additions and 12 deletions

View File

@ -14,8 +14,6 @@
* }
*/
apply plugin: 'dist'
ext {
// For builds in the Android tree we want to build the dependencies from source for reproducible
// builds. To add a dependency, you want to specify something like this:
@ -32,13 +30,3 @@ ext {
}
apply from: 'rules.gradle'
// Output all test APKs to the distribution folder
def distTask = tasks.findByName('dist');
if (distTask) {
android.testVariants.all { variant ->
// Make the dist task depend on the test variant, so the test APK will be built
distTask.dependsOn variant.assemble
// TODO: remap the different test variants to different file names
}
}

20
library/self.gradle Normal file
View File

@ -0,0 +1,20 @@
/**
* This self.gradle build file is only run when built in ub-setupwizard-* branches.
*/
apply plugin: 'dist'
apply from: 'build.gradle'
apply from: '../tools/gradle/docs.gradle'
task docs(dependsOn: 'javadocPlatformRelease')
// Output all test APKs to the distribution folder
def distTask = tasks.findByName('dist');
if (distTask) {
android.testVariants.all { variant ->
// Make the dist task depend on the test variant, so the test APK will be built
distTask.dependsOn variant.assemble
// TODO: remap the different test variants to different file names
}
}

13
tools/docs/README Normal file
View File

@ -0,0 +1,13 @@
This directory contains files needed to generate the documentations for setup wizard library.
android-22.txt:
API definition file used to link with developer.android.com, using the -federationapi option
in doclava. Copied from cs/#gmscore/config/android-22.txt
doclava.jar:
Compiled jar version of Doclava. This can be found in out/host/linux-x86/framework/doclava.jar
after a full platform build.
jsilver.jar:
Dependency of Doclava. This can be found in out/host/linux-x86/framework/jsilver.jar after a
full platform build.

58803
tools/docs/android-22.txt Normal file

File diff suppressed because it is too large Load Diff

BIN
tools/docs/doclava.jar Normal file

Binary file not shown.

BIN
tools/docs/jsilver.jar Normal file

Binary file not shown.

47
tools/gradle/docs.gradle Normal file
View File

@ -0,0 +1,47 @@
/**
* A helper gradle file to generate documentation using doclava.
* Include this file using `apply from` in the gradle build file. This will generate new tasks
* "javadoc<Variant>" which will generate javadocs for that target.
*/
import com.android.internal.doclava.DoclavaJavadocOptionFileOption
def DOCSDIR = "$rootDir/frameworks/opt/setupwizard/tools/docs"
android.libraryVariants.all { variant ->
if (variant.buildType.name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
return; // Skip debug builds.
}
def suffix = variant.name.capitalize()
def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
title = null
source variant.javaCompile.source
classpath = files(variant.javaCompile.classpath.files) + files(
"${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
exclude '**/R.java'
exclude '**/R.html', '**/R.*.html'
exclude '**/BuildConfig.java'
options {
bootClasspath = files(android.getBootClasspath()).asType(List)
doclet = 'com.google.doclava.Doclava'
docletpath = files("$DOCSDIR/doclava.jar", "$DOCSDIR/jsilver.jar").asType(List)
addOption(new DoclavaJavadocOptionFileOption('offlinemode'))
addOption(new DoclavaJavadocOptionFileOption('federate'))
.setValue(['Android', 'http://developer.android.com'])
addOption(new DoclavaJavadocOptionFileOption('federationapi'))
.setValue(['Android', file("$DOCSDIR/android-22.txt").canonicalPath])
addStringOption('templatedir',
file("$rootDir/build/tools/droiddoc/templates-sdk-dev").canonicalPath)
}
dependsOn(variant.assemble)
doLast {
println "Docs generated: file://${project.docsDir}/javadoc/reference/index.html"
}
}
}

View File

@ -1,5 +1,6 @@
include(':setup-wizard-lib')
project(':setup-wizard-lib').projectDir = new File(rootDir, 'frameworks/opt/setupwizard/library')
project(':setup-wizard-lib').buildFileName = 'self.gradle'
File supportLibsRoot = new File(rootDir, "prebuilts/fullsdk/linux/platforms/android-22/support")
if (!supportLibsRoot.exists()) {