Skip to content

Commit f7c003c

Browse files
authored
Merge pull request #14065 from rainboyan/optimize_shell_cli
Optimize the performance of the Shell CLI by reducing the length of t…
2 parents a6e2221 + e680c9a commit f7c003c

File tree

2 files changed

+39
-34
lines changed

2 files changed

+39
-34
lines changed

gradle/assemble.gradle

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ apply plugin: GrailsBuildPlugin
77

88
List<Configuration> libsConfigurations = []
99
subprojects { subproject ->
10-
if (subproject.name in ['grails-shell', 'grails-core']) {
10+
if (subproject.name == 'grails-shell') {
1111
libsConfigurations << configurations.create("${subproject.name}-libs") {
12-
extendsFrom configurations.compileClasspath, configurations.runtimeClasspath
12+
extendsFrom configurations.runtimeClasspath
1313
}
1414
}
1515
}
@@ -40,38 +40,6 @@ tasks.register('configurePopulateDependencies') {
4040
if (!projectNames.contains(dependency.name)) {
4141
populateDependencies.into("$dependency.group/$dependency.name/jars") {
4242
from artifact.file // this will trigger the actual download if necessary
43-
def sourceJar = sourceArtifacts[dependency]
44-
if (sourceJar) {
45-
from sourceJar.file
46-
}
47-
def javadocJar = javadocArtifacts[dependency]
48-
if (javadocJar) {
49-
from javadocJar.file
50-
}
51-
}
52-
53-
populateDependencies.into("$dependency.group/$dependency.name/jars") {
54-
from artifact.file // this will trigger the actual download if necessary
55-
def sourceJar = sourceArtifacts[dependency]
56-
if (sourceJar) {
57-
from sourceJar.file
58-
}
59-
def javadocJar = javadocArtifacts[dependency]
60-
if (javadocJar) {
61-
from javadocJar.file
62-
}
63-
}
64-
65-
populateDependencies.into("$dependency.group/$dependency.name") {
66-
def pomFile = pomArtifacts[dependency]
67-
if (pomFile) {
68-
from pomFile.file
69-
}
70-
}
71-
72-
populateDependencies.from("${metadata}/${dependency.group}/${dependency.name}/${dependency.version}") {
73-
include "**/*ivy.xml"
74-
eachFile { it.path = "$dependency.group/$dependency.name/ivy-${dependency.version}.xml" }
7543
}
7644
}
7745
}

grails-shell/build.gradle

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,43 @@ repositories {
66
mavenCentral()
77
}
88

9+
configurations {
10+
// This is a workaround that can optimize the performance of the Shell CLI by reducing the length of the CLASSPATH,
11+
// while also solving the problem of the length limit of command line parameters in the Windows environment
12+
// This can be removed when we solve the dependencies of grails-bootstrap, grails-shell
13+
runtimeClasspath {
14+
exclude group: 'commons-codec', module: 'commons-codec'
15+
exclude group: 'com.github.ben-manes.caffeine', module: 'caffeine'
16+
exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api'
17+
exclude group: 'jakarta.inject', module: 'jakarta.inject-api'
18+
exclude group: 'javax.annotation', module: 'javax.annotation-api'
19+
exclude group: 'javax.inject', module: 'javax.inject'
20+
exclude group: 'javax.persistence', module: 'javax.persistence-api'
21+
exclude group: 'javax.transaction', module: 'javax.transaction-api'
22+
exclude group: 'junit', module: 'junit'
23+
exclude group: 'io.micrometer', module: 'micrometer-observation'
24+
exclude group: 'io.micrometer', module: 'micrometer-commons'
25+
exclude group: 'org.checkerframework', module: 'checker-qual'
26+
exclude group: 'org.apache.ant', module: 'ant-antlr'
27+
exclude group: 'org.apache.ant', module: 'ant-junit'
28+
exclude group: 'org.apache.commons', module: 'commons-compress'
29+
exclude group: 'org.apache.groovy', module: 'groovy-groovydoc'
30+
exclude group: 'org.apache.groovy', module: 'groovy-jmx'
31+
exclude group: 'org.codehaus.plexus', module: 'plexus-classworlds'
32+
exclude group: 'org.codehaus.plexus', module: 'plexus-component-annotations'
33+
exclude group: 'org.codehaus.plexus', module: 'plexus-sec-dispatcher'
34+
exclude group: 'org.hamcrest', module: 'hamcrest'
35+
exclude group: 'org.hamcrest', module: 'hamcrest-core'
36+
exclude group: 'org.javassist', module: 'javassist'
37+
exclude group: 'org.springframework', module: 'spring-aop'
38+
exclude group: 'org.springframework', module: 'spring-expression'
39+
exclude group: 'org.springframework', module: 'spring-jcl'
40+
exclude group: 'org.springframework', module: 'spring-tx'
41+
exclude group: 'org.springframework', module: 'spring-web'
42+
exclude group: 'org.springframework.boot', module: 'spring-boot-autoconfigure'
43+
}
44+
}
45+
946
dependencies {
1047
// compile grails-shell with the Groovy version provided by Gradle
1148
// to ensure build compatibility with Gradle, currently Groovy 3.0.x

0 commit comments

Comments
 (0)