Skip to content

Commit

Permalink
Incorporate grails plugin and grails plugin support jar into build.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldaley committed Apr 3, 2011
1 parent 380f7dd commit 4e7a5f3
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ out
.settings
bin

# Grails
stacktrace.log
70 changes: 37 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions gradle/common.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
isSnapshotVersion = project.version.endsWith("-SNAPSHOT")
isRootProject = project == project.rootProject
isGrailsPlugin = project.path == ":spock-grails"
grailsVersion = "1.3.7"
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ include 'spock-specs'
include 'spock-spring'
include 'spock-tapestry'
include 'spock-unitils'

include 'spock-grails-support'
include 'spock-grails'
21 changes: 21 additions & 0 deletions spock-grails-support/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

}
5 changes: 1 addition & 4 deletions spock-grails/application.properties
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions spock-grails/build.gradle
Original file line number Diff line number Diff line change
@@ -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)
}
}
30 changes: 20 additions & 10 deletions spock-grails/grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

0 comments on commit 4e7a5f3

Please sign in to comment.