From a19f657fe34def1f12ad04035418c74297fbb468 Mon Sep 17 00:00:00 2001 From: Victor Häggqvist Date: Thu, 17 Sep 2015 17:48:17 +0200 Subject: publish javadoc --- aboutit/build.gradle | 31 ++++++++++++++++++++++++++++++- publishJavadoc.sh | 12 ++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 publishJavadoc.sh diff --git a/aboutit/build.gradle b/aboutit/build.gradle index d377df0..c6ebbc8 100644 --- a/aboutit/build.gradle +++ b/aboutit/build.gradle @@ -81,4 +81,33 @@ uploadArchives { } } } -} \ No newline at end of file +} + +android.libraryVariants.all { variant -> + task("${variant.name}Javadoc", type: Javadoc, dependsOn: "assemble${variant.name.capitalize()}") { + source = variant.javaCompile.source + + title = "AboutIt" + + options.links("http://docs.oracle.com/javase/7/docs/api/"); + options.linksOffline("http://d.android.com/reference","${android.sdkDirectory}/docs/reference"); + + // First add all of your dependencies to the classpath, then add the android jars + classpath += files(variant.javaCompile.classpath.files) + classpath += files(android.getBootClasspath()) + + // We're excluding these generated files + exclude '**/BuildConfig.java' + exclude '**/R.java' + } +} + +android.libraryVariants.all { variant -> + task("${variant.name}JavadocJar", type: Jar, dependsOn: "${variant.name}Javadoc") { + classifier = 'javadoc' + from tasks["${variant.name}Javadoc"].destinationDir + } + + // Add the Javadoc jar to the project's artifacts. This will allow us to upload it easily later + project.artifacts.add("archives", tasks["${variant.name}JavadocJar"]); +} diff --git a/publishJavadoc.sh b/publishJavadoc.sh new file mode 100644 index 0000000..c2f3811 --- /dev/null +++ b/publishJavadoc.sh @@ -0,0 +1,12 @@ +gradle releaseJavadoc +git clone --branch=gh-pages --single-branch git@github.com:victorhaggqvist/AboutIt.git ghpages +pushd ghpages +rm -rf * +popd +cp -r aboutit/build/docs/javadoc/* ghpages +pushd ghpages +git add . +git commit -m "Update JavaDoc" +git push --force +popd +rm -rf ghpages \ No newline at end of file -- cgit v1.2.3