Skip to content

Commit d8b7443

Browse files
committed
Fix #1205
1 parent 050eb5a commit d8b7443

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/main/java/net/fabricmc/loom/configuration/decompile/SplitDecompileConfiguration.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,19 @@ public void afterEvaluation() {
7979
for (DecompilerOptions options : extension.getDecompilerOptions()) {
8080
final String decompilerName = options.getFormattedName();
8181

82+
var commonTask = project.getTasks().named("gen%sSourcesWith%s".formatted("Common", decompilerName));
83+
var clientOnlyTask = project.getTasks().named("gen%sSourcesWith%s".formatted("ClientOnly", decompilerName));
84+
85+
clientOnlyTask.configure(task -> {
86+
task.mustRunAfter(commonTask);
87+
});
88+
8289
project.getTasks().register("genSourcesWith" + decompilerName, task -> {
8390
task.setDescription("Decompile minecraft using %s.".formatted(decompilerName));
8491
task.setGroup(Constants.TaskGroup.FABRIC);
8592

86-
task.dependsOn(project.getTasks().named("gen%sSourcesWith%s".formatted("Common", decompilerName)));
87-
task.dependsOn(project.getTasks().named("gen%sSourcesWith%s".formatted("ClientOnly", decompilerName)));
93+
task.dependsOn(commonTask);
94+
task.dependsOn(clientOnlyTask);
8895
});
8996
}
9097

src/test/groovy/net/fabricmc/loom/test/integration/SplitProjectTest.groovy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import spock.lang.Unroll
2929

3030
import net.fabricmc.loom.test.util.GradleProjectTestTrait
3131

32+
import static net.fabricmc.loom.test.LoomTestConstants.PRE_RELEASE_GRADLE
3233
import static net.fabricmc.loom.test.LoomTestConstants.STANDARD_TEST_VERSIONS
3334
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
3435

@@ -48,4 +49,16 @@ class SplitProjectTest extends Specification implements GradleProjectTestTrait {
4849
where:
4950
version << STANDARD_TEST_VERSIONS
5051
}
52+
53+
@Unroll
54+
def "genSources (gradle #version)"() {
55+
setup:
56+
def gradle = gradleProject(project: "splitSources", version: PRE_RELEASE_GRADLE)
57+
58+
when:
59+
def result = gradle.run(tasks: ["genSources"])
60+
61+
then:
62+
result.task(":genSources").outcome == SUCCESS
63+
}
5164
}

0 commit comments

Comments
 (0)