Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
0760a7c
test: add an end-to-end module verifying message bundles resolve in a…
codeconsole Sep 11, 2026
df49873
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Sep 16, 2026
e9acc03
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Sep 25, 2026
767c950
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 2, 2026
ef4d2ed
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 8, 2026
868975f
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 8, 2026
25321b7
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 9, 2026
709b8ae
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 9, 2026
0c5bdc0
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 12, 2026
55e96ba
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 12, 2026
13d88c8
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 12, 2026
e382b3e
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 13, 2026
e59381a
Drop the explicit indy setting from native-i18n
codeconsole Oct 13, 2026
6e272a0
Declare the GraalVM plugin in the end-to-end root build
codeconsole Oct 13, 2026
152d097
Bring the native-i18n README up to date with 9.0.x
codeconsole Oct 13, 2026
06756cb
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 14, 2026
17940d4
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 14, 2026
98f9684
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 15, 2026
8b85719
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 16, 2026
470f9f1
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 16, 2026
b82eb7f
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 16, 2026
7457422
Drop the README's caveat about #16165
codeconsole Oct 17, 2026
5e9c52b
Compile the native-i18n Application class statically
codeconsole Oct 17, 2026
c00fd30
Record the main class without dynamic dispatch
codeconsole Oct 17, 2026
0e92483
Compile the Settings interface statically
codeconsole Oct 17, 2026
74932d6
Compile MultiTenancySettings statically
codeconsole Oct 17, 2026
5172bc8
Create the default stack trace filterer directly
codeconsole Oct 17, 2026
d87e830
Carry the build information into a native image
codeconsole Oct 17, 2026
743521b
Register the default validation messages as a bundle
codeconsole Oct 17, 2026
e309277
Register the plugin descriptors and the plugins they name
codeconsole Oct 17, 2026
3ec4808
Register the classes grails.factories names
codeconsole Oct 17, 2026
9d564f7
Register the Caffeine classes the framework's caches use
codeconsole Oct 17, 2026
3310a65
Register the reflection compiled Groovy implies, read from its bytecode
codeconsole Oct 17, 2026
9e449d0
Register the artefacts and the classes that represent them
codeconsole Oct 17, 2026
7bee820
Register the beans the plugins declare as the application starts
codeconsole Oct 17, 2026
5945887
Register the framework classes dynamic descriptors reach
codeconsole Oct 17, 2026
3ffaa34
Register the property editors the core plugin installs
codeconsole Oct 17, 2026
9c3dc6f
Register the JDK types dynamically compiled framework code calls
codeconsole Oct 17, 2026
0ee0dba
Register the builder URL mappings are evaluated against
codeconsole Oct 17, 2026
6ef19da
Register the servlet context holder Holders creates by name
codeconsole Oct 17, 2026
b7c06c5
Register the promise factories the event bus reads its executor from
codeconsole Oct 17, 2026
0c63f49
Document what the framework registers for a native image
codeconsole Oct 17, 2026
a76c166
Say the native half of native-i18n needs no recorded metadata
codeconsole Oct 17, 2026
7f3c3d5
Find each plugin's own configuration in a native image
codeconsole Oct 17, 2026
fbcea50
Read the plugin's configuration in native-i18n
codeconsole Oct 17, 2026
2e11f69
Scan the native-i18n plugin's dependencies
codeconsole Oct 17, 2026
62250cc
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 17, 2026
919b350
Run the JVM half of native-i18n in production as well as development
codeconsole Oct 21, 2026
d8edebd
Build and run the native-i18n image in CI
codeconsole Oct 21, 2026
b002727
Merge remote-tracking branch 'upstream/9.0.x' into feature/native-i18…
codeconsole Oct 21, 2026
0b88585
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 21, 2026
6f3d514
Build the native-i18n image in CI with GraalVM 25.2
codeconsole Oct 21, 2026
e0b74ab
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 22, 2026
1505c44
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 22, 2026
d43bb21
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 22, 2026
5d1cde2
Say the framework's list covers starting the application, and a reque…
codeconsole Oct 22, 2026
228be69
Find a closure dynamically compiled code coerces with as
codeconsole Oct 22, 2026
3dee352
Skip a scanned class whose bytecode names a class that is absent
codeconsole Oct 22, 2026
904776b
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 23, 2026
452e34e
Find an as coercion whatever the value is declared as
codeconsole Oct 24, 2026
1f0e69b
Skip a sealed interface an as coercion names
codeconsole Oct 24, 2026
a1391eb
Merge branch '9.0.x' into feature/native-i18n-verification-8.0.x
codeconsole Oct 24, 2026
6f481ef
Drop the as Runnable a shutdown hook applied to nothing
codeconsole Oct 24, 2026
68fa0b8
Keep the constructor hint of a Spring class a registrar declares
codeconsole Oct 29, 2026
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
35 changes: 35 additions & 0 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
# root .sdkmanrc - it has to run on whatever the core build it consumes runs on - and only the
# fixture carries its own pin. The steps below read both out of those files rather than relying
# on Gradle toolchain auto-detection.
#
# A third, GraalVM 25.2, builds the native-i18n image at the end of the job, from the same published
# artifacts.
name: "End to End"
on:
push:
Expand Down Expand Up @@ -109,6 +112,7 @@ jobs:
working-directory: 'grails-gradle'
run: ./gradlew publishAllPublicationsToTestCaseMavenRepoRepository -PskipTests --stacktrace
- name: "📦 Setup: publish Grails to the local repository the tests resolve from"
id: publish-grails
run: ./gradlew publishAllPublicationsToTestCaseMavenRepoRepository -PskipTests --stacktrace
- name: "📦 Setup: build the precompiled Grails 7 / Groovy 4 fixture"
working-directory: 'end-to-end/legacy-g7-command-plugin'
Expand Down Expand Up @@ -153,6 +157,37 @@ jobs:
env:
DO_NOT_CACHE_TESTS: '1'
run: ./gradlew check --continue --stacktrace
- name: "☕️ Setup GraalVM for the native image"
# In this job rather than its own, so the image is built from the framework published above
# instead of publishing it a second time. It runs whether or not the tests above passed, and
# leaves JAVA_HOME alone: only the step below uses GraalVM.
if: ${{ !cancelled() && steps.publish-grails.outcome == 'success' }}
uses: graalvm/setup-graalvm@27b360dbb857524eaf0b4c4cef364d38e5b4f173 # v1.6.7
with:
distribution: graalvm-community
# The GraalVM release, not just the JDK: a java-version alone resolves to the last release tagged
# by JDK version, CE 25.0.2, which still cannot compile Groovy 4 or later. Releases since are
# tagged by GraalVM version, which is what this selects.
version: '25.2'
java-version: '25'
set-java-home: 'false'
check-for-updates: 'false'
- name: "🧪 Build and run the native-i18n image"
# The native half of native-i18n: compile the application to a binary with no recorded
# metadata and resolve every message bundle from it. GraalVM 25.2 or later, because GraalVM 21 and
# the first GraalVM 25 releases cannot compile Groovy 4 or later (oracle/graal#10200); see
# end-to-end/README.md.
if: ${{ !cancelled() && steps.publish-grails.outcome == 'success' }}
working-directory: 'end-to-end'
env:
JAVA_HOME: ${{ env.GRAALVM_HOME }}
run: |
set -euo pipefail
if [ -z "${JAVA_HOME:-}" ]; then
echo "setup-graalvm did not set GRAALVM_HOME; refusing to build the image on another JDK" >&2
exit 1
fi
./gradlew :native-i18n:i18nCheckOnNative -PnativeTests --stacktrace
- name: "📤 Upload test reports"
if: failure()
uses: actions/upload-artifact@v7.0.1
Expand Down
82 changes: 82 additions & 0 deletions end-to-end/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ applications at via `GRAILS_REPO_URL`.
| `legacy-g7-command-plugin` | A **standalone build**, not part of this one. Compiles against published Grails 7 / Groovy 4 to produce a genuine precompiled `grails.dev.commands.ApplicationCommand` binary. |
| `legacy-commands-plugin` | A Grails 8 plugin whose legacy commands are recompiled under Groovy 5. |
| `legacy-commands` | A Grails 8 application that consumes both and runs their commands through the registry. |
| `native-i18n` | An application that resolves messages from three kinds of bundle, on a JVM always and inside a GraalVM binary when asked. |
| `native-i18n-plugin` | A plugin shipping a namespaced message bundle (`native-messages.properties`) and a `plugin.yml`, with a multi-word plugin name. |
| `spring-dependency-management` | A Grails 8 application that manages its versions with the legacy `io.spring.dependency-management` plugin instead of the Grails Gradle plugin's native `platform(grails-bom)`, as an upgraded Grails 7 application does. |
| `taglib-index-incremental` | Builds a Grails 8 application **twice, without a clean**, to prove a renamed or deleted tag library cannot survive in the published tag library index. Incremental behaviour is the whole point, so it cannot be expressed by a project the core build builds once for itself. |

