@@ -9,6 +9,7 @@ import org.gradle.api.logging.StandardOutputListener
99import org.gradle.api.tasks.Internal
1010import org.gradle.api.tasks.TaskAction
1111import org.gradle.api.tasks.compile.JavaCompile
12+ import org.gradle.work.DisableCachingByDefault
1213
1314public 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." )
4345public 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