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
The following commit(s) were added to refs/heads/wrapper-rewrite by this push:
new ea6dc39ce1 styling & documentation feedback
ea6dc39ce1 is described below
commit ea6dc39ce1d263f51d2988786264a76bb7b28363
Author: James Daugherty <[email protected]>
AuthorDate: Thu May 15 10:32:44 2025 -0400
styling & documentation feedback
---
.../gettingStarted/downloadingAndInstalling.adoc | 10 ++++---
.../groovy/org/grails/gsp/GroovyPageMetaInfo.java | 35 ++++++++++++----------
grails-shell-cli/build.gradle | 2 +-
.../grails/cli/profile/ProfileRepoConfig.groovy | 16 +++++-----
.../cli/profile/commands/CommandRegistry.groovy | 4 +--
.../repository/MavenProfileRepository.groovy | 4 +--
.../grails/cli/profile/steps/StepRegistry.groovy | 2 +-
.../src/main/java/grails/init/GrailsVersion.java | 4 ++-
.../src/main/java/grails/init/Start.java | 1 +
9 files changed, 43 insertions(+), 35 deletions(-)
diff --git
a/grails-doc/src/en/guide/gettingStarted/downloadingAndInstalling.adoc
b/grails-doc/src/en/guide/gettingStarted/downloadingAndInstalling.adoc
index fb59638a67..7344d01bca 100644
--- a/grails-doc/src/en/guide/gettingStarted/downloadingAndInstalling.adoc
+++ b/grails-doc/src/en/guide/gettingStarted/downloadingAndInstalling.adoc
@@ -26,14 +26,16 @@ SDKMAN greatly simplifies installing and managing multiple
Grails versions.
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.
+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 somewhere.
+The process of building and 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 to
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.
+1. `grails-forge-cli` - the forge cli that was shipped as `grails` initially
in Grails 6. This CLI has both interactive completion & bash autocompletion.
+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.
+This CLI has only interactive completion.
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`.
@@ -92,5 +94,5 @@ Grails Version: {version}
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`.
+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-gsp/core/src/main/groovy/org/grails/gsp/GroovyPageMetaInfo.java
b/grails-gsp/core/src/main/groovy/org/grails/gsp/GroovyPageMetaInfo.java
index 4a2f7cbbb1..f83d0f16ad 100644
--- a/grails-gsp/core/src/main/groovy/org/grails/gsp/GroovyPageMetaInfo.java
+++ b/grails-gsp/core/src/main/groovy/org/grails/gsp/GroovyPageMetaInfo.java
@@ -1,20 +1,18 @@
/*
- * 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
+ * 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
+ * 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.
+ * 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 org.grails.gsp;
@@ -37,7 +35,12 @@ import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.util.ReflectionUtils;
-import java.io.*;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URL;
@@ -434,7 +437,7 @@ public class GroovyPageMetaInfo implements
GrailsApplicationAware {
Resource resource=resourceCallable.run();
if (resource != null && resource.exists()) {
long currentLastmodified=establishLastModified(resource);
- // granularity is required since lastmodified information
is rounded some where in copying & war (zip) file information
+ // granularity is required since lastmodified information
is rounded somewhere in copying & war (zip) file information
// usually the lastmodified time is 1000L apart in files
and in files extracted from the zip (war) file
if (currentLastmodified > 0 &&
Math.abs(currentLastmodified - lastModified) > LASTMODIFIED_CHECK_GRANULARITY) {
return resource;
diff --git a/grails-shell-cli/build.gradle b/grails-shell-cli/build.gradle
index ac5f39e0c8..22c7159724 100644
--- a/grails-shell-cli/build.gradle
+++ b/grails-shell-cli/build.gradle
@@ -150,7 +150,7 @@ extensions.configure(JavaApplication) {
tasks.named('startScripts').configure { it ->
it.doLast {
- File win =
project.layout.buildDirectory.file("scripts/grails-shell-cli.bat").get().asFile
+ File win =
project.layout.buildDirectory.file('scripts/grails-shell-cli.bat').get().asFile
win.text = win.text.replaceFirst(/(?m)^set CLASSPATH=.*$/,'set
CLASSPATH=%APP_HOME%\\\\lib\\\\*')
}
}
\ No newline at end of file
diff --git
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/ProfileRepoConfig.groovy
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/ProfileRepoConfig.groovy
index 543dfea68b..7c43b1adf3 100644
---
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/ProfileRepoConfig.groovy
+++
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/ProfileRepoConfig.groovy
@@ -39,25 +39,25 @@ class ProfileRepoConfig {
for (repoName in profileRepos.keySet()) {
def data = profileRepos.get(repoName)
if (data instanceof Map) {
- String uri = data.get("url") as String
+ String uri = data.get('url') as String
def snapshots = data.get('snapshotsEnabled')
if (uri != null) {
boolean enableSnapshots = snapshots != null ?
Boolean.valueOf(snapshots.toString()) : false
- final String username = data.get('username') as String
- final String password = data.get('password') as String
- repos << new ProfileRepoConfig(name: repoName as
String, url: uri, snapshots: enableSnapshots, username: username as String,
password: password as String)
+ String username = data.get('username') as String
+ String password = data.get('password') as String
+ repos << new ProfileRepoConfig(name: repoName as
String, url: uri, snapshots: enableSnapshots, username: username, password:
password)
}
}
}
}
// If the repo url from the wrapper is set, then the wrapper has been
configured for a local install, so honor it as a valid source
- String repoUrl = System.getProperty("grails.repo.url") ?:
System.getenv('GRAILS_REPO_URL')
+ String repoUrl = System.getProperty('grails.repo.url') ?:
System.getenv('GRAILS_REPO_URL')
if (repoUrl) {
- repos << new ProfileRepoConfig(name: "grails-override-repo", url:
fixRepoUrl(repoUrl), snapshots: Environment.grailsVersion.endsWith("SNAPSHOT"))
+ repos << new ProfileRepoConfig(name: 'grails-override-repo', url:
fixRepoUrl(repoUrl), snapshots: Environment.grailsVersion.endsWith('SNAPSHOT'))
}
- repos
+ return repos
}
private static String fixRepoUrl(String repoUrl) {
@@ -74,6 +74,6 @@ class ProfileRepoConfig {
return repoUrl
}
- Paths.get(repoUrl).toUri().toString()
+ return Paths.get(repoUrl).toUri().toString()
}
}
diff --git
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CommandRegistry.groovy
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CommandRegistry.groovy
index aa390606a1..7ac0d292f4 100644
---
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CommandRegistry.groovy
+++
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CommandRegistry.groovy
@@ -42,14 +42,14 @@ class CommandRegistry {
private List<CommandFactory> registeredCommandFactories = []
CommandRegistry() {
- Iterator<Command> commands = ServiceLoader.load(Command,
getClass().getClassLoader()).iterator()
+ Iterator<Command> commands = ServiceLoader.load(Command,
CommandRegistry.classLoader).iterator()
while(commands.hasNext()) {
Command command = commands.next()
registeredCommands[command.name] = command
}
- Iterator<CommandFactory> commandFactories =
ServiceLoader.load(CommandFactory, getClass().getClassLoader()).iterator()
+ Iterator<CommandFactory> commandFactories =
ServiceLoader.load(CommandFactory, CommandFactory.classLoader).iterator()
while(commandFactories.hasNext()) {
CommandFactory commandFactory = commandFactories.next()
registeredCommandFactories << commandFactory
diff --git
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/repository/MavenProfileRepository.groovy
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/repository/MavenProfileRepository.groovy
index 7afdc9be27..6d0cf62706 100644
---
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/repository/MavenProfileRepository.groovy
+++
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/repository/MavenProfileRepository.groovy
@@ -38,8 +38,8 @@ import org.grails.cli.profile.Profile
@CompileStatic
class MavenProfileRepository extends AbstractJarProfileRepository {
- public static final GrailsRepositoryConfiguration GRAILS_REPO = new
GrailsRepositoryConfiguration("grailsRepo", new
URI("https://repo.grails.org/grails/restricted"), true)
- public static final GrailsRepositoryConfiguration APACHE_REPO = new
GrailsRepositoryConfiguration("apacheRepository", new
URI("https://repository.apache.org/content/groups/public"), true)
+ public static final GrailsRepositoryConfiguration GRAILS_REPO = new
GrailsRepositoryConfiguration('grailsRepo', new
URI('https://repo.grails.org/grails/restricted'), true)
+ public static final GrailsRepositoryConfiguration APACHE_REPO = new
GrailsRepositoryConfiguration('apacheRepository', new
URI('https://repository.apache.org/content/groups/public'), true)
List<GrailsRepositoryConfiguration> repositoryConfigurations
MavenResolverGrapeEngine grapeEngine
diff --git
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/steps/StepRegistry.groovy
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/steps/StepRegistry.groovy
index 54b96b3b62..47da2715ad 100644
---
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/steps/StepRegistry.groovy
+++
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/steps/StepRegistry.groovy
@@ -34,7 +34,7 @@ class StepRegistry {
private static Collection<StepFactory> registeredStepFactories = []
static {
- def stepFactories = ServiceLoader.load(StepFactory,
StepRegistry.getClassLoader()).iterator()
+ def stepFactories = ServiceLoader.load(StepFactory,
StepRegistry.classLoader).iterator()
while(stepFactories.hasNext()) {
StepFactory stepFactory = stepFactories.next()
diff --git a/grails-wrapper/src/main/java/grails/init/GrailsVersion.java
b/grails-wrapper/src/main/java/grails/init/GrailsVersion.java
index 6949fd1251..0c061c78f2 100644
--- a/grails-wrapper/src/main/java/grails/init/GrailsVersion.java
+++ b/grails-wrapper/src/main/java/grails/init/GrailsVersion.java
@@ -20,7 +20,9 @@ import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-// Assists in parsing grails versions & sorting them by priority
+/**
+ * Assists in parsing grails versions & sorting them by priority
+ */
public class GrailsVersion implements Comparable<GrailsVersion> {
private static final Pattern VERSION_PATTERN =
Pattern.compile("^(\\d+)[.](\\d+)[.](.*)$");
diff --git a/grails-wrapper/src/main/java/grails/init/Start.java
b/grails-wrapper/src/main/java/grails/init/Start.java
index 90328559a8..695f0d4fb2 100644
--- a/grails-wrapper/src/main/java/grails/init/Start.java
+++ b/grails-wrapper/src/main/java/grails/init/Start.java
@@ -41,6 +41,7 @@ import java.util.stream.Collectors;
* 3. running from inside a grails project
*/
public class Start {
+
public static void main(String[] args) {
Authenticator.setDefault(new SystemPropertiesAuthenticator());