Expand All @@ -53,6 +55,86 @@ published yet (a reproducible release build, or a fresh release branch whose ver
published), and otherwise silently fell back to whatever the Apache snapshot repository happened to
hold rather than the working tree.

## Native image verification

`native-i18n` exists because AOT processing on a JVM cannot falsify a resource hint. Every bundle on
a JVM classpath is readable whether it was registered or not, so a missing hint shows up only in a
compiled image — as a code resolving to itself, for a message that resolved perfectly in every test.

The application resolves one code from each way a bundle reaches the message source, and only the
first is covered by Spring Boot's own hints, which register the two hardcoded patterns
`messages.properties` and `messages_*.properties` and derive nothing from the configured base names:

| Bundle | Base name | Why it is here |
|---|---|---|
| the application's own | `messages` | The case Boot already covers, as a control. |
| the plugin's | `native-messages` | Namespaced, so Boot's patterns never reach it. Its file is at the root of the classpath, where Grails registers every properties file, so in an image this proves the plugin is found and its base name reaches the message source. The plugin name is multi-word, so this also covers the descriptor's hyphenated spelling being matched against the plugin's camel-case one. |
| one the application configured | `config.i18n.custom` | Outside `grails-app/i18n` and the root, so the only one carried into an image by the hints derived from the base names alone, and written dotted, so it also proves the base name is converted to `config/i18n/custom` before being registered. |

