Skip to content

Commit

Permalink
Add test deps to the runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed May 25, 2024
1 parent f083594 commit 8a0e733
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.neoforged.gradle.common.util.run.TypesUtil;
import net.neoforged.gradle.dsl.common.extensions.Mappings;
import net.neoforged.gradle.dsl.common.extensions.Minecraft;
import net.neoforged.gradle.dsl.common.runs.run.Run;
import net.neoforged.gradle.dsl.common.runs.type.RunType;
import net.neoforged.gradle.dsl.common.runtime.tasks.tree.TaskTreeAdapter;
import net.neoforged.gradle.dsl.common.tasks.WithOutput;
Expand Down Expand Up @@ -90,11 +91,16 @@ public UserDevRuntimeExtension(Project project) {

spec.setMinecraftVersion(mcpRuntimeDefinition.getSpecification().getMinecraftVersion());

final NamedDomainObjectContainer<Run> runs = (NamedDomainObjectContainer<Run>) getProject().getExtensions().getByName(RunsConstants.Extensions.RUNS);
spec.getProject().afterEvaluate(project -> runs.stream().filter(run -> run.getIsJUnit().get())
.forEach(run -> spec.getProfile().getAdditionalTestDependencyArtifactCoordinates()
.get().forEach(run.getDependencies().get().getRuntime()::add)));

final NamedDomainObjectContainer<RunType> runTypes = (NamedDomainObjectContainer<RunType>) getProject().getExtensions().getByName(RunsConstants.Extensions.RUN_TYPES);
userdevProfile.getRunTypes().forEach((type) -> {
TypesUtil.registerWithPotentialPrefix(runTypes, spec.getIdentifier(), type.getName(), type::copyTo);
});

return new UserDevRuntimeDefinition(
spec,
mcpRuntimeDefinition,
Expand Down

0 comments on commit 8a0e733

Please sign in to comment.