matrei commented on code in PR #14816:
URL: https://github.com/apache/grails-core/pull/14816#discussion_r2150200213
##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -564,57 +586,46 @@ class GrailsGradlePlugin extends GroovyPlugin {
}
NamedDomainObjectProvider<Configuration> consoleConfiguration =
project.configurations.register('console')
- def consoleTask = createConsoleTask(project, tasks,
consoleConfiguration)
- def shellTask = createShellTask(project, tasks,
consoleConfiguration)
-
- tasks.named('findMainClass').configure {
- it.doLast {
- def extraProperties =
project.getExtensions().getByType(ExtraPropertiesExtension)
- if (!extraProperties.has('mainClassName')) {
- return // disabled because we don't expect to run a
grails app (likely a plugin)
- }
-
- def mainClassName = extraProperties.get('mainClassName')
- if (mainClassName) {
- consoleTask.get().args mainClassName
- shellTask.get().args mainClassName
- project.tasks.withType(ApplicationContextCommandTask)
{ ApplicationContextCommandTask task ->
- task.args mainClassName
- }
- }
- project.tasks.withType(ApplicationContextScriptTask) {
ApplicationContextScriptTask task ->
- task.args mainClassName
- }
- }
- }
-
- consoleTask.configure {
- it.dependsOn(tasks.named('classes'),
tasks.named('findMainClass'))
- }
-
- shellTask.configure {
- it.dependsOn(tasks.named('classes'),
tasks.named('findMainClass'))
- }
+ createConsoleTask(project, tasks, consoleConfiguration)
+ createShellTask(project, tasks, consoleConfiguration)
}
}
@CompileDynamic
protected TaskProvider<JavaExec> createConsoleTask(Project project,
TaskContainer tasks, NamedDomainObjectProvider<Configuration> configuration) {
def consoleTask = tasks.register('console', JavaExec)
- consoleTask.configure {
- it.classpath = project.sourceSets.main.runtimeClasspath +
configuration.get()
- it.mainClass.set('grails.ui.console.GrailsSwingConsole')
+ project.afterEvaluate {
+ consoleTask.configure {
+ it.dependsOn(tasks.named('classes'),
tasks.named('findMainClass', FindMainClassTask))
+ it.classpath = project.sourceSets.main.runtimeClasspath +
configuration.get()
+ it.mainClass.set('grails.ui.console.GrailsSwingConsole')
+
+ def appClass = GrailsGradlePlugin.getMainClassProvider(project)
+
+ it.doFirst {
+ it.args(appClass.get())
+ }
+ }
}
consoleTask
}
@CompileDynamic
protected TaskProvider<JavaExec> createShellTask(Project project,
TaskContainer tasks, NamedDomainObjectProvider<Configuration> configuration) {
def shellTask = tasks.register('shell', JavaExec)
- shellTask.configure {
- it.classpath = project.sourceSets.main.runtimeClasspath +
configuration.get()
- it.mainClass.set('grails.ui.shell.GrailsShell')
- it.standardInput = System.in
+ project.afterEvaluate {
+ shellTask.configure {
+ it.dependsOn(tasks.named('classes'),
tasks.named('findMainClass', FindMainClassTask))
Review Comment:
OK, but is that relevant in the context of a parameter to `it.dependsOn()`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]