updated gradle to 1.0

updated all builds to latest library versions
renamed specs to end in 'Spec' (easiest solution until we have a plugin for Maven 3.0)
main
Peter Niederwieser 13 years ago
parent 1f5ac95159
commit 357b2dde35

@ -1,6 +1,6 @@
apply plugin: "groovy"
version = "0.6"
version = "0.7-SNAPSHOT"
description = "Spock Framework - Example Project"
// Spock works with Java 1.5 and above
@ -9,22 +9,22 @@ sourceCompatibility = 1.5
repositories {
// Spock releases are available from Maven Central
mavenCentral()
// Spock development snapshots are available from Spock's Maven repo
maven { url "http://m2repo.spockframework.org/snapshots" }
// Spock snapshots are available from the Sonatype OSS snapshot repository
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
// mandatory dependencies for using Spock
groovy "org.codehaus.groovy:groovy-all:1.8.6"
testCompile "org.spockframework:spock-core:0.6-groovy-1.8"
groovy "org.codehaus.groovy:groovy-all:2.0.0"
testCompile "org.spockframework:spock-core:0.7-groovy-2.0-SNAPSHOT"
// optional dependencies for using Spock
testCompile "org.hamcrest:hamcrest-core:1.2" // only necessary if Hamcrest matchers are used
testRuntime "cglib:cglib-nodep:2.2" // allows mocking of classes (in addition to interfaces)
testCompile "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used
testRuntime "cglib:cglib-nodep:2.2.2" // allows mocking of classes (in addition to interfaces)
testRuntime "org.objenesis:objenesis:1.2" // allows mocking of classes without default constructor (together with CGLIB)
// dependencies used by examples in this project
testRuntime "com.h2database:h2:1.3.164"
testRuntime "com.h2database:h2:1.3.168"
}
// the remaining configuration is specific to this project, and is not required for using Spock
@ -37,6 +37,6 @@ task collectJars(type: Copy) {
}
task wrapper(type: Wrapper) {
gradleVersion = "1.0-milestone-9"
gradleVersion = "1.0"
}

@ -27,13 +27,13 @@
<dependency
groupId="org.spockframework"
artifactId="spock-core"
version="0.6-groovy-1.8" />
version="0.7-groovy-2.0-SNAPSHOT" />
<!-- Optional dependencies for using Spock -->
<!-- enables mocking of classes (in addition to interfaces) -->
<dependency
groupId="cglib"
artifactId="cglib-nodep"
version="2.2" />
version="2.2.2" />
<!-- enables mocking of classes without parameterless constructor (together with CGLIB) -->
<dependency
groupId="org.objenesis"
@ -41,31 +41,26 @@
version="1.2" />
<!-- only required if Spock's Ant selector is used, which finds spec classes regardless of their name -->
<dependency
groupId="asm"
groupId="org.ow2.asm"
artifactId="asm"
version="3.2" />
version="4.0" />
<!-- only required if Hamcrest matchers are used -->
<dependency
groupId="org.hamcrest"
artifactId="hamcrest-core"
version="1.2" />
<!-- only necessary if Hamcrest matchers are used -->
<dependency
groupId="org.hamcrest"
artifactId="hamcrest-core"
version="1.2" />
version="1.3" />
<!-- Dependencies used by examples in this project (not required for using Spock) -->
<dependency
groupId="com.h2database"
artifactId="h2"
version="1.3.164" />
version="1.3.168" />
<remoteRepository
id="maven-central"
url="http://repo1.maven.org/maven2/" />
<!-- Only required if a snapshot version of Spock is used -->
<remoteRepository
id="spock-snapshots"
url="http://m2repo.spockframework.org/snapshots/" />
url="http://oss.sonatype.org/content/repositories/snapshots/" />
</artifact:dependencies>
</target>

Binary file not shown.

@ -1,6 +1,6 @@
#Sat Apr 30 21:41:20 CEST 2011
#Sat Jul 14 07:10:41 CEST 2012
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.0-milestone-9-bin.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-1.0-bin.zip

108
gradlew vendored

@ -1,16 +1,16 @@
#!/bin/bash
##############################################################################
## ##
## Gradle wrapper script for UN*X ##
## ##
##
## Gradle start up script for UN*X
##
##############################################################################
# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
# GRADLE_OPTS="$GRADLE_OPTS -Xmx512m"
# JAVA_OPTS="$JAVA_OPTS -Xmx512m"
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
GRADLE_APP_NAME=Gradle
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@ -42,54 +42,51 @@ case "`uname`" in
;;
esac
# Attempt to set JAVA_HOME if it's not already set.
if [ -z "$JAVA_HOME" ] ; then
if $darwin ; then
[ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
[ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
else
javaExecutable="`which javac`"
[ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
[ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME."
javaExecutable="`readlink -f \"$javaExecutable\"`"
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
export JAVA_HOME="$javaHome"
fi
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
CLASSPATH=`dirname "$0"`/gradle/wrapper/gradle-wrapper.jar
WRAPPER_PROPERTIES=`dirname "$0"`/gradle/wrapper/gradle-wrapper.properties
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/"
APP_HOME="`pwd -P`"
cd "$SAVED"
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="java"
JAVACMD="$JAVA_HOME/bin/java"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
if [ -z "$JAVA_HOME" ] ; then
warn "JAVA_HOME environment variable is not set"
fi
# Increase the maximum file descriptors if we can.
@ -108,15 +105,14 @@ if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
fi
fi
# For Darwin, add GRADLE_APP_NAME to the JAVA_OPTS as -Xdock:name
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GRADLE_APP_NAME"
# we may also want to set -Xdock:image
JAVA_OPTS="$JAVA_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
JAVA_HOME=`cygpath --path --mixed "$JAVA_HOME"`
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
@ -143,7 +139,7 @@ if $cygwin ; then
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
@ -158,11 +154,11 @@ if $cygwin ; then
esac
fi
GRADLE_APP_BASE_NAME=`basename "$0"`
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \
-classpath "$CLASSPATH" \
-Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \
-Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
$STARTER_MAIN_CLASS \
"$@"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

52
gradlew.bat vendored

@ -1,24 +1,37 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem ##
@rem Gradle startup script for Windows ##
@rem ##
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
@rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512m
@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512m
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.\
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
if not defined JAVA_HOME goto init
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
@ -29,14 +42,14 @@ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo.
goto end
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%eval[2+2]" == "4" goto 4NT_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@ -56,27 +69,22 @@ set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
set CLASSPATH=%DIRNAME%\gradle\wrapper\gradle-wrapper.jar
set WRAPPER_PROPERTIES=%DIRNAME%\gradle\wrapper\gradle-wrapper.properties
set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%"
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit "%ERRORLEVEL%"
exit /b "%ERRORLEVEL%"
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
:omega

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.spockframework</groupId>
<artifactId>spock-example</artifactId>
<version>0.6</version>
<version>0.7-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Spock Framework - Example Project</name>
@ -19,9 +19,9 @@
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<version>1.4</version>
<configuration>
<providerSelection>1.7</providerSelection>
<providerSelection>2.0</providerSelection>
</configuration>
<executions>
<execution>
@ -34,8 +34,8 @@
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
<version>1.3</version>
<artifactId>gmaven-runtime-2.0</artifactId>
<version>1.4</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
@ -46,33 +46,20 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.6</version>
<version>2.0.0</version>
</dependency>
</dependencies>
</plugin>
<!-- Optional plugins for using Spock -->
<plugin>
<!--
Finds all Spock specifications in this project, and configures Maven to run them
If this plugin is removed, Spock specifications will need to adhere to Maven's naming conventions for test classes
-->
<groupId>org.spockframework</groupId>
<artifactId>spock-maven</artifactId>
<version>0.6-groovy-1.8</version>
<executions>
<execution>
<goals>
<goal>find-specs</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Only required if default Surefire configuration is not satisfactory -->
<!-- Only required if default Surefire configuration is not satisfactory -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<useFile>false</useFile>
<includes>
<include>**/*Spec.java</include>
</includes>
</configuration>
</plugin>
<!-- Only required for spock-example build -->
@ -91,14 +78,14 @@
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>0.6-groovy-1.8</version>
<version>0.7-groovy-2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<!-- Optional dependencies for using Spock -->
<dependency> <!-- enables mocking of classes (in addition to interfaces) -->
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2</version>
<version>2.2.2</version>
<scope>test</scope>
</dependency>
<dependency> <!-- enables mocking of classes without default constructor (together with CGLIB) -->
@ -110,14 +97,14 @@
<dependency> <!-- only necessary if Hamcrest matchers are used -->
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.2</version>
<version>1.3</version>
<scope>test</scope>
</dependency>
<!-- Dependencies used by examples in this project (not required for using Spock) -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.164</version>
<version>1.3.168</version>
</dependency>
</dependencies>
@ -125,7 +112,7 @@
<!-- Only required if a snapshot version of Spock is used -->
<repository>
<id>spock-snapshots</id>
<url>http://m2repo.spockframework.org/snapshots</url>
<url>http://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
@ -136,7 +123,7 @@
<pluginRepositories>
<pluginRepository>
<id>spock-snapshots</id>
<url>http://m2repo.spockframework.org/snapshots</url>
<url>http://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>

@ -17,7 +17,7 @@
import spock.lang.*
@Unroll
class DataDriven extends Specification {
class DataDrivenSpec extends Specification {
def "maximum of two numbers"() {
expect:
Math.max(a, b) == c
@ -48,11 +48,11 @@ class DataDriven extends Specification {
new Person(name: "Fred") || "Male"
new Person(name: "Wilma") || "Female"
}
}
private class Person {
String name
String getSex() {
name == "Fred" ? "Male" : "Female"
static class Person {
String name
String getSex() {
name == "Fred" ? "Male" : "Female"
}
}
}

@ -18,7 +18,7 @@ import groovy.sql.Sql
import spock.lang.Shared
import spock.lang.Specification
class DatabaseDriven extends Specification {
class DatabaseDrivenSpec extends Specification {
@Shared sql = Sql.newInstance("jdbc:h2:mem:", "org.h2.Driver")
// insert data (usually the database would already contain the data)

@ -25,7 +25,7 @@ import static spock.util.matcher.HamcrestMatchers.closeTo
* @author Peter Niederwiser
* @since 0.5
*/
class HamcrestMatchers extends Specification {
class HamcrestMatchersSpec extends Specification {
def "comparing two decimal numbers"() {
def myPi = 3.14

@ -14,7 +14,7 @@
* limitations under the License.
*/
class HelloSpock extends spock.lang.Specification {
class HelloSpockSpec extends spock.lang.Specification {
def "length of Spock's and his friends' names"() {
expect:
name.size() == length

@ -37,7 +37,7 @@ import spock.lang.Specification
*
* @since 0.4
*/
class IncludeExcludeExtension extends Specification {
class IncludeExcludeExtensionSpec extends Specification {
static {
System.setProperty "spock.configuration", "IncludeFastConfig.groovy"

@ -22,7 +22,7 @@ import spock.lang.*
*
* @since 0.4
*/
class OrderedInteractions extends Specification {
class OrderedInteractionsSpec extends Specification {
def "collaborators must be invoked in order"() {
def coll1 = Mock(Collaborator)
def coll2 = Mock(Collaborator)

@ -16,7 +16,7 @@
import spock.lang.Specification
class EmptyStack extends Specification {
class EmptyStackSpec extends Specification {
def stack = new Stack()
def "size"() {
@ -43,7 +43,7 @@ class EmptyStack extends Specification {
}
}
class StackWithOneElement extends Specification {
class StackWithOneElementSpec extends Specification {
def stack = new Stack()
def setup() {
@ -82,7 +82,7 @@ class StackWithOneElement extends Specification {
}
}
class StackWithThreeElements extends Specification {
class StackWithThreeElementsSpec extends Specification {
def stack = new Stack()
def setup() {

@ -27,7 +27,7 @@ import spock.lang.*
* @since 0.4
*/
@Stepwise
class StepwiseExtension extends Specification {
class StepwiseExtensionSpec extends Specification {
def "step 1"() {
expect: true // try to change this to 'false'
}

@ -16,7 +16,7 @@ import org.junit.Rule
import org.junit.rules.TestName
import spock.lang.Specification
class UsingJUnitRules extends Specification {
class UsingJUnitRulesSpec extends Specification {
@Rule TestName name
def "retrieve test name at runtime"() {
Loading…
Cancel
Save