From 5c89a50ab376742c64c572cf0f537d48088f9f68 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Mon, 19 Dec 2016 09:32:31 -0800 Subject: [PATCH] Add support for generating limited local javadocs based on our dependency graph --- build.gradle | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 61ce87c..1b5bda0 100644 --- a/build.gradle +++ b/build.gradle @@ -28,13 +28,17 @@ repositories { jcenter() } -dependencies { - compile 'org.codehaus.groovy:groovy-all:[2.4.7,2.5.0)' - compile "io.dropwizard:dropwizard-core:${dropwizardVersion}" - compile "io.dropwizard:dropwizard-views-mustache:${dropwizardVersion}" +configurations { + localJavadocs +} - testCompile "io.dropwizard:dropwizard-testing:${dropwizardVersion}" - testCompile 'org.spockframework:spock-core:1.0-groovy-2.4' +dependencies { + compile withSource('org.codehaus.groovy:groovy-all:[2.4.7,2.5.0)') + compile withSource("io.dropwizard:dropwizard-core:${dropwizardVersion}") + compile withSource("io.dropwizard:dropwizard-views-mustache:${dropwizardVersion}") + + testCompile withSource("io.dropwizard:dropwizard-testing:${dropwizardVersion}") + testCompile withSource('org.spockframework:spock-core:1.0-groovy-2.4') } task generateExampleYaml { @@ -63,3 +67,22 @@ test { events "passed", "skipped", "failed", "standardOut", "standardError" } } + + +def withSource(String dependency) { + configurations.localJavadocs.dependencies.add(dependencies.create("${dependency}:sources")) + return dependency + +} + +task localdoc(type: Javadoc) { + group 'Documentation' + description 'Generate javadoc for the dependencies of the project' + destinationDir = file("${buildDir}/generated-docs") + + source = configurations.localJavadocs.files.collect { sourceArtifact -> + zipTree(sourceArtifact).findAll { it.name.endsWith('java') } + } + title 'Generated Docs' + failOnError false +}