Skip to content

Commit

Permalink
Automatically aggregate and publish docs (java,groovy,scala)
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Ryan committed Apr 3, 2013
1 parent 498c25f commit 832eb53
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions gradle/buildscript.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 28 additions & 5 deletions gradle/convention.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]: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
Expand Down

0 comments on commit 832eb53

Please sign in to comment.