Each is resolved in English and in a locale variant. The locale half is the assertion that would
fail if the hints registered *bundles* rather than resource *patterns* and the image were built with
a narrower locale set than the bundles cover — the open question recorded in
https://github.com/apache/grails-core/issues/16176.

It also reads a value from the plugin's `plugin.yml`, because the image is built anyway and nothing
else checks that a plugin's configuration reaches one. On a JVM the file is found beside the plugin's
classes, in its JAR; an image has no JARs, so there it is found only through the copy the build makes
of it under the plugin's name.

```bash
cd end-to-end
./gradlew :native-i18n:check # the JVM half, part of `check`
./gradlew :native-i18n:check -PnativeTests # adds the native half
```

The JVM half runs in `check` and needs nothing special. It cannot falsify a hint; its value is as a
fixture guard, keeping the bundles and the assertions from drifting apart. It starts the packaged
application twice: in production, the environment the image starts in, and in development, the
environment `grails run-app` starts in, with reloading on, where bundles stopped resolving until
#16179. Every run is told which environment to expect and fails in any other, since the Grails Gradle
plugin starts every application task in development unless told otherwise.

The native half is opt-in because it needs a GraalVM toolchain and minutes of CPU. CI runs it at the
end of the End to End job, against the framework that job publishes.

The native half needs no recorded metadata. Nothing traced by an agent is checked in or generated: the
image is built from what the framework registers while the code is generated -- finding the plugins,
creating their beans and artefacts, what Groovy does reflectively -- and from the hints derived from the
configured base names. So a failure here is a gap in the framework, not in this fixture.

### Why this runs here and not on 8.0.x

Dynamic Groovy in a native image needs two things this branch has and 8.0.x deliberately does not:

