diff --git a/.gitignore b/.gitignore index 74bfbe3302..d0261fb2b4 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ out .settings bin +# Grails +stacktrace.log \ No newline at end of file diff --git a/build.gradle b/build.gradle index 6ee8fb7d61..bb4954a6d9 100755 --- a/build.gradle +++ b/build.gradle @@ -13,57 +13,61 @@ libs = [ junit: "junit:junit-dep:4.8.2", log4j: "log4j:log4j:1.2.16", mockito: "org.mockito:mockito-all:1.8.5", - objenesis: "org.objenesis:objenesis:1.2" + objenesis: "org.objenesis:objenesis:1.2", + slf4j: "org.slf4j:slf4j-log4j12:1.5.5" ] allprojects { group = "org.spockframework" version = "0.6-groovy-1.7-SNAPSHOT" - apply plugin: "idea" - apply plugin: "eclipse" - apply plugin: "groovy" apply from: profile("common") - - sourceCompatibility = 1.5 - targetCompatibility = 1.5 - - configurations { - all*.exclude module: "junit" // we use junit-dep instead - } - - dependencies { - groovy libs.groovy - } - + repositories { mavenCentral() if (isSnapshotVersion) { mavenRepo(urls: "http://snapshots.repository.codehaus.org") } } + + if (!isGrailsPlugin) { + apply plugin: "idea" + apply plugin: "eclipse" + apply plugin: "groovy" + + sourceCompatibility = 1.5 + targetCompatibility = 1.5 + + configurations { + all*.exclude module: "junit" // we use junit-dep instead + } + + dependencies { + groovy libs.groovy + } - compileGroovy.options.fork = false - compileTestGroovy.options.fork = false + compileGroovy.options.fork = false + compileTestGroovy.options.fork = false - javadoc { - include "spock/**" - configure(options) { - links "http://java.sun.com/j2se/1.5.0/docs/api" - links "http://groovy.codehaus.org/gapi" - links "http://kentbeck.github.com/junit/javadoc/4.8" - links "http://www.jarvana.com/jarvana/inspect/org/hamcrest/hamcrest-core/1.2/hamcrest-core-1.2-javadoc.jar" + javadoc { + include "spock/**" + configure(options) { + links "http://java.sun.com/j2se/1.5.0/docs/api" + links "http://groovy.codehaus.org/gapi" + links "http://kentbeck.github.com/junit/javadoc/4.8" + links "http://www.jarvana.com/jarvana/inspect/org/hamcrest/hamcrest-core/1.2/hamcrest-core-1.2-javadoc.jar" + } } - } - task sourcesJar(type: Jar) { - classifier = "sources" - from sourceSets.main.allSource - } + task sourcesJar(type: Jar) { + classifier = "sources" + from sourceSets.main.allSource + } - task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = "javadoc" - from javadoc.destinationDir + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = "javadoc" + from javadoc.destinationDir + } } } diff --git a/gradle/common.gradle b/gradle/common.gradle index 4e066a1dc4..85add25587 100644 --- a/gradle/common.gradle +++ b/gradle/common.gradle @@ -1,2 +1,4 @@ isSnapshotVersion = project.version.endsWith("-SNAPSHOT") isRootProject = project == project.rootProject +isGrailsPlugin = project.path == ":spock-grails" +grailsVersion = "1.3.7" \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 3c9a6cfe62..a364fbc313 100755 --- a/settings.gradle +++ b/settings.gradle @@ -4,4 +4,5 @@ include 'spock-specs' include 'spock-spring' include 'spock-tapestry' include 'spock-unitils' - +include 'spock-grails-support' +include 'spock-grails' diff --git a/spock-grails-support/build.gradle b/spock-grails-support/build.gradle new file mode 100644 index 0000000000..9a41a5ac6f --- /dev/null +++ b/spock-grails-support/build.gradle @@ -0,0 +1,21 @@ +apply from: profile("publishMaven") + +description = "Spock Framework - Grails Plugin Support" + +repositories { + mavenRepo name: "java.net", urls: 'http://download.java.net/maven/2' +} + +dependencies { + compile \ + "org.grails:grails-core:${grailsVersion}", + "org.grails:grails-test:${grailsVersion}", + "org.grails:grails-web:${grailsVersion}", + "org.apache.ant:ant-junit:1.7.1", + "org.apache.tomcat:servlet-api:6.0.29", + libs.slf4j + + compile(project(":spock-core")) { + exclude module: "ant" + } +} diff --git a/spock-grails-support/src/main/groovy/grails/plugin/spock/test/GrailsSpecTestType.groovy b/spock-grails-support/src/main/groovy/grails/plugin/spock/test/GrailsSpecTestType.groovy index 4435dbf064..35c06388b7 100644 --- a/spock-grails-support/src/main/groovy/grails/plugin/spock/test/GrailsSpecTestType.groovy +++ b/spock-grails-support/src/main/groovy/grails/plugin/spock/test/GrailsSpecTestType.groovy @@ -78,4 +78,10 @@ class GrailsSpecTestType extends GrailsTestTypeSupport { reordered.eachWithIndex { name, idx -> reordedPositions[name] = idx } specClasses.sort { reordedPositions[it.name] } } + + // Override to workaround GRAILS-7296 + protected File getSourceDir() { + new File(buildBinding.grailsSettings.testSourceDir, relativeSourcePath) + } + } \ No newline at end of file diff --git a/spock-grails/application.properties b/spock-grails/application.properties index 229feeac19..3f0c89ac3f 100644 --- a/spock-grails/application.properties +++ b/spock-grails/application.properties @@ -1,7 +1,4 @@ #Grails Metadata file #Wed May 12 00:50:30 GMT+00:00 2010 -app.grails.version=1.3.4 +app.grails.version=1.3.7 app.name=spock-grails -app.version=0.6-groovy-1.7-SNAPSHOT -plugins.hibernate=1.2.0 -plugins.tomcat=1.2.2 diff --git a/spock-grails/build.gradle b/spock-grails/build.gradle new file mode 100644 index 0000000000..e5289494fe --- /dev/null +++ b/spock-grails/build.gradle @@ -0,0 +1,39 @@ +apply plugin: "grails" + +dependsOn ":spock-grails-support" + +configurations { + compile.exclude module: "commons-logging" + compile.exclude module: 'xml-apis' +} + +dependencies { + logging libs.slf4j + + compile \ + project(':spock-grails-support'), + "org.grails:grails-crud:${grailsVersion}", + "org.grails:grails-gorm:${grailsVersion}", + "hsqldb:hsqldb:1.8.0.5" + + runtime \ + "net.sf.ehcache:ehcache-core:1.7.1", + "org.aspectj:aspectjrt:1.6.6" +} + + +// Used in BuildConfig to selectively list specify dependencies +System.setProperty("spock.building", "true") + +task uploadArchives << { + if (project.hasProperty('codehausUsername') && project.hasProperty('codehausPassword')) { + def args = "-zipOnly -username=${codehausUsername} -password=${codehausPassword} " + if (project.version.endsWith("-SNAPSHOT")) { + args += "-message='snapshot release for “${project.version}”' -snapshot" + } else { + args += "-message='Release “${project.version}”'" + } + + grailsTask("release-plugin", args) + } +} diff --git a/spock-grails/grails-app/conf/BuildConfig.groovy b/spock-grails/grails-app/conf/BuildConfig.groovy index 07cdfac234..0079f16e83 100644 --- a/spock-grails/grails-app/conf/BuildConfig.groovy +++ b/spock-grails/grails-app/conf/BuildConfig.groovy @@ -31,17 +31,27 @@ grails.project.dependency.resolution = { } dependencies { - def spockVersion = "0.6" - def groovyVersion = grailsVersion.startsWith("1.3") ? "1.7" : "1.8" - def isSnapshot = true - - def effectiveSpockVersion = "${spockVersion}-groovy-${groovyVersion}" - if (isSnapshot) { - effectiveSpockVersion += "-SNAPSHOT" + // If we are running as part of spock build, don't try and pull in + // as gradle sets up the deps for us. This prop is set in the gradle build. + if (System.getProperty("spock.building") == null) { + def spockVersion = "0.6" + def groovyVersion = grailsVersion.startsWith("1.3") ? "1.7" : "1.8" + def isSnapshot = true + + def effectiveSpockVersion = "${spockVersion}-groovy-${groovyVersion}" + if (isSnapshot) { + effectiveSpockVersion += "-SNAPSHOT" + } + + test("org.spockframework:spock-grails-support:${effectiveSpockVersion}") { + exclude "groovy-all" + } } - - test("org.spockframework:spock-grails-support:${effectiveSpockVersion}") { - exclude "groovy-all" + } + + plugins { + compile (":tomcat:$grailsVersion", ":hibernate:$grailsVersion") { + export = false } } }