Skip to content

Commit 66fcbc8

Browse files
Fix config cache edge cases
1 parent 87eb6a6 commit 66fcbc8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/groovy/net/wimods/gradle/GitHubCompileSummaryPlugin.groovy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.gradle.api.logging.StandardOutputListener
99
import org.gradle.api.tasks.Internal
1010
import org.gradle.api.tasks.TaskAction
1111
import org.gradle.api.tasks.compile.JavaCompile
12+
import org.gradle.work.DisableCachingByDefault
1213

1314
public class GitHubCompileSummaryPlugin implements Plugin<Project> {
1415
@Override
@@ -23,7 +24,7 @@ public class GitHubCompileSummaryPlugin implements Plugin<Project> {
2324
it.group = "verification"
2425
it.description = "Writes failed Java compiler output to the GitHub step summary."
2526
it.summaryFile.set(new File(summaryPath))
26-
it.outputs.upToDateWhen { false }
27+
it.onlyIf { OutputCaptureManager.hasCapture() }
2728
}
2829

2930
project.tasks.withType(JavaCompile).configureEach { JavaCompile compileTask ->
@@ -40,6 +41,7 @@ public class GitHubCompileSummaryPlugin implements Plugin<Project> {
4041
}
4142
}
4243

44+
@DisableCachingByDefault(because = "Writes captured compiler output to the GitHub step summary.")
4345
public abstract class GitHubCompileSummaryTask extends DefaultTask {
4446
@Internal
4547
public abstract RegularFileProperty getSummaryFile()
@@ -80,6 +82,10 @@ public class OutputCaptureManager {
8082
task.logging.addStandardErrorListener(capture.listener)
8183
}
8284

85+
public static boolean hasCapture() {
86+
return capture != null
87+
}
88+
8389
public static OutputCapture stop() {
8490
OutputCapture result = capture
8591
capture = null

0 commit comments

Comments
 (0)