You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2025/05/14 17:45:54 UTC

(grails-core) branch wrapper-rewrite updated (1686ea157f -> 34abfb0b77)

This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a change to branch wrapper-rewrite
in repository https://gitbox.apache.org/repos/asf/grails-core.git


    from 1686ea157f Updating documentation for Grails 7 release.
     new d45f321447 Minor cleanup related to gradle instructions
     new 27f7f7e709 Ensure a snapshot is not updated to by default if the current release is not a snapshot.
     new 34abfb0b77 Document the addition of multiple CLIs with Grails 7

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/en/guide/commandLine/gradleBuild.adoc      |  5 +--
 .../gettingStarted/downloadingAndInstalling.adoc   | 38 ++++++++++++++++++----
 .../src/en/guide/upgrading/upgrading60x.adoc       | 22 ++++++++-----
 .../main/java/grails/init/GrailsReleaseType.java   | 10 ++++++
 .../src/main/java/grails/init/Start.java           | 23 ++++++++++---
 5 files changed, 77 insertions(+), 21 deletions(-)


(grails-core) 02/03: Ensure a snapshot is not updated to by default if the current release is not a snapshot.

Posted by jd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch wrapper-rewrite
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 27f7f7e709ec1d3e97fb0902497bfa745b7b2d86
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Wed May 14 13:23:17 2025 -0400

    Ensure a snapshot is not updated to by default if the current release is not a snapshot.
