From e4023d205fac9c169a17a951d298dabe6f5ea941 Mon Sep 17 00:00:00 2001 From: Michael Yan Date: Wed, 13 Nov 2024 18:16:42 +0800 Subject: [PATCH] Move from GroovyPageForkCompileTask's deprecated `Project.javaexec(Action)` method to `ExecOperations.javaexec(Action)` Closes gh-708 --- .../plugin/web/gsp/GroovyPageForkCompileTask.groovy | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/grace-gradle-plugin/src/main/groovy/org/grails/gradle/plugin/web/gsp/GroovyPageForkCompileTask.groovy b/grace-gradle-plugin/src/main/groovy/org/grails/gradle/plugin/web/gsp/GroovyPageForkCompileTask.groovy index 4aa258b214..5a3dea927b 100644 --- a/grace-gradle-plugin/src/main/groovy/org/grails/gradle/plugin/web/gsp/GroovyPageForkCompileTask.groovy +++ b/grace-gradle-plugin/src/main/groovy/org/grails/gradle/plugin/web/gsp/GroovyPageForkCompileTask.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 the original author or authors. + * Copyright 2014-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,7 @@ import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.compile.AbstractCompile +import org.gradle.process.ExecOperations import org.gradle.process.ExecResult import org.gradle.process.JavaExecSpec import org.gradle.work.InputChanges @@ -51,6 +52,8 @@ import org.gradle.work.InputChanges @CompileStatic class GroovyPageForkCompileTask extends AbstractCompile { + private ExecOperations execOperations + @Input @Optional String packageName @@ -76,6 +79,11 @@ class GroovyPageForkCompileTask extends AbstractCompile { @Nested GspCompileOptions compileOptions = getObjectFactory().newInstance(GspCompileOptions.class) + @Inject + GroovyPageForkCompileTask(ExecOperations execOperations) { + this.execOperations = execOperations + } + @Override @PathSensitive(PathSensitivity.RELATIVE) FileTree getSource() { @@ -106,7 +114,7 @@ class GroovyPageForkCompileTask extends AbstractCompile { packageName = project.name ?: project.projectDir.canonicalFile.name } - ExecResult result = project.javaexec( + ExecResult result = this.execOperations.javaexec( new Action() { @Override