matrei opened a new pull request, #2364:
URL: https://github.com/apache/groovy/pull/2364
## Background
As part of the ongoing effort to upgrade Grails to Groovy 5, it became
apparent that the `Groovysh` class is no longer available. It was replaced by
the `Main` class when Groovy switched to JLine 3 (introduced in #2263).
## Current Situation
Grails currently relies on `Groovysh` to start an interactive shell with a
preconfigured `Binding`, for example:
```groovy
Binding binding = new Binding()
binding.setVariable('ctx', this)
binding.setVariable(GrailsApplication.APPLICATION_ID,
getBean(GrailsApplication))
new Groovysh(binding, new IO()).run('')
```
This approach allows Grails to inject application-specific context into the
shell.
## Problem
The new `Main` class does not provide a programmatic entry point that allows
callers to supply a custom `Binding`. As a result, there is no straightforward
way to replicate the existing Grails behavior using the new shell
infrastructure.
## Proposed Solution
This PR introduces a programmatic entry point to the `Main` class that makes
it possible to inject a `Binding`. This restores the ability for Grails (and
other consumers) to launch the Groovy shell with a predefined execution
context, preserving existing functionality while remaining compatible with
Groovy 5.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]