aboutsummaryrefslogtreecommitdiffstats
path: root/gradle/github.gradle
blob: 4a6f935291ddb6089d858e33d63a6b786a0afaaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
apply plugin: 'org.ajoberstar.github-pages'

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
			destinationDir = file("${project.buildDir}/docs/${shortName}")
			if (delegate.hasProperty('options')) {	// Groovydoc has no options
				options.links "http://docs.oracle.com/javase/7/docs/api/",
					"http://docs.oracle.com/javaee/7/api/",
					"http://docs.guava-libraries.googlecode.com/git/javadoc/"
				options.linkSource true
				if (JavaVersion.current().isJava8Compatible())
					options.addStringOption('Xdoclint:none', '-quiet')
			}
			doFirst {
				def classpaths = allprojects.findAll { it.plugins.hasPlugin(JavaPlugin) }.collect { it.sourceSets.main.compileClasspath }
				classpath = files(classpaths)
			}
		}
		docTasks[shortName] = docTask
		publishGhPages.dependsOn(docTask)
	}
}

githubPages {
	repoUri = "git@github.com:shevek/${rootProject.githubProjectName}.git"
	pages {
		docTasks.each { shortName, docTask ->
			from(docTask.outputs.files) {
				into "docs/${shortName}"
			}
		}
	}
}