Extract the logic for building the samples into a plugin

This commit is contained in:
Andy Wilkinson
2015-04-20 18:15:39 +01:00
parent 7a8dfeabd7
commit c496cfc699
2 changed files with 10 additions and 38 deletions

View File

@@ -74,47 +74,18 @@ project(':spring-restdocs') {
}
}
task buildSamples {
description = 'Assembles and tests the sample projects using both Maven and Gradle'
group = 'Build'
dependsOn 'buildMavenSamples'
dependsOn 'buildGradleSamples'
}
apply plugin: 'samples'
task buildMavenSamples {
dependsOn 'buildRestNotesSpringHateoasSampleWithMaven'
dependsOn 'buildRestNotesSpringDataRestSampleWithMaven'
}
samples {
dependOn 'spring-restdocs:install'
task buildGradleSamples {
dependsOn 'buildRestNotesSpringHateoasSampleWithGradle'
dependsOn 'buildRestNotesSpringDataRestSampleWithGradle'
}
restNotesSpringHateoas {
workingDir 'samples/rest-notes-spring-hateoas'
}
task buildRestNotesSpringHateoasSampleWithGradle(type: GradleBuild) {
dependsOn 'spring-restdocs:install'
dir = 'samples/rest-notes-spring-hateoas'
tasks = ['clean', 'build']
}
task buildRestNotesSpringDataRestSampleWithGradle(type: GradleBuild) {
dependsOn 'spring-restdocs:install'
dir = 'samples/rest-notes-spring-data-rest'
tasks = ['clean', 'build']
}
task buildRestNotesSpringHateoasSampleWithMaven(type: Exec) {
dependsOn 'spring-restdocs:install'
workingDir 'samples/rest-notes-spring-hateoas'
def suffix = File.separatorChar == '/' ? '' : '.bat'
commandLine "${System.env.MAVEN_HOME}/bin/mvn${suffix}", 'clean', 'package'
}
task buildRestNotesSpringDataRestSampleWithMaven(type: Exec) {
dependsOn 'spring-restdocs:install'
workingDir 'samples/rest-notes-spring-data-rest'
def suffix = File.separatorChar == '/' ? '' : '.bat'
commandLine "${System.env.MAVEN_HOME}/bin/mvn${suffix}", 'clean', 'package'
restNotesSpringDataRest {
workingDir 'samples/rest-notes-spring-data-rest'
}
}
wrapper {

View File

@@ -0,0 +1 @@
implementation-class: org.springframework.restdocs.build.SamplesPlugin