---
 .../main/java/grails/init/GrailsReleaseType.java   | 10 ++++++++++
 .../src/main/java/grails/init/Start.java           | 23 ++++++++++++++++++----
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/grails-wrapper/src/main/java/grails/init/GrailsReleaseType.java b/grails-wrapper/src/main/java/grails/init/GrailsReleaseType.java
index 1e982d1251..3001042ad7 100644
--- a/grails-wrapper/src/main/java/grails/init/GrailsReleaseType.java
+++ b/grails-wrapper/src/main/java/grails/init/GrailsReleaseType.java
@@ -16,6 +16,10 @@
  */
 package grails.init;
 
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
 public enum GrailsReleaseType {
     RELEASE,
     RC,
@@ -25,4 +29,10 @@ public enum GrailsReleaseType {
     boolean isSnapshot() {
         return this == SNAPSHOT;
     }
+
+    public List<GrailsReleaseType> upTo() {
+        return Arrays.stream(GrailsReleaseType.values())
+                .filter(e -> e.ordinal() <= this.ordinal())
+                .collect(Collectors.toList());
+    }
 }
diff --git a/grails-wrapper/src/main/java/grails/init/Start.java b/grails-wrapper/src/main/java/grails/init/Start.java
index 26764c0d1b..a99e5146c8 100644
--- a/grails-wrapper/src/main/java/grails/init/Start.java
+++ b/grails-wrapper/src/main/java/grails/init/Start.java
@@ -45,8 +45,8 @@ public class Start {
         Authenticator.setDefault(new SystemPropertiesAuthenticator());
 
         try {
-            List<GrailsReleaseType> allowedTypes = getAllowedReleaseTypes();
             GrailsVersion preferredGrailsVersion = getPreferredGrailsVersion();
+            List<GrailsReleaseType> allowedTypes = getAllowedReleaseTypes(preferredGrailsVersion);
 
             GrailsUpdater updater = new GrailsUpdater(allowedTypes, preferredGrailsVersion);
             boolean forceUpdate = (args.length > 0 && args[0].trim().equals("update-wrapper"));
@@ -54,7 +54,9 @@ public class Start {
             boolean updated = false;
             String[] adjustedArgs = args;
             if (forceUpdate || updater.needsUpdating()) {
-                System.out.println("Updating Grails wrapper...");
+                String allowTypesString = allowedTypes.stream().map(GrailsReleaseType::name).collect(Collectors.joining(","));
+                System.out.printf("Updating Grails wrapper, allowed versions to update to are [%s]...%n", allowTypesString);
+
                 updated = updater.update();
 
                 // remove "update-wrapper" command argument
@@ -118,10 +120,23 @@ public class Start {
         return null;
     }
 
-    private static List<GrailsReleaseType> getAllowedReleaseTypes() {
+    private static List<GrailsReleaseType> getAllowedReleaseTypes(GrailsVersion preferredVersion) {
         String raw = System.getenv("GRAILS_WRAPPER_ALLOWED_TYPES");
         if (raw == null || raw.trim().isEmpty()) {
-            return null;
+            if (preferredVersion != null) {
+                //inside a grails project pull the equivalent version type or newer
+                return preferredVersion.releaseType.upTo();
+            } else {
+                String grailsVersion = Start.class.getPackage().getImplementationVersion();
+                GrailsVersion myVersion = new GrailsVersion(grailsVersion);
+
+                if (myVersion.releaseType != GrailsReleaseType.RELEASE) {
+                    return Arrays.asList(GrailsReleaseType.values());
+                }
+
+                // Only consider releases unless this wrapper
+                return List.of(GrailsReleaseType.RELEASE);
+            }
         }
 
         return Arrays.stream(raw.split(","))


(grails-core) 03/03: Document the addition of multiple CLIs with Grails 7

Posted by jd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch wrapper-rewrite
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 34abfb0b775c216f2e820f53840224c50a20fc2e
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Wed May 14 13:42:10 2025 -0400

    Document the addition of multiple CLIs with Grails 7
---
 .../gettingStarted/downloadingAndInstalling.adoc   | 38 ++++++++++++++++++----
 .../src/en/guide/upgrading/upgrading60x.adoc       | 22 ++++++++-----
 2 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/grails-doc/src/en/guide/gettingStarted/downloadingAndInstalling.adoc b/grails-doc/src/en/guide/gettingStarted/downloadingAndInstalling.adoc
index e1d01620ad..fb59638a67 100644
--- a/grails-doc/src/en/guide/gettingStarted/downloadingAndInstalling.adoc
+++ b/grails-doc/src/en/guide/gettingStarted/downloadingAndInstalling.adoc
@@ -17,9 +17,26 @@ specific language governing permissions and limitations
 under the License.
 ////
 
-The first step to getting up and running with Grails is to install the distribution.
+There are many ways to create a Grails application.
+The best way is to use either https://start.grails.org[start.grails.org] or use the Grails CLI via https://sdkman.io[SDKMAN].
+SDKMAN greatly simplifies installing and managing multiple Grails versions.
 
-The best way to install Grails on *nix systems is with https://sdkman.io[SDKMAN] which greatly simplifies installing and managing multiple Grails versions.
+=== Types of CLI
+
+Historically, Grails had one CLI - `grails shell`.
+In Grails 6, a new CLI was introduced `grails forge` that was meant to replace `grails shell`.
+Unfortunately, IntelliJ's Grails plugin relies on the legacy shell to provide functions for the IDE.
+For this reason, the decision was made to restore publishing of the `grails-shell` in later versions of Grails 6. The other problem is to customize application generation, `grails forge` would need to be forked, customized, published, and hosted some where.
+The process of building & hosting a custom version of `grails-forge` was found to be cumbersome for some people because the previous shell allowed for customization by providing a directory that laid out a skeleton of what create.
+Worse, some critical plugins, such as the database migration plugin had custom commands that cannot be easily imported into the forge cli.
+
+For this reason, Grails 7 adds the following commands to any Grails install:
+
+1. `grails-forge-cli` - the forge cli that was shipped as `grails` initially in Grails 6. This CLI has autocompletion and long term we intend to fold the legacy shell functions into it - including the ability to create custom commands & supporting a custom layout.
+2. `grails-shell-cli` - the legacy shell cli that IntelliJ uses.
+Historically, this shell has not had autocompletion.
+3. `grails` - a new, delegating shell application that will call either `grails-shell-cli` or `grails-forge-cli`.
+A specific version can be forced by passing the `-t` or `--type` argument with a value of `shell` or `forge`.
 
 === Install with SDKMAN
 
@@ -33,20 +50,21 @@ You can also specify a version
 [source,console,subs=attributes+]
 $ sdk install grails {version}
 
-You can find more information about SDKMAN usage on the https://sdkman.io/usage[SDKMAN Docs]
+You can find more information about SDKMAN usage on the https://sdkman.io/usage[SDKMAN Docs].
+After installing, all three CLI commands should be available.
 
 === Manual installation
 
 For manual installation follow these steps:
 
-* https://github.com/apache/grails-core/releases[Download] a binary distribution of Grails and extract the resulting zip file to a location of your choice.
+* https://github.com/apache/grails-forge/releases[Download] a binary distribution of Grails and extract the resulting zip file to a location of your choice.
 Then add the bin directory to your system path.
 
-=== Unix/Linux
+==== Unix/Linux
 
 ** This can be done by adding `export PATH="$PATH:/path/to/grails/bin"` to your profile
 
-=== Windows
+==== Windows
 ** Copy the path to the bin directory inside the grails folder you have downloaded, for example,
 
 ----
@@ -68,3 +86,11 @@ If Grails is working correctly you should now be able to type `grails --version`
 ----
 Grails Version: {version}
 ----
+
+=== Grails Wrapper
+
+The original CLI binaries can be quite large.
+When installing via SDKMAN or via a download, we include a single shadowJar that contains both shells and the associated scripts to invoke them.
+However, when a project is generated, we also include a wrapper `grailsw` that can be checked into source control.
+This wrapper will download the CLI's to `.grails/wrapper/myGrailsVersion` and invoke them when calling `grailsw`.
+It is meant to be a light weight option if SDKMAN is not available.
\ No newline at end of file
diff --git a/grails-doc/src/en/guide/upgrading/upgrading60x.adoc b/grails-doc/src/en/guide/upgrading/upgrading60x.adoc
index d78dfa842e..33773cb97e 100644
--- a/grails-doc/src/en/guide/upgrading/upgrading60x.adoc
+++ b/grails-doc/src/en/guide/upgrading/upgrading60x.adoc
@@ -188,21 +188,25 @@ After comparing to a generated build & updating your gradle files, you can now b
 
 This will initiate the build process with the new Gradle version.
 
-==== 11. Breaking changes
+==== 11. Grails CLI
+
+Both the legacy `grails-shell-cli` and `grails-forge-cli` are now included with Grails 7. Please see the xref:../guide/gettingStarted#downloadingAndInstalling[Downloading & Installing] section of this guide for important background on how to use the Grails CLI commands.
+
+==== 12. Breaking changes
 
 Grails 7.0.0 introduces several breaking changes that may require updates to your application.
 
-===== 11.0
+===== 12.0
 
 Due to the significant changes in Grails 7, all prior Grails Plugin will need updated to work with Grails 7. For plugins in the https://github.com/grails-plugins/[Grails Plugins] GitHub organization, the Grails Core team is updating them as time permits and when requested.
 If there is a plugin that you require updating, please reach out via https://github.com/apache/grails-core/issues[ticket] to see if we can help.
 
-===== 11.1 javax -> Jakarta
+===== 12.1 javax -> Jakarta
 
 Spring has switched from javax to https://jakarta.ee/[jakarta] packages.
 Please consult the Spring upgrade guides for the impacts of this change.
 
-===== 11.2 Removed libraries/classes
+===== 12.2 Removed libraries/classes
 - The `grails-web-fileupload` library, including its sole class `ContentLengthAwareCommonsMultipartResolver`, has been removed. This change was necessitated by the removal of the superclass `CommonsMultipartResolver` in Spring 6. The `ContentLengthAwareCommonsMultipartResolver` was originally introduced to address a bug in Safari back in 2007, but it is likely no longer needed. Spring has transitioned away from `CommonsMultipartResolver` and now recommends using the built-in support for  [...]
 - `org.grails.spring.beans.factory.OptimizedAutowireCapableBeanFactory` was previously deprecated and is now removed.
 - The following deprecated classes were removed, please use the suggested replacement:
@@ -211,7 +215,7 @@ Please consult the Spring upgrade guides for the impacts of this change.
 2. `org.grails.core.artefact.TagLibArtefactHandler` -> `org.grails.core.artefact.gsp.TagLibArtefactHandler`
 3. `org.grails.core.DefaultGrailsTagLibClass` -> `org.grails.core.gsp.DefaultGrailsTagLibClass`
 
-===== 11.3 Micronaut in Grails is now supported via the Micronaut Spring Boot Starter
+===== 12.3 Micronaut in Grails is now supported via the Micronaut Spring Boot Starter
 - This change was made based on community input: https://github.com/orgs/grails/discussions/13517
 - The removal of Micronaut enabled simplification of the Grails codebase and the return of Live Reload via https://github.com/HotswapProjects/HotswapAgent
 - The Micronaut Parent Context is no longer in Grails by default.
@@ -220,7 +224,7 @@ Please consult the Spring upgrade guides for the impacts of this change.
 - Using Micronaut Parent Context: https://micronaut-projects.github.io/micronaut-spring/latest/guide/#springParentContext
 - Using a Bean Post Processor: https://micronaut-projects.github.io/micronaut-spring/latest/guide/#beanPostProcessor
 
-===== 11.4 hibernate-ehcache
+===== 12.4 hibernate-ehcache
 
 The `org.hibernate:hibernate-ehcache` library is no longer provided by the `org.apache.grails:grails-hibernate5` plugin. If
 your application depends on `hibernate-ehcache`, you must now add it explicitly to your project dependencies.
@@ -242,17 +246,17 @@ dependencies {
 }
 ----
 
-===== 11.5 H2
+===== 12.5 H2
 
 The test database H2 is stricter about reserved keywords.
 If you use H2 in your application, please take a look at this https://github.com/grails/grails-data-hibernate5/pull/910/commits/c8de45df204966ccc228b46b94beeb2142ae0f59[pull request] for examples of these new restrictions.
 
-===== 11.6 Removal of Test Dependencies from Production Classpath
+===== 12.6 Removal of Test Dependencies from Production Classpath
 
 Prior versions of Grails included test dependencies on the production classpath.
 These are now removed in Grails 7. If you still need them, you can add them to your `implementation` configuration in your build.gradle file.
 
-===== 11.7 Jar Artifact name changes
+===== 12.7 Jar Artifact name changes
 
 Jar artifacts produced by Grails Plugins will no longer have the suffix `-plain`.
 Please see ticket https://github.com/apache/grails-gradle-plugin/pull/347[#347] for details.
\ No newline at end of file


(grails-core) 01/03: Minor cleanup related to gradle instructions

Posted by jd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch wrapper-rewrite
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit d45f321447385944383eee564d772bf31c91bdb3
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Wed May 14 11:43:24 2025 -0400

    Minor cleanup related to gradle instructions
---
 grails-doc/src/en/guide/commandLine/gradleBuild.adoc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/grails-doc/src/en/guide/commandLine/gradleBuild.adoc b/grails-doc/src/en/guide/commandLine/gradleBuild.adoc
index 6a02ad2228..1b244ab26d 100644
--- a/grails-doc/src/en/guide/commandLine/gradleBuild.adoc
+++ b/grails-doc/src/en/guide/commandLine/gradleBuild.adoc
@@ -17,11 +17,12 @@ specific language governing permissions and limitations
 under the License.
 ////
 
-Since Grails 3.1 the http://gradle.org[Gradle Build System] is used for build related tasks such as compilation, runnings tests and producing binary distributions of your project. It is recommended to use Gradle 2.2 or above with Grails 3.1 (and higher).
+The http://gradle.org[Gradle Build System] is used for build related tasks such as compilation, running tests and producing binary distributions of your Grails project.
+It is recommended to use Gradle {GradleVersion} or above with Grails.
 
 The build is defined by the `build.gradle` file which specifies the version of your project, the dependencies of the project and the repositories where to find those dependencies (amongst other things).
 
-When you invoke the `grails` command the version of Gradle that ships with Grails 3.1 (currently 2.9) is invoked by the `grails` process via the http://www.gradle.org/docs/current/userguide/embedding.html[Gradle Tooling API]:
+When you invoke the `grails` command the version of Gradle that ships with Grails (currently {GradleVersion}) is invoked by the `grails` process via the http://www.gradle.org/docs/current/userguide/embedding.html[Gradle Tooling API]:
 
 [source,bash]
 ----