Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ codecov:

comment:
layout: "reach, diff, flags, files"
after_n_builds: 24
after_n_builds: 29
13 changes: 13 additions & 0 deletions .github/workflows/branches-and-prs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
- '3.0'
- '4.0'
- '5.0'
- '6.0'
java:
- '8'
- '11'
Expand All @@ -78,6 +79,12 @@ jobs:
- variant: '5.0'
java: '8'
os: 'ubuntu-latest'
- variant: '6.0'
java: '8'
os: 'ubuntu-latest'
- variant: '6.0'
java: '11'
os: 'ubuntu-latest'
include:
- variant: '2.5'
java: '8'
Expand All @@ -91,6 +98,9 @@ jobs:
- variant: '5.0'
java: '11'
os: 'windows-latest'
- variant: '6.0'
java: '17'
os: 'windows-latest'
- variant: '2.5'
java: '8'
os: 'macos-latest'
Expand All @@ -103,6 +113,9 @@ jobs:
- variant: '5.0'
java: '11'
os: 'macos-latest'
- variant: '6.0'
java: '17'
os: 'macos-latest'
steps:
- id: 'step-0'
name: 'Checkout Repository'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- '3.0'
- '4.0'
- '5.0'
- '6.0'
steps:
- id: 'step-0'
name: 'Checkout Repository'
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/common.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,20 @@ val Matrix.Companion.full
javaVersions = axes.javaVersions + axes.additionalJavaTestVersions,
exclude = {
((variant == "2.5") && (javaVersion!!.toInt() >= 17)) ||
((variant == "5.0") && (javaVersion!!.toInt() < 11))
((variant == "5.0") && (javaVersion!!.toInt() < 11)) ||
((variant == "6.0") && (javaVersion!!.toInt() < 17))
},
includes = listOf("windows-latest", "macos-latest")
.map { Matrix.Element(operatingSystem = it) }
.flatMap { element ->
axes.variants.map {
element.copy(
variant = it,
javaVersion = if (it == "5.0") "11" else axes.javaVersions.first()
javaVersion = when (it) {
"5.0" -> "11"
"6.0" -> "17"
else -> axes.javaVersions.first()
}
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: 'sudo apt update && sudo apt install --yes graphviz'
- id: 'step-3'
name: 'Build Docs'
run: './gradlew --stacktrace asciidoctor asciidoctorMarkdown javadoc "-Dvariant=5.0" "-DjavaVersion=25"'
run: './gradlew --stacktrace asciidoctor asciidoctorMarkdown javadoc "-Dvariant=6.0" "-DjavaVersion=25"'
- id: 'step-4'
name: 'Archive and upload docs'
uses: 'actions/upload-artifact@v7'
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,18 @@ workflow(
"strategy" to Strategy(
matrix = Matrix(
operatingSystems = listOf("ubuntu-latest"),
variants = Matrix.axes.variants.filter { it != "5.0" },
variants = Matrix.axes.variants.filter { it != "5.0" && it != "6.0" },
javaVersions = Matrix.axes.javaVersions.take(1),
includes = listOf(
Matrix.Element(
variant = "5.0",
javaVersion = "11",
operatingSystem = "ubuntu-latest"
),
Matrix.Element(
variant = "6.0",
javaVersion = "17",
operatingSystem = "ubuntu-latest"
)
)
)
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- '3.0'
- '4.0'
- '5.0'
- '6.0'
java:
- '8'
- '11'
Expand All @@ -58,6 +59,12 @@ jobs:
- variant: '5.0'
java: '8'
os: 'ubuntu-latest'
- variant: '6.0'
java: '8'
os: 'ubuntu-latest'
- variant: '6.0'
java: '11'
os: 'ubuntu-latest'
include:
- variant: '2.5'
java: '8'
Expand All @@ -71,6 +78,9 @@ jobs:
- variant: '5.0'
java: '11'
os: 'windows-latest'
- variant: '6.0'
java: '17'
os: 'windows-latest'
- variant: '2.5'
java: '8'
os: 'macos-latest'
Expand All @@ -83,6 +93,9 @@ jobs:
- variant: '5.0'
java: '11'
os: 'macos-latest'
- variant: '6.0'
java: '17'
os: 'macos-latest'
steps:
- id: 'step-0'
name: 'Checkout Repository'
Expand Down Expand Up @@ -128,6 +141,9 @@ jobs:
- variant: '5.0'
java: '11'
os: 'ubuntu-latest'
- variant: '6.0'
java: '17'
os: 'ubuntu-latest'
steps:
- id: 'step-0'
name: 'Checkout Repository'
Expand Down Expand Up @@ -155,7 +171,7 @@ jobs:
strategy:
matrix:
variant:
- '5.0'
- '6.0'
java:
- '25'
os:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ To generate an IDEA project configuration:
* `File -&gt; Open` in Intellij, then
* select the appropriate `spock-2.5.ipr`.

NOTE: You can provide an optional 'variant' flag to the gradle build `-Dvariant=[2.5|3.0|4.0]` that specifies the version of groovy you wish to use.
NOTE: You can provide an optional 'variant' flag to the gradle build `-Dvariant=[2.5|3.0|4.0|5.0|6.0]` that specifies the version of groovy you wish to use.
For example, if we wish to use groovy 3.0, we would run `./gradlew cleanIdea idea -Dvariant=3.0` and import the generated `spock-3.0.ipr` into Intellij.
You can also use the helper script `allVariants`, e.g., `./allVariants idea`, which will create or update the project for all three variants.
You can also use the helper script `allVariants`, e.g., `./allVariants idea`, which will create or update the project for all variants.

This should result in a fully functional IDE setup where:

Expand Down
8 changes: 6 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ https://groovyconsole.dev/[Groovy Web Console].
{spock-release-version}-groovy-3.0, {spock-release-version}-groovy-4.0, {spock-release-version}-groovy-5.0), released on {spock-release-date}.
* The current development version is *{spock-snapshot-version}-SNAPSHOT*
({spock-snapshot-version}-groovy-2.5-SNAPSHOT, {spock-snapshot-version}-groovy-3.0-SNAPSHOT,
{spock-snapshot-version}-groovy-4.0-SNAPSHOT), {spock-snapshot-version}-groovy-5.0-SNAPSHOT).
{spock-snapshot-version}-groovy-4.0-SNAPSHOT, {spock-snapshot-version}-groovy-5.0-SNAPSHOT,
{spock-snapshot-version}-groovy-6.0-SNAPSHOT).
* The Groovy 6.0 variant is an early _canary_ build against `org.apache.groovy:groovy:6.0.0-alpha-1` and requires Java 17+.

*NOTE:* Spock 2.x is based on the JUnit Platform and requires Java
8+/groovy-2.5+ (Groovy 3.0 or newer is recommended, especially in projects using
Expand Down Expand Up @@ -116,13 +118,15 @@ variable if they are not in standard places recognized by Gradle, e.g. `JDK11=/p
Spock is supported for Java version 8+.

Spock is supported for Groovy versions 2.5, 3.0, 4.0, and 5.0.
Groovy 6.0 is additionally available as an early _canary_ variant (built against `6.0.0-alpha-1`).

The tests are testing Spock with the specific versions (variants) of
Groovy and Java. Default Groovy version is 2.5.

The Groovy 3.0 and 4.0 variant should pass on all supported JDK versions,
Groovy 2.5 does not work with Java 17+:
Groovy 5.0 and newer does not work with Java <11:
Groovy 5.0 does not work with Java <11:
Groovy 6.0 does not work with Java <17:

....
./gradlew build
Expand Down
2 changes: 1 addition & 1 deletion allVariants
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
for var in 2.5 3.0 4.0 5.0; do
for var in 2.5 3.0 4.0 5.0 6.0; do
./gradlew -Dvariant="$var" "$@"
done
2 changes: 1 addition & 1 deletion allVariants.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@echo off
for %%v in (2.5 3.0 4.0 5.0) do (
for %%v in (2.5 3.0 4.0 5.0 6.0) do (
gradlew.bat -Dvariant=%%v %*
)
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ class SpockBasePlugin implements Plugin<Project> {
private static void compileTasks(Project project) {
project.with {
def javaToolchains = extensions.getByType(JavaToolchainService)
def variant = rootProject.extensions.getByType(ExtraPropertiesExtension).get("variant") as BigDecimal
// Groovy 6+ is compiled for Java 17 bytecode, so the Java compiler used to read the Groovy
// classes during `compileJava` must be at least Java 17. Older variants keep the Java 11 compiler.
def compilerVersion = variant >= 6.0g ? JavaLanguageVersion.of(17) : COMPILER_VERSION
tasks.withType(JavaCompile).configureEach { comp ->
if (comp.name == JavaPlugin.COMPILE_JAVA_TASK_NAME) {
comp.javaCompiler.set(javaToolchains.compilerFor {
it.languageVersion.set(COMPILER_VERSION)
it.languageVersion.set(compilerVersion)
})
comp.options.release.set(COMPILER_RELEASE_VERSION)
}
Expand Down
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ ext {
}
javaVersion = 11
}
} else if (variant == 6.0) {
groovyGroup = "org.apache.groovy"
groovyVersion = libs.versions.groovy6.get()
minGroovyVersion = "6.0.0"
maxGroovyVersion = "6.9.99"
if (javaVersion < 17) {
if (System.getProperty("javaVersion") != null) {
throw new InvalidUserDataException("Groovy $variant is not compatible with Java $javaVersion")
}
javaVersion = 17
}
} else {
throw new InvalidUserDataException("Unknown variant: $variant. Choose one of: $variants")
}
Expand Down
1 change: 1 addition & 0 deletions docs/release_notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include::include.adoc[]
=== Enhancements

* Improve `TooManyInvocationsError` now reports unsatisfied interactions with argument mismatch details, making it easier to diagnose why invocations didn't match expected interactions spockPull:2315[]
* Add an early _canary_ `groovy-6.0` variant built against `org.apache.groovy:groovy:6.0.0-alpha-1` (requires Java 17+)

=== Misc

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ org.gradle.caching=true

javaVersionsList=8, 11, 17, 21, 25
additionalJavaTestVersionsList=
variantsList=2.5, 3.0, 4.0, 5.0
variantsList=2.5, 3.0, 4.0, 5.0, 6.0
kotlin.code.style=official
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ groovy2 = '2.5.23'
groovy3 = '3.0.25'
groovy4 = '4.0.32'
groovy5 = '5.0.6'
groovy6 = '6.0.0-alpha-1'
jacoco = '0.8.14'
junit5 = '5.14.4'
junit6 = '6.1.0'
Expand Down Expand Up @@ -50,3 +51,4 @@ groovy-v2 = { module = "org.codehaus.groovy:groovy", version.ref="groovy2" }
groovy-v3 = { module = "org.codehaus.groovy:groovy", version.ref="groovy3" }
groovy-v4 = { module = "org.apache.groovy:groovy", version.ref="groovy4" }
groovy-v5 = { module = "org.apache.groovy:groovy", version.ref="groovy5" }
groovy-v6 = { module = "org.apache.groovy:groovy", version.ref="groovy6" }