Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1205 #1207

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,19 @@ public void afterEvaluation() {
for (DecompilerOptions options : extension.getDecompilerOptions()) {
final String decompilerName = options.getFormattedName();

var commonTask = project.getTasks().named("gen%sSourcesWith%s".formatted("Common", decompilerName));
var clientOnlyTask = project.getTasks().named("gen%sSourcesWith%s".formatted("ClientOnly", decompilerName));

clientOnlyTask.configure(task -> {
task.mustRunAfter(commonTask);
});

project.getTasks().register("genSourcesWith" + decompilerName, task -> {
task.setDescription("Decompile minecraft using %s.".formatted(decompilerName));
task.setGroup(Constants.TaskGroup.FABRIC);

task.dependsOn(project.getTasks().named("gen%sSourcesWith%s".formatted("Common", decompilerName)));
task.dependsOn(project.getTasks().named("gen%sSourcesWith%s".formatted("ClientOnly", decompilerName)));
task.dependsOn(commonTask);
task.dependsOn(clientOnlyTask);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import spock.lang.Unroll

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

import static net.fabricmc.loom.test.LoomTestConstants.PRE_RELEASE_GRADLE
import static net.fabricmc.loom.test.LoomTestConstants.STANDARD_TEST_VERSIONS
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS

Expand All @@ -48,4 +49,16 @@ class SplitProjectTest extends Specification implements GradleProjectTestTrait {
where:
version << STANDARD_TEST_VERSIONS
}

@Unroll
def "genSources (gradle #version)"() {
setup:
def gradle = gradleProject(project: "splitSources", version: PRE_RELEASE_GRADLE)

when:
def result = gradle.run(tasks: ["genSources"])

then:
result.task(":genSources").outcome == SUCCESS
}
}