Skip to content

Commit 624c421

Browse files
authored
Merge pull request #13570 from grails/revert-13407-13399-deprecate-the-old-grails-shell-project
Revert "chore(core): Deprecate the old grails-shell project"
2 parents 44f46fd + fe58976 commit 624c421

File tree

120 files changed

+10398
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+10398
-2
lines changed

gradle/assemble.gradle

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def libsConfigurations = []
66
subprojects { subproject ->
77
if(subproject.name == 'grails-dependencies') return
88
if(subproject.name == 'grails-bom') return
9-
if(subproject.name == 'grails-core') {
9+
if(subproject.name == 'grails-shell' || subproject.name == 'grails-core') {
1010

1111
configurations {
1212
libsConfigurations << libs {
@@ -137,13 +137,57 @@ task sourcesJars(type: Sync) {
137137
from { sourcesFor(libsConfigurations*.copyRecursive { it.name.startsWith('grails-datastore') }.collect { it.transitive = false; it }) }
138138
}
139139

140-
task install(dependsOn: [populateDependencies]) { task ->
140+
task grailsCreateStartScripts(type: GrailsCreateStartScripts) {
141+
description = "Creates OS specific scripts to run grails-shell as a JVM application."
142+
mainClass.set('org.grails.cli.GrailsCli')
143+
applicationName = 'grails'
144+
defaultJvmOpts = ["-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-XX:CICompilerCount=3"]
145+
outputDir = file('bin')
146+
classpath = rootProject.childProjects['grails-shell'].configurations.runtimeClasspath
147+
projectArtifacts = rootProject.childProjects['grails-shell'].tasks['jar'].outputs.files.collect { "dist/${it.name}" }
148+
doLast {
149+
ant.replace(file: file('bin/grails'), token: 'media/gradle.icns', value: 'media/icons/grails.icns')
150+
ant.chmod(file: file('bin/grails'), perm: 'ugo+rx')
151+
}
152+
}
153+
154+
class GrailsCreateStartScripts extends org.gradle.api.tasks.application.CreateStartScripts {
155+
156+
@Input
157+
Collection<String> projectArtifacts=[]
158+
159+
@org.gradle.api.tasks.TaskAction
160+
void generate() {
161+
def generator = new org.gradle.api.internal.plugins.StartScriptGenerator()
162+
generator.unixStartScriptGenerator.template = project.rootProject.childProjects['grails-shell'].resources.text.fromFile('src/main/resources/unixStartScript.txt')
163+
generator.applicationName = getApplicationName()
164+
generator.mainClassName = getMainClassName()
165+
generator.defaultJvmOpts = getDefaultJvmOpts()
166+
generator.optsEnvironmentVar = getOptsEnvironmentVar()
167+
generator.exitEnvironmentVar = getExitEnvironmentVar()
168+
generator.classpath = projectArtifacts + getClasspath().resolvedConfiguration.resolvedArtifacts.collect { artifact ->
169+
def dependency = artifact.moduleVersion.id
170+
String installedFile = "lib/$dependency.group/$dependency.name/jars/$artifact.file.name"
171+
if(dependency.group=='org.grails' && !project.file(installedFile).exists()) {
172+
installedFile = "dist/$artifact.file.name"
173+
}
174+
installedFile
175+
}
176+
generator.scriptRelPath = "bin/${getUnixScript().name}"
177+
generator.generateUnixScript(getUnixScript())
178+
generator.generateWindowsScript(getWindowsScript())
179+
}
180+
}
181+
182+
task install(dependsOn: [populateDependencies, grailsCreateStartScripts]) { task ->
141183
subprojects { Project project ->
142184
if(!project.name.startsWith('grails-test-suite')) {
143185
task.dependsOn("$project.name:publishToMavenLocal")
144186
}
145187
}
146188
}
189+
//task install(dependsOn: [populateDependencies, grailsCreateStartScripts] + subprojects.findAll { !it.name.startsWith('grails-test-suite') }
190+
// *.collect { Project p -> p.tasks.withType(PublishToMavenLocal)})
147191

148192
task zipDist(type: Zip, dependsOn: [sourcesJars, install]) {
149193
destinationDir = "${buildDir}/distributions" as File

grails-shell/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## grails-shell
2+
3+
This subproject provides code related to the Grails CLI and plugin commands.

grails-shell/build.gradle

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
apply plugin:'application'
2+
3+
mainClassName = "org.grails.cli.GrailsCli"
4+
5+
repositories {
6+
mavenCentral()
7+
}
8+
9+
ext {
10+
gradleToolingApiVersion = '7.3-20210825160000+0000'
11+
}
12+
13+
dependencies {
14+
api project(":grails-bootstrap")
15+
api project(":grails-gradle-model")
16+
api "org.apache.ant:ant:$antVersion"
17+
api "org.codehaus.groovy:groovy-ant:$groovyVersion"
18+
api "org.codehaus.groovy:groovy-json:$groovyVersion"
19+
api "org.codehaus.groovy:groovy-jmx:$groovyVersion"
20+
api "org.fusesource.jansi:jansi:$jansiVersion"
21+
api "jline:jline:$jlineVersion"
22+
api "org.gradle:gradle-tooling-api:$gradleToolingApiVersion"
23+
24+
api "org.springframework.boot:spring-boot-cli:$springBootVersion", {
25+
exclude group: "org.codehaus.groovy", module: "groovy"
26+
}
27+
implementation("org.apache.maven:maven-resolver-provider:3.9.6") {
28+
exclude group: "com.google.guava", module: "guava"
29+
}
30+
31+
implementation("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
32+
implementation("org.apache.maven.resolver:maven-resolver-impl:1.9.18")
33+
implementation("org.apache.maven.resolver:maven-resolver-transport-file:1.9.18")
34+
implementation("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") {
35+
exclude group: "org.slf4j", module:"jcl-over-slf4j"
36+
exclude group: "commons-codec", module:"commons-codec"
37+
}
38+
implementation("commons-codec:commons-codec:1.16.0")
39+
40+
testImplementation "net.sf.expectit:expectit-core:0.9.0"
41+
testImplementation "com.github.jnr:jnr-posix:3.1.18"
42+
43+
runtimeOnly "org.slf4j:slf4j-simple:$slf4jVersion"
44+
runtimeOnly "org.codehaus.plexus:plexus-component-api:1.0-alpha-33"
45+
46+
}
47+
48+
eclipse {
49+
classpath {
50+
file {
51+
whenMerged { classpath ->
52+
classpath.entries.find { entry -> entry.kind == 'src' && entry.path == "src/test/resources" }?.excludes=["profiles-repository/**", "gradle-sample/**"]
53+
}
54+
}
55+
}
56+
}
57+
58+
apply from: "../gradle/integration-test.gradle"
59+
60+
integrationTest {
61+
// jline doesn't use jline.terminal system property when TERM is dumb so use different TERM value for tests
62+
// https://github.com/jline/jline2/blob/6a1b6bf/src/main/java/jline/TerminalFactory.java#L54-L57
63+
environment 'TERM', 'xterm'
64+
// execute in single thread
65+
maxParallelForks = 1
66+
}

0 commit comments

Comments
 (0)