Skip to content

Commit

Permalink
Move from GroovyPageForkCompileTask's deprecated `Project.javaexec(Ac…
Browse files Browse the repository at this point in the history
…tion)` method to `ExecOperations.javaexec(Action)`

Closes gh-708
  • Loading branch information
rainboyan committed Nov 13, 2024
1 parent 074e79e commit e4023d2
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -51,6 +52,8 @@ import org.gradle.work.InputChanges
@CompileStatic
class GroovyPageForkCompileTask extends AbstractCompile {

private ExecOperations execOperations

@Input
@Optional
String packageName
Expand All @@ -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() {
Expand Down Expand Up @@ -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<JavaExecSpec>() {

@Override
Expand Down

0 comments on commit e4023d2

Please sign in to comment.