diff --git a/settings.gradle b/settings.gradle index 0688fa336a..b14f4e6d14 100755 --- a/settings.gradle +++ b/settings.gradle @@ -29,12 +29,14 @@ include "spock-spring" include "spock-spring:spring3-test" include "spock-guice" include "spock-junit4" -include "spock-temp" include "spock-testkit" if ((System.getProperty("variant") as BigDecimal ?: 2.5) != 3.0) { //Remove once Groovy 2.5 support is dropped include "spock-groovy2-compat" +} else if (JavaVersion.current().isJava9Compatible()) { + // works only in Java 9+ and groovy 3+ as spock-groovy2-compat is incompatible with the module system + include "spock-module-test" } // https://issues.apache.org/jira/projects/TAP5/issues/TAP5-2588 @@ -42,6 +44,7 @@ if (JavaVersion.current().isJava8()) { include "spock-tapestry" } + include "spock-unitils" include "spock-gradle" diff --git a/spock-groovy2-compat/groovy2-compat.gradle b/spock-groovy2-compat/groovy2-compat.gradle index 6f8010f05e..cf6486aa70 100644 --- a/spock-groovy2-compat/groovy2-compat.gradle +++ b/spock-groovy2-compat/groovy2-compat.gradle @@ -18,7 +18,7 @@ jar { 'Implementation-Title': project.name, 'Implementation-Version': variantLessVersion, 'Implementation-Vendor': 'spockframework.org', - 'Automatic-Module-Name': 'org.spockframework.groovy2-compat' + 'Automatic-Module-Name': 'org.spockframework.groovy2compat' ) } } diff --git a/spock-temp/temp.gradle b/spock-module-test/module-test.gradle similarity index 55% rename from spock-temp/temp.gradle rename to spock-module-test/module-test.gradle index 9eb330bcdf..d125fbe8af 100644 --- a/spock-temp/temp.gradle +++ b/spock-module-test/module-test.gradle @@ -2,10 +2,6 @@ ext.displayName = "Spock Framework - Temp Specs for Core Module" apply plugin: "spock-base" -//configurations { -// junit -//} - dependencies { testCompile project(":spock-core") @@ -13,24 +9,28 @@ dependencies { testRuntime libs.bytebuddy testRuntime libs.cglib testRuntime libs.objenesis - testRuntime libs.h2database - -// junit libs.junit4 } sourceCompatibility = javaVersion targetCompatibility = javaVersion -// necessary to make @NotYetImplemented transform work (transform that ships -// with Groovy and statically references third-party class junit.framwork.AssertionFailedError) -//tasks.withType(GroovyCompile) { -// groovyClasspath += configurations.junit -//} +tasks.withType(JavaCompile) { + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + options.compilerArgs -= ['--release', '8'] + options.encoding = 'UTF-8' +} + +java { + // enable module path + modularity.inferModulePath = true +} + test { useJUnitPlatform() reports.junitXml.enabled = true - reports.html.enabled = false + reports.html.enabled = true testLogging.exceptionFormat = "full" testLogging.showExceptions = true diff --git a/spock-temp/src/test/groovy/temp/FirstSpec.groovy b/spock-module-test/src/test/groovy/org/acme/test/ModuleSmokeSpec.groovy similarity index 53% rename from spock-temp/src/test/groovy/temp/FirstSpec.groovy rename to spock-module-test/src/test/groovy/org/acme/test/ModuleSmokeSpec.groovy index e7a475f6fc..2d3051b09d 100644 --- a/spock-temp/src/test/groovy/temp/FirstSpec.groovy +++ b/spock-module-test/src/test/groovy/org/acme/test/ModuleSmokeSpec.groovy @@ -1,8 +1,8 @@ -package temp +package org.acme.test import spock.lang.Specification -class FirstSpec extends Specification{ +class ModuleSmokeSpec extends Specification{ def "works"() { expect: true diff --git a/spock-module-test/src/test/java/module-info.java b/spock-module-test/src/test/java/module-info.java new file mode 100644 index 0000000000..d3381493de --- /dev/null +++ b/spock-module-test/src/test/java/module-info.java @@ -0,0 +1,7 @@ +open module org.acme.test { + exports org.acme.test; + + requires java.desktop; + + requires org.spockframework.core; +} diff --git a/spock-module-test/src/test/java/org/acme/test/PojoClass.java b/spock-module-test/src/test/java/org/acme/test/PojoClass.java new file mode 100644 index 0000000000..df89e6a168 --- /dev/null +++ b/spock-module-test/src/test/java/org/acme/test/PojoClass.java @@ -0,0 +1,13 @@ +package org.acme.test; + +public class PojoClass { + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +}