diff --git a/CHANGELOG.md b/CHANGELOG.md index 860c2580..c9c5ab26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ ## Changes (excluding dependency updates) -### 2017-02-05 +### 2018-02-11 +* Removed references to deprecated grails plugin. + +### 2018-02-05 * Add workaround from [#90](https://github.com/sheehan/job-dsl-gradle-example/issues/90) ### 2017-10-29 diff --git a/src/jobs/example1Jobs.groovy b/src/jobs/example1Jobs.groovy index 7c3f379c..f36cf003 100644 --- a/src/jobs/example1Jobs.groovy +++ b/src/jobs/example1Jobs.groovy @@ -1,11 +1,11 @@ String basePath = 'example1' -String repo = 'sheehan/grails-example' +String repo = 'sheehan/gradle-example' folder(basePath) { description 'This example shows basic folder/job creation.' } -job("$basePath/grails-example-build") { +job("$basePath/gradle-example-build") { scm { github repo } @@ -13,14 +13,11 @@ job("$basePath/grails-example-build") { scm 'H/5 * * * *' } steps { - grails { - useWrapper true - targets(['test-app', 'war']) - } + gradle 'assemble' } } -job("$basePath/grails-example-deploy") { +job("$basePath/gradle-example-deploy") { parameters { stringParam 'host' } diff --git a/src/jobs/example2Jobs.groovy b/src/jobs/example2Jobs.groovy index 920c04f3..7c2e25e6 100644 --- a/src/jobs/example2Jobs.groovy +++ b/src/jobs/example2Jobs.groovy @@ -1,7 +1,7 @@ import groovy.json.JsonSlurper String basePath = 'example2' -String repo = 'sheehan/grails-example' +String repo = 'sheehan/gradle-example' folder(basePath) { description 'This example shows how to create a set of jobs for each github branch, each in its own folder.' @@ -15,7 +15,7 @@ branches.each { branch -> folder "$basePath/$safeBranchName" - job("$basePath/$safeBranchName/grails-example-build") { + job("$basePath/$safeBranchName/gradle-example-build") { scm { github repo, branch.name } @@ -23,11 +23,11 @@ branches.each { branch -> scm 'H/30 * * * *' } steps { - grails 'test-app war', true + gradle 'assemble' } } - job("$basePath/$safeBranchName/grails-example-deploy") { + job("$basePath/$safeBranchName/gradle-example-deploy") { parameters { stringParam 'host' } diff --git a/src/jobs/example3Jobs.groovy b/src/jobs/example3Jobs.groovy index 110e6320..1f098142 100644 --- a/src/jobs/example3Jobs.groovy +++ b/src/jobs/example3Jobs.groovy @@ -15,7 +15,7 @@ job("$basePath/configure-block-example") { } steps { - grails 'test war' + gradle 'assemble' } configure { Node project -> diff --git a/src/jobs/example4Jobs.groovy b/src/jobs/example4Jobs.groovy index d5af5bb5..d7a06c50 100644 --- a/src/jobs/example4Jobs.groovy +++ b/src/jobs/example4Jobs.groovy @@ -20,7 +20,7 @@ folder(basePath) { scm 'H/5 * * * *' } steps { - grails 'test war' + gradle 'assemble' } publishers { if (config.email) { diff --git a/src/jobs/example7Jobs.groovy b/src/jobs/example7Jobs.groovy index 0715ff59..407ae4ed 100644 --- a/src/jobs/example7Jobs.groovy +++ b/src/jobs/example7Jobs.groovy @@ -1,5 +1,4 @@ import com.dslexample.builder.GradleCiJobBuilder -import com.dslexample.builder.GrailsCiJobBuilder String basePath = 'example7' List developers = ['dev1@example.com', 'dev2@example.com'] @@ -8,23 +7,16 @@ folder(basePath) { description 'This example shows how to create jobs using Job builders.' } -new GrailsCiJobBuilder() - .name("$basePath/grails-project1") - .description('An example using a job builder for a Grails project.') +new GradleCiJobBuilder() + .name("$basePath/gradle-project1") + .description('An example using a job builder for a Gradle project.') .ownerAndProject('myorg/project1') .emails(developers) .build(this) -new GrailsCiJobBuilder() - .name("$basePath/grails-project2") - .description('Another example using a job builder for a Grails project.') +new GradleCiJobBuilder() + .name("$basePath/gradle-project2") + .description('Another example using a job builder for a Gradle project.') .ownerAndProject('myorg/project2') .emails(developers) - .build(this) - -new GradleCiJobBuilder() - .name("$basePath/gradle-project1") - .description('Example job description') - .ownerAndProject('myorg/project3') - .tasks('clean test') .build(this) \ No newline at end of file diff --git a/src/jobs/example8Jobs.groovy b/src/jobs/example8Jobs.groovy index 8a3a723f..f616d439 100644 --- a/src/jobs/example8Jobs.groovy +++ b/src/jobs/example8Jobs.groovy @@ -1,11 +1,11 @@ String basePath = 'example8' -String repo = 'sheehan/grails-example' +String repo = 'sheehan/gradle-example' folder(basePath) { description 'This example shows how to use DSL extensions provided by other plugins.' } -job("$basePath/grails-example-build") { +job("$basePath/gradle-example-build") { scm { git { remote { @@ -23,9 +23,6 @@ job("$basePath/grails-example-build") { } } steps { - grails { - useWrapper true - targets(['test-app', 'war']) - } + gradle 'assemble' } } diff --git a/src/jobs/example9Jobs.groovy b/src/jobs/example9Jobs.groovy index 21a31137..aab2edc6 100644 --- a/src/jobs/example9Jobs.groovy +++ b/src/jobs/example9Jobs.groovy @@ -5,7 +5,7 @@ folder(basePath) { description 'This example shows how to use the automatically generated DSL provided by other plugins.' } -job("$basePath/grails-legacy-build") { +job("$basePath/gradle-legacy-build") { scm { cvsscm { // <-- NOTE: provided by testPlugins dependency in build.gradle repositories { @@ -19,7 +19,7 @@ job("$basePath/grails-legacy-build") { cvsRepositoryItem { modules { cvsModule { - remoteName 'sheehan/grails-example' + remoteName 'sheehan/gradle-example' localName '.' projectsetFileName null } @@ -45,10 +45,7 @@ job("$basePath/grails-legacy-build") { scm('H/5 * * * *') } steps { - grails { - useWrapper true - targets(['test-app', 'war']) - } + gradle 'assemble' } } diff --git a/src/main/groovy/com/dslexample/builder/GrailsCiJobBuilder.groovy b/src/main/groovy/com/dslexample/builder/GrailsCiJobBuilder.groovy deleted file mode 100644 index 8040ebdb..00000000 --- a/src/main/groovy/com/dslexample/builder/GrailsCiJobBuilder.groovy +++ /dev/null @@ -1,54 +0,0 @@ -package com.dslexample.builder - -import groovy.transform.builder.Builder -import groovy.transform.builder.SimpleStrategy -import javaposse.jobdsl.dsl.DslFactory -import javaposse.jobdsl.dsl.Job - -/** - * Example Class for creating a Grails build - */ -@Builder(builderStrategy = SimpleStrategy, prefix = '') -class GrailsCiJobBuilder { - - String name - String description - String ownerAndProject - String gitBranch = 'master' - String pollScmSchedule = '*/5 * * * *' - List emails - - Job build(DslFactory dslFactory) { - dslFactory.job(name) { - it.description description - logRotator { - numToKeep 5 - } - scm { - github ownerAndProject, gitBranch - } - triggers { - scm pollScmSchedule - } - steps { - shell 'chmod a+x ./grailsw' - grails { - target 'test-app' - target 'war' - grailsWorkDir './grails-work' - projectWorkDir './project-work' - projectBaseDir '' - serverPort '' - useWrapper true - } - } - publishers { - archiveArtifacts 'target/**/*.war' - archiveJunit 'target/test-reports/**/*Spec.xml' - if (emails) { - mailer emails.join(' ') - } - } - } - } -} diff --git a/src/test/groovy/com/dslexample/builder/GrailsCiJobBuilderSpec.groovy b/src/test/groovy/com/dslexample/builder/GrailsCiJobBuilderSpec.groovy deleted file mode 100644 index 7a16b6cb..00000000 --- a/src/test/groovy/com/dslexample/builder/GrailsCiJobBuilderSpec.groovy +++ /dev/null @@ -1,49 +0,0 @@ -package com.dslexample.builder - -import com.dslexample.support.MockJobParent -import javaposse.jobdsl.dsl.Job -import javaposse.jobdsl.dsl.JobParent -import spock.lang.Specification - -class GrailsCiJobBuilderSpec extends Specification { - - JobParent jobParent = new MockJobParent() - GrailsCiJobBuilder builder - - def setup() { - builder = new GrailsCiJobBuilder() - .name('test-job') - .description('testing') - .ownerAndProject('sheehan/example') - } - - void 'test XML output'() { - when: - Job job = builder.build(jobParent) - - then: - job.name == builder.name - with(job.node) { - name() == 'project' - triggers.'hudson.triggers.SCMTrigger'.spec.text() == '*/5 * * * *' - !publishers.'hudson.tasks.Mailer'.recipients - } - } - - void 'test XML output - with overrides'() { - given: - builder.emails (['test1', 'test2']) - builder.pollScmSchedule ('@weekly') - - when: - Job job = builder.build(jobParent) - - then: - job.name == builder.name - with(job.node) { - name() == 'project' - triggers.'hudson.triggers.SCMTrigger'.spec.text() == '@weekly' - publishers.'hudson.tasks.Mailer'.recipients.text() == 'test1 test2' - } - } -}