Skip to content

Commit

Permalink
Merge pull request #23463 Backport fix for "Unable to make progress r…
Browse files Browse the repository at this point in the history
…unning work" issue

Fixes #23294

Co-authored-by: Stefan Wolf <wolf@gradle.com>
  • Loading branch information
bot-gradle and wolfs committed Jan 10, 2023
2 parents c28c3f3 + e529a26 commit fbee4da
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
Expand Up @@ -137,6 +137,7 @@ abstract class AbstractCommandLineOrderTaskIntegrationTest extends AbstractInteg
final Set<String> localState = []
final Set<String> inputFiles = []
boolean shouldBlock
String failMessage

TaskFixture(ProjectFixture project, String path) {
this.project = project
Expand Down Expand Up @@ -206,6 +207,11 @@ abstract class AbstractCommandLineOrderTaskIntegrationTest extends AbstractInteg
return this
}

TaskFixture fail(String message = 'BOOM') {
failMessage = message
return this
}

String getConfig() {
return """
tasks.register('${name}') {
Expand All @@ -219,6 +225,7 @@ abstract class AbstractCommandLineOrderTaskIntegrationTest extends AbstractInteg
${inputFiles.collect { 'inputs.files ' + it }.join('\n\t\t\t\t')}
doLast {
${shouldBlock ? server.callFromTaskAction(path) : ''}
${failMessage ? "throw new RuntimeException('$failMessage')" : ''}
}
}
""".stripIndent()
Expand Down
Expand Up @@ -16,7 +16,6 @@

package org.gradle.api


import org.gradle.integtests.fixtures.executer.TaskOrderSpecs
import spock.lang.Issue

Expand Down Expand Up @@ -448,4 +447,20 @@ class DestroyerTaskCommandLineOrderIntegrationTest extends AbstractCommandLineOr
where:
type << ProductionType.values()
}
def "build finishes with --continue even when producer task fails"() {
def clean = rootBuild.task('clean').destroys('build')
def compileJava = rootBuild.task('compileJava').outputs('build/classes/java').fail()
def compileGroovy = rootBuild.task('compileGroovy').outputs('build/classes/groovy').dependsOn(compileJava)
def classes = rootBuild.task('classes').dependsOn(compileJava).dependsOn(compileGroovy)
writeAllFiles()
when:
fails(clean.path, classes.path, '--continue')
then:
failure.assertHasDescription("Execution failed for task ':compileJava'.")
failure.assertHasFailures(1)
outputDoesNotContain('Unable to make progress running work.')
}
}
Expand Up @@ -68,7 +68,6 @@ public OrdinalNode getProducerLocationsNode() {
if (previous != null) {
producerLocationsNode.addDependencySuccessor(previous.getProducerLocationsNode());
}
producerLocationsNode.require();
}
return producerLocationsNode;
}
Expand All @@ -79,7 +78,6 @@ public OrdinalNode getDestroyerLocationsNode() {
if (previous != null) {
destroyerLocationsNode.addDependencySuccessor(previous.getDestroyerLocationsNode());
}
destroyerLocationsNode.require();
}
return destroyerLocationsNode;
}
Expand Down
Expand Up @@ -59,6 +59,7 @@ void addProducerNode(OrdinalGroup ordinal, LocalTaskNode producer, Consumer<Node

private void maybeSchedule(Consumer<Node> ordinalNodeConsumer, OrdinalNode node) {
if (requiredNodes.add(node)) {
node.require();
for (Node successor : node.getDependencySuccessors()) {
if (successor instanceof OrdinalNode) {
maybeSchedule(ordinalNodeConsumer, (OrdinalNode) successor);
Expand Down

0 comments on commit fbee4da

Please sign in to comment.