| | 8.0.x | here |
|---|---|---|
| Groovy | 5, which has no AOT link mode | 6.0.0, which carries [GROOVY-12234](https://issues.apache.org/jira/browse/GROOVY-12234)'s AOT link mode for indy dispatch and ships its own native-image configuration |
| framework invokedynamic | off by default in `CompilePlugin`, because Groovy 5's indy default is a large runtime regression for dynamic Groovy (#15293) | on: Groovy 6's default, which `CompilePlugin` and the Grails Gradle plugin keep unless a build turns it off |

Without the AOT link mode, indy-compiled Groovy cannot link in an image: the runtime invokes
`IndyInterface`'s bootstrap method without its `<clinit>` having run, so a `static final` handle is
still null and it fails as `BootstrapMethodError: NullPointerException` at
`IndyInterface.makeBootHandle`. Without invokedynamic at all, Groovy classes carry a `CallSiteArray`
and define call-site classes as they run, which an image forbids: `UnsupportedFeatureError: Tried to
define class`, naming a class nobody wrote. Either one on its own is fatal, which is why native
image is not a Grails 8 capability and this module is not on that branch.

### What it needs

**A GraalVM JDK, and not necessarily the one that published the framework.** `GRAALVM_HOME` and
`JAVA_HOME` must point at a GraalVM before the image is built; `toolchainDetection = false` makes the
plugin honour it rather than resolving a toolchain, so the publish JDK and the image JDK do not have
to agree. Use GraalVM 25.2 or later. GraalVM 21, and GraalVM 25 up to CE 25.0.2, fail `nativeCompile`
during "Initializing" with `Could not find target method: ...IndyInterface.invalidateSwitchPoints()`,
because their bundled Groovy substitution targets a method Groovy 4+ removed
([oracle/graal#10200](https://github.com/oracle/graal/issues/10200)); 25.2.4 builds the image. GraalVM
releases after CE 25.0.2 are numbered by GraalVM version rather than JDK version, so ask for the
GraalVM release itself: `25.2.4-graalce` with SDKMAN, or `version: '25.2'` with `setup-graalvm`. What must
not happen is publishing on a JDK *newer* than the one the image is built with: `GroovyCompile` has
no `release` option, so the Groovy sources in `grails-gradle` are compiled for the running JDK, and a
newer class file version makes the image fail at *configuration* time, naming a framework class as
though the framework had regressed.

## JDKs

The Grails 7 half declares the JDK it needs in a `.sdkmanrc`, rather than a Gradle toolchain, so that
Expand Down
4 changes: 4 additions & 0 deletions end-to-end/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ plugins {
// workflow bumps, so the suite always resolves the version the core build just published.
// Every subproject inherits it from here.
id 'org.apache.grails.buildsrc.properties'
// Applied only by native-i18n, and only with -PnativeTests. Declared here rather than in that
// project, because a plugin only one project declares gives it a classloader of its own, and the
// vulnerability scan's shared build service cannot then be handed to its task there.
id 'org.graalvm.buildtools.native' version "$graalvmBuildtoolsVersion" apply false
}

def localMavenRepo = rootProject.layout.projectDirectory.dir('../build/local-maven')
Expand Down
5 changes: 5 additions & 0 deletions end-to-end/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx5G
org.gradle.configuration-cache=true
org.gradle.caching=true
org.gradle.parallel=true

# GraalVM Gradle plugin, used only by the opt-in native verification in native-i18n. It lives here
# rather than in dependencies.gradle because nothing the framework publishes depends on it - it is a
# build plugin for one fixture in this build, not a managed coordinate of the BOM.
graalvmBuildtoolsVersion=1.1.12
38 changes: 38 additions & 0 deletions end-to-end/native-i18n-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

plugins {
id 'org.apache.grails.buildsrc.properties'
id 'org.apache.grails.buildsrc.dependency-validator'
id 'org.apache.grails.buildsrc.compile'
id 'org.apache.grails.buildsrc.vulnerability-scan'
id 'org.apache.grails.gradle.grails-plugin'
}

version = '0.0.1'
group = 'nativei18n.plugin'

dependencies {
implementation platform("org.apache.grails:grails-bom:$projectVersion")
implementation 'org.apache.grails:grails-core'
}

apply {
from rootProject.layout.projectDirectory.file('../gradle/grails-extension-gradle-config.gradle')
}
23 changes: 23 additions & 0 deletions end-to-end/native-i18n-plugin/grails-app/conf/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Found beside the plugin's classes on a JVM. An image has no such place, so the application reading this
# proves the copy the build makes of it, under the plugin's name, was carried into the image.
native:
plugin:
configuration: from the plugin configuration
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
native.plugin.greeting=hello from the plugin bundle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
native.plugin.greeting=bonjour depuis le paquet du plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package nativei18n.plugin

import grails.plugins.Plugin

/**
* A plugin whose Grails name is multi-word, so its bundle exercises both halves of the naming:
* the descriptor records the hyphenated {@code native-messages}, while the plugin the application
* discovers reports the logical {@code nativeMessages}.
*/
class NativeMessagesGrailsPlugin extends Plugin {

def grailsVersion = '9.0.0-SNAPSHOT > *'
}
Loading
Loading