Skip to content

Commit

Permalink
Gradle plugin: fixes some errors like AbstractMethodError in GrailsEx…
Browse files Browse the repository at this point in the history
…tension and Environment
  • Loading branch information
rainboyan committed Jan 13, 2024
1 parent 8a0a6cd commit 3d473d1
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class GrailsGradlePlugin extends GroovyPlugin {

Task buildPropertiesTask = project.tasks.create('buildProperties')
Map<String, Object> buildPropertiesContents = [
'grails.env': Environment.isSystemSet() ? Environment.current.name : Environment.PRODUCTION.name,
'grails.env': Environment.isSystemSet() ? Environment.current.getName() : Environment.PRODUCTION.getName(),
'info.app.name': project.name,
'info.app.version': project.version instanceof Serializable ? project.version : project.version.toString(),
'info.app.grailsVersion': grailsVersion]
Expand Down Expand Up @@ -332,7 +332,7 @@ class GrailsGradlePlugin extends GroovyPlugin {
project.tasks.create(taskName, ApplicationContextCommandTask) {
classpath = fileCollection
command = commandName
systemProperty Environment.KEY, System.getProperty(Environment.KEY, Environment.DEVELOPMENT.name)
systemProperty Environment.KEY, System.getProperty(Environment.KEY, Environment.DEVELOPMENT.getName())
if (project.hasProperty('args')) {
args(CommandLineParser.translateCommandline(project.args))
}
Expand Down Expand Up @@ -472,8 +472,8 @@ class GrailsGradlePlugin extends GroovyPlugin {
TaskContainer tasks = project.tasks

String grailsEnvSystemProperty = System.getProperty(Environment.KEY)
tasks.withType(Test).each systemPropertyConfigurer.curry(grailsEnvSystemProperty ?: Environment.TEST.name)
tasks.withType(JavaExec).each systemPropertyConfigurer.curry(grailsEnvSystemProperty ?: Environment.DEVELOPMENT.name)
tasks.withType(Test).each systemPropertyConfigurer.curry(grailsEnvSystemProperty ?: Environment.TEST.getName())
tasks.withType(JavaExec).each systemPropertyConfigurer.curry(grailsEnvSystemProperty ?: Environment.DEVELOPMENT.getName())
}

protected void configureConsoleTask(Project project) {
Expand Down Expand Up @@ -559,9 +559,9 @@ class GrailsGradlePlugin extends GroovyPlugin {

taskContainer.getByName(sourceSet.processResourcesTaskName) { AbstractCopyTask task ->
GrailsExtension grailsExt = project.extensions.getByType(GrailsExtension)
boolean native2ascii = grailsExt.native2ascii
boolean native2ascii = grailsExt.isNative2ascii()
task.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
if (native2ascii && grailsExt.native2asciiAnt && !taskContainer.findByName('native2ascii')) {
if (native2ascii && grailsExt.isNative2asciiAnt() && !taskContainer.findByName('native2ascii')) {
File destinationDir = ((ProcessResources) task).destinationDir
Task native2asciiTask = createNative2AsciiTask(taskContainer, project.file("${grailsAppDir}/i18n"), destinationDir)
task.dependsOn(native2asciiTask)
Expand All @@ -583,7 +583,7 @@ class GrailsGradlePlugin extends GroovyPlugin {
filter(ReplaceTokens, tokens: replaceTokens)
}
}
else if (!grailsExt.native2asciiAnt) {
else if (!grailsExt.isNative2asciiAnt()) {
task.from(sourceSet.resources) {
include '**/*.properties'
filter(ReplaceTokens, tokens: replaceTokens)
Expand Down Expand Up @@ -646,7 +646,7 @@ class GrailsGradlePlugin extends GroovyPlugin {
if (project.tasks.findByName('runScript') == null) {
project.tasks.create('runScript', ApplicationContextScriptTask) {
classpath = project.sourceSets.main.runtimeClasspath + project.configurations.console + project.configurations.profile
systemProperty Environment.KEY, System.getProperty(Environment.KEY, Environment.DEVELOPMENT.name)
systemProperty Environment.KEY, System.getProperty(Environment.KEY, Environment.DEVELOPMENT.getName())
if (project.hasProperty('args')) {
args(CommandLineParser.translateCommandline(project.args))
}
Expand All @@ -669,7 +669,7 @@ class GrailsGradlePlugin extends GroovyPlugin {
}
project.tasks.create('runCommand', ApplicationContextCommandTask) {
classpath = project.sourceSets.main.runtimeClasspath + project.configurations.console + project.configurations.profile
systemProperty Environment.KEY, System.getProperty(Environment.KEY, Environment.DEVELOPMENT.name)
systemProperty Environment.KEY, System.getProperty(Environment.KEY, Environment.DEVELOPMENT.getName())
if (project.hasProperty('args')) {
args(CommandLineParser.translateCommandline(project.args))
}
Expand Down Expand Up @@ -711,7 +711,7 @@ class GrailsGradlePlugin extends GroovyPlugin {

GrailsExtension grailsExt = project.extensions.getByType(GrailsExtension)

if (grailsExt.pathingJar && Os.isFamily(Os.FAMILY_WINDOWS)) {
if (grailsExt.isPathingJar() && Os.isFamily(Os.FAMILY_WINDOWS)) {
project.tasks.withType(JavaExec) { JavaExec task ->
if (task.name in ['console', 'shell']
|| task instanceof ApplicationContextCommandTask
Expand Down

0 comments on commit 3d473d1

Please sign in to comment.