Skip to content

Fix spock module path compatibility #1231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,22 @@ 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
if (JavaVersion.current().isJava8()) {
include "spock-tapestry"
}


include "spock-unitils"
include "spock-gradle"

Expand Down
2 changes: 1 addition & 1 deletion spock-groovy2-compat/groovy2-compat.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
}
}
26 changes: 13 additions & 13 deletions spock-temp/temp.gradle → spock-module-test/module-test.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ ext.displayName = "Spock Framework - Temp Specs for Core Module"

apply plugin: "spock-base"

//configurations {
// junit
//}

dependencies {
testCompile project(":spock-core")

testRuntime libs.asm
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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions spock-module-test/src/test/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open module org.acme.test {
exports org.acme.test;

requires java.desktop;

requires org.spockframework.core;
}
13 changes: 13 additions & 0 deletions spock-module-test/src/test/java/org/acme/test/PojoClass.java
Original file line number Diff line number Diff line change
@@ -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;
}
}