Skip to content

Add Groovy 6 (alpha) executor variant with no-Spock fallback#957

Merged
leonard84 merged 4 commits into
mainfrom
groovy-6-no-spock-fallback
May 30, 2026
Merged

Add Groovy 6 (alpha) executor variant with no-Spock fallback#957
leonard84 merged 4 commits into
mainfrom
groovy-6-no-spock-fallback

Conversation

@leonard84
Copy link
Copy Markdown
Collaborator

Why

Groovy 6.0.0-alpha-1 is out, but Spock has no Groovy 6-compatible release yet, and disabling Spock's Groovy version check (as we do for Groovy 5) is not viable here — there are real incompatibilities. This adds a Groovy 6 variant that ships without Spock and falls back gracefully.

What

Decouple Spock from the executor core behind a ServiceLoader SPI

  • New gwc.spi.SpecSupport interface (runSpec / renderAst / spockVersion); GFunctionExecutor no longer imports any Spock type.
  • gwc.spock.* moves to a profile-gated source root src/spock/, compiled only into the Groovy 3/4/5 variants via build-helper-maven-plugin, and registered as a provider (SpockSpecSupport) through META-INF/services.
  • gwc.representations.ExecutionInfo also referenced Spock directly (SpockReleaseInfo); it now defaults spockVersion to n/a and is filled from the provider when present.

Fallback behavior (no provider on the classpath)

  • Plain Groovy scripts run normally.
  • A Spock spec or the AST view returns a clear message tied to the selected Groovy version, e.g. "Spock specifications are not supported on the selected Groovy version (6.0.0-alpha-1), because Spock has no release compatible with this Groovy version yet. Select a different Groovy version to use Spock; plain Groovy scripts work on all versions."

Build (Maven)

  • New groovy.6.version property and groovy_6_0_alpha profile (no spock-core).
  • spock-core + its runtime helpers (byte-buddy, objenesis, junit-platform-launcher) gated to the 3/4/5 profiles. The packaged G6 artifact contains groovy-6.0.0-alpha-1 and no Spock jars.
  • The concrete alpha version lives only in groovy.6.version, so bumping alpha-1 → alpha-2 is a one-line change deployed to the same groovy_6_0_alpha function.

Tests — G6 fallback tests (plain JUnit 5, no Spock) in src/no-spock-test/ via a gmavenplus testSources override; existing Spock tests unchanged for 3/4/5.

CIgroovy_6_0_alpha (java 21) added to build + deploy matrices.

Frontend — nicer label for pre-release ids ("Groovy 6.0-alpha"). Because the runtime id contains alpha, the existing view.ts selection logic never picks it as the default version. Runtime discovery (list_runtimes) and labeling pick it up automatically.

Verification

All variants build green locally:

Variant Result
groovy_3_0 10/10
groovy_4_0 (default) 10/10
groovy_5_0 10/10
groovy_6_0_alpha 4/4 fallback tests

G6 target/deployment/libs confirmed free of spock-core/byte-buddy/objenesis. Frontend lint passes.

Note: switching Maven profiles locally requires clean (documented in the README) — stale target/ classes from another profile otherwise cause a spock/lang/Specification failure on the Spock-free variant. CI is unaffected (fresh checkouts).

leonard84 added 3 commits May 29, 2026 20:58
Decouple Spock from the executor core behind a ServiceLoader-based SpecSupport
SPI. The Spock implementation (gwc.spock.*) moves to a profile-gated source root
(src/spock) compiled only into the Groovy 3/4/5 variants via build-helper. The
new groovy_6_0_alpha Maven profile ships without spock-core; when no provider is
present, Spock specs and the AST view return a clear 'not supported on this
Groovy version yet' message while plain Groovy runs normally.

- SpecSupport SPI + SpockSpecSupport provider (runSpec/renderAst/spockVersion)
- ExecutionInfo no longer references Spock directly (defaults spockVersion=n/a)
- pom: gate spock-core + byte-buddy/objenesis/junit-platform-launcher to 3/4/5;
  add groovy.6.version and groovy_6_0_alpha profile (JDK 17, no Spock)
- tests: G6 fallback tests in src/no-spock-test (plain JUnit 5)
- CI: add groovy_6_0_alpha (java 17) to build + deploy matrices
- frontend: nicer label for pre-release ids (id contains 'alpha' so the existing
  view.ts logic never selects it as the default)
- README + design spec updated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Groovy 6.0.0-alpha executor variant that ships without Spock by decoupling Spock-dependent functionality behind a ServiceLoader SPI and providing clear fallback behavior when the provider is absent.

Changes:

  • Introduces gwc.spi.SpecSupport and switches GFunctionExecutor + ExecutionInfo to use an optional provider (fallback messaging when absent).
  • Moves Spock implementation into a profile-gated source root (src/spock/) and registers it via META-INF/services.
  • Adds a Groovy 6 alpha Maven profile (no Spock deps) + JUnit fallback tests and updates CI matrices + frontend version labeling.

Reviewed changes

Copilot reviewed 12 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
services/frontend/src/ts/groovy-console.ts Improves runtime label formatting for pre-release IDs (e.g., 6_0_alpha6.0-alpha).
README.md Documents the new Groovy 6 alpha profile, Spock absence, and profile switching caveat.
functions/pom.xml Adds groovy.6.version property for the new alpha variant.
functions/groovy-executor/src/main/java/gwc/spi/SpecSupport.java Adds SPI interface to decouple Spock support from core executor.
functions/groovy-executor/src/main/java/gwc/GFunctionExecutor.java Loads SpecSupport via ServiceLoader, adds fallback messages when absent.
functions/groovy-executor/src/main/java/gwc/representations/ExecutionInfo.java Removes direct Spock reference; defaults spockVersion to n/a.
functions/groovy-executor/src/spock/resources/META-INF/services/gwc.spi.SpecSupport Registers the Spock-backed SPI provider for Spock-enabled builds.
functions/groovy-executor/src/spock/java/gwc/spock/SpockSpecSupport.java Implements SpecSupport using Spock runtime and AST tooling.
functions/groovy-executor/src/spock/java/gwc/spock/ScriptRunner.java Spock spec execution runner (JUnit Platform launcher integration).
functions/groovy-executor/src/spock/java/gwc/spock/ScriptCompiler.java Compiles Groovy scripts into spec classes for execution.
functions/groovy-executor/src/spock/java/gwc/spock/AstRenderer.java Renders/transpiles AST using Spock’s embedded compiler utilities.
functions/groovy-executor/src/spock/java/gwc/spock/output/* Adds tree-printing listener/printer utilities for rendered spec output.
functions/groovy-executor/src/no-spock-test/groovy/gwc/GFunctionExecutorFallbackTest.groovy Adds JUnit fallback tests for the no-Spock (Groovy 6) variant.
functions/groovy-executor/pom.xml Adds Groovy 6 alpha profile (no Spock deps) and profile-gated Spock sources/deps for 3/4/5.
.github/workflows/build-groovy-executor.yml Adds groovy_6_0_alpha to build matrix.
.github/workflows/deploy-groovy-executor.yml Adds groovy_6_0_alpha to deploy matrix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread functions/groovy-executor/src/main/java/gwc/GFunctionExecutor.java
Comment thread functions/groovy-executor/src/main/java/gwc/GFunctionExecutor.java
@leonard84 leonard84 force-pushed the groovy-6-no-spock-fallback branch from cf47098 to 7ee6ce6 Compare May 30, 2026 11:01
Copy link
Copy Markdown
Collaborator

@glaforge glaforge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, great idea to already let users experience Groovy 6, although it's just an alpha!
Any ETA on when the Spock support will be added too?

@leonard84 leonard84 added this pull request to the merge queue May 30, 2026
@leonard84
Copy link
Copy Markdown
Collaborator Author

leonard84 commented May 30, 2026

spockframework/spock#2356 still has some issues to resolve

Merged via the queue into main with commit aa36c96 May 30, 2026
13 checks passed
@leonard84 leonard84 deleted the groovy-6-no-spock-fallback branch May 30, 2026 12:59
leonard84 added a commit that referenced this pull request May 31, 2026
…support

* origin/main:
  Declare type in package.json to get rid of rsbuild warning
  Update frontend runtime to Java 21 in app.yaml
  Add a History modal with session switching and snapshot restore (#960)
  Pass required environment secrets to Cloud Function
  Update gcloud function deploy runtime to java21 for gen2 support
  Add Groovy 6 (alpha) executor variant with no-Spock fallback (#957)

# Conflicts:
#	.github/workflows/deploy-github-access.yml
#	services/frontend/src/ts/view.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants