plugins { /* Used for generating version manifests for the applications */ id 'org.ajoberstar.grgit' version '1.6.0' /* Used for rendering the documentation for the applications */ id 'org.asciidoctor.gradle.asciidoctor' version '1.5.1' } /* Application plugin for creating tarballs of our app */ apply plugin: 'application' /* Groovy plugin sets up the tasks for building the Groovy app */ apply plugin: 'groovy' /* Enforce code-style checks on the Groovy code */ apply plugin: 'codenarc' /* Set some basic project properties */ version = '0.0.1' group = 'io.lasagna' description = 'HttpWizard is a simple application for playing with HTTP' mainClassName = 'io.lasagna.httpwizard.HttpWizard' /* Force our target compatibility to JDK8 always */ project.targetCompatibility = 1.8 /**********************************************************************/ defaultTasks 'check' repositories { jcenter() } configurations { localJavadocs } 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 { def outputFile = "${buildDir}/httpwizard.example.yml" group 'Build' description "Generate ${outputFile} for running the app" doLast { file(outputFile).text = """--- appVersion: "${project.version}-${grgit.head().abbreviatedId}" """ } outputs.file file(outputFile) } run { args 'server', "${buildDir}/httpwizard.example.yml" dependsOn generateExampleYaml } test { testLogging { /* we want more test failure information, see: * */ exceptionFormat = 'full' 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 }