Skip to content

Commit

Permalink
Merge pull request #13570 from grails/revert-13407-13399-deprecate-th…
Browse files Browse the repository at this point in the history
…e-old-grails-shell-project

Revert "chore(core): Deprecate the old grails-shell project"
  • Loading branch information
codeconsole authored Jul 30, 2024
2 parents 44f46fd + fe58976 commit 624c421
Show file tree
Hide file tree
Showing 120 changed files with 10,398 additions and 2 deletions.
48 changes: 46 additions & 2 deletions gradle/assemble.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def libsConfigurations = []
subprojects { subproject ->
if(subproject.name == 'grails-dependencies') return
if(subproject.name == 'grails-bom') return
if(subproject.name == 'grails-core') {
if(subproject.name == 'grails-shell' || subproject.name == 'grails-core') {

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

task install(dependsOn: [populateDependencies]) { task ->
task grailsCreateStartScripts(type: GrailsCreateStartScripts) {
description = "Creates OS specific scripts to run grails-shell as a JVM application."
mainClass.set('org.grails.cli.GrailsCli')
applicationName = 'grails'
defaultJvmOpts = ["-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-XX:CICompilerCount=3"]
outputDir = file('bin')
classpath = rootProject.childProjects['grails-shell'].configurations.runtimeClasspath
projectArtifacts = rootProject.childProjects['grails-shell'].tasks['jar'].outputs.files.collect { "dist/${it.name}" }
doLast {
ant.replace(file: file('bin/grails'), token: 'media/gradle.icns', value: 'media/icons/grails.icns')
ant.chmod(file: file('bin/grails'), perm: 'ugo+rx')
}
}

class GrailsCreateStartScripts extends org.gradle.api.tasks.application.CreateStartScripts {

@Input
Collection<String> projectArtifacts=[]

@org.gradle.api.tasks.TaskAction
void generate() {
def generator = new org.gradle.api.internal.plugins.StartScriptGenerator()
generator.unixStartScriptGenerator.template = project.rootProject.childProjects['grails-shell'].resources.text.fromFile('src/main/resources/unixStartScript.txt')
generator.applicationName = getApplicationName()
generator.mainClassName = getMainClassName()
generator.defaultJvmOpts = getDefaultJvmOpts()
generator.optsEnvironmentVar = getOptsEnvironmentVar()
generator.exitEnvironmentVar = getExitEnvironmentVar()
generator.classpath = projectArtifacts + getClasspath().resolvedConfiguration.resolvedArtifacts.collect { artifact ->
def dependency = artifact.moduleVersion.id
String installedFile = "lib/$dependency.group/$dependency.name/jars/$artifact.file.name"
if(dependency.group=='org.grails' && !project.file(installedFile).exists()) {
installedFile = "dist/$artifact.file.name"
}
installedFile
}
generator.scriptRelPath = "bin/${getUnixScript().name}"
generator.generateUnixScript(getUnixScript())
generator.generateWindowsScript(getWindowsScript())
}
}

task install(dependsOn: [populateDependencies, grailsCreateStartScripts]) { task ->
subprojects { Project project ->
if(!project.name.startsWith('grails-test-suite')) {
task.dependsOn("$project.name:publishToMavenLocal")
}
}
}
//task install(dependsOn: [populateDependencies, grailsCreateStartScripts] + subprojects.findAll { !it.name.startsWith('grails-test-suite') }
// *.collect { Project p -> p.tasks.withType(PublishToMavenLocal)})

task zipDist(type: Zip, dependsOn: [sourcesJars, install]) {
destinationDir = "${buildDir}/distributions" as File
Expand Down
3 changes: 3 additions & 0 deletions grails-shell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## grails-shell

This subproject provides code related to the Grails CLI and plugin commands.
66 changes: 66 additions & 0 deletions grails-shell/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apply plugin:'application'

mainClassName = "org.grails.cli.GrailsCli"

repositories {
mavenCentral()
}

ext {
gradleToolingApiVersion = '7.3-20210825160000+0000'
}

dependencies {
api project(":grails-bootstrap")
api project(":grails-gradle-model")
api "org.apache.ant:ant:$antVersion"
api "org.codehaus.groovy:groovy-ant:$groovyVersion"
api "org.codehaus.groovy:groovy-json:$groovyVersion"
api "org.codehaus.groovy:groovy-jmx:$groovyVersion"
api "org.fusesource.jansi:jansi:$jansiVersion"
api "jline:jline:$jlineVersion"
api "org.gradle:gradle-tooling-api:$gradleToolingApiVersion"

api "org.springframework.boot:spring-boot-cli:$springBootVersion", {
exclude group: "org.codehaus.groovy", module: "groovy"
}
implementation("org.apache.maven:maven-resolver-provider:3.9.6") {
exclude group: "com.google.guava", module: "guava"
}

implementation("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
implementation("org.apache.maven.resolver:maven-resolver-impl:1.9.18")
implementation("org.apache.maven.resolver:maven-resolver-transport-file:1.9.18")
implementation("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") {
exclude group: "org.slf4j", module:"jcl-over-slf4j"
exclude group: "commons-codec", module:"commons-codec"
}
implementation("commons-codec:commons-codec:1.16.0")

testImplementation "net.sf.expectit:expectit-core:0.9.0"
testImplementation "com.github.jnr:jnr-posix:3.1.18"

runtimeOnly "org.slf4j:slf4j-simple:$slf4jVersion"
runtimeOnly "org.codehaus.plexus:plexus-component-api:1.0-alpha-33"

}

eclipse {
classpath {
file {
whenMerged { classpath ->
classpath.entries.find { entry -> entry.kind == 'src' && entry.path == "src/test/resources" }?.excludes=["profiles-repository/**", "gradle-sample/**"]
}
}
}
}

apply from: "../gradle/integration-test.gradle"

integrationTest {
// jline doesn't use jline.terminal system property when TERM is dumb so use different TERM value for tests
// https://github.com/jline/jline2/blob/6a1b6bf/src/main/java/jline/TerminalFactory.java#L54-L57
environment 'TERM', 'xterm'
// execute in single thread
maxParallelForks = 1
}
Loading

0 comments on commit 624c421

Please sign in to comment.