Browse Source

Automatically aggregate and publish docs (java,groovy,scala)

pull/1/head
Justin Ryan 12 years ago
parent
commit
832eb537e9
  1. 1
      gradle/buildscript.gradle
  2. 33
      gradle/convention.gradle

1
gradle/buildscript.gradle

@ -7,4 +7,5 @@ dependencies { @@ -7,4 +7,5 @@ dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.1'
classpath 'com.mapvine:gradle-cobertura-plugin:0.1'
classpath 'gradle-release:gradle-release:1.1.4'
classpath 'org.ajoberstar:gradle-git:0.5.0'
}

33
gradle/convention.gradle

@ -63,11 +63,34 @@ subprojects { project -> @@ -63,11 +63,34 @@ subprojects { project ->
}
}
task aggregateJavadoc(type: Javadoc) {
description = 'Aggregate all subproject docs into a single docs directory'
source subprojects.collect {project -> project.sourceSets.main.allJava }
classpath = files(subprojects.collect {project -> project.sourceSets.main.compileClasspath})
destinationDir = new File(projectDir, 'doc')
apply plugin: 'github-pages' // Used to create publishGhPages task
def docTasks = [:]
[Javadoc,ScalaDoc,Groovydoc].each{ Class docClass ->
def allSources = allprojects.tasks*.withType(docClass).flatten()*.source
if (allSources) {
def shortName = docClass.simpleName.toLowerCase()
def docTask = task "aggregate${shortName.capitalize()}"(type: docClass, description: "Aggregate subproject ${shortName}s") {
source = allSources
doFirst {
def classpaths = allprojects.findAll { it.plugins.hasPlugin(JavaPlugin) }.collect { it.sourceSets.main.compileClasspath }
classpath = files(classpaths)
}
}
docTasks[shortName] = docTask
processGhPages.dependsOn(docTask)
}
}
githubPages {
repoUri = "git@github.com:quidryan/${rootProject.githubProjectName}.git"
pages {
docTasks.each { shortName, docTask ->
from(docTask.outputs.files) {
into "docs/${shortName}"
}
}
}
}
// Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle

Loading…
Cancel
Save