Skip to content

Commit

Permalink
Fix another config cache problem w/ RewriteDryRunTask
Browse files Browse the repository at this point in the history
  • Loading branch information
jbduncan committed Sep 6, 2023
1 parent aa4a258 commit 2a4cf10
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plugin/src/main/java/org/openrewrite/gradle/RewriteDryRunTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.openrewrite.gradle;

import org.gradle.api.file.ProjectLayout;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.specs.Specs;
Expand All @@ -24,15 +25,26 @@
import javax.inject.Inject;
import java.io.File;

public class RewriteDryRunTask extends AbstractRewriteTask {
public abstract class RewriteDryRunTask extends AbstractRewriteTask {

private static final Logger logger = Logging.getLogger(RewriteDryRunTask.class);

@Inject
public abstract ProjectLayout getProjectLayout();

// This must return File, rather than Path.
// On Gradle 4.0 annotating something returning a Path with @OutputFile triggers a bug that deadlocks Gradle
@OutputFile
public File getReportPath() {
return getProject().getBuildDir().toPath().resolve("reports").resolve("rewrite").resolve("rewrite.patch").toFile();
return getProjectLayout()
.getBuildDirectory()
.get()
.getAsFile()
.toPath()
.resolve("reports")
.resolve("rewrite")
.resolve("rewrite.patch")
.toFile();
}

@Inject
Expand Down

0 comments on commit 2a4cf10

Please sign in to comment.