diff --git a/common/src/main/java/net/neoforged/gradle/common/runs/run/RunImpl.java b/common/src/main/java/net/neoforged/gradle/common/runs/run/RunImpl.java index a4786fb6..0363637c 100644 --- a/common/src/main/java/net/neoforged/gradle/common/runs/run/RunImpl.java +++ b/common/src/main/java/net/neoforged/gradle/common/runs/run/RunImpl.java @@ -39,6 +39,7 @@ public abstract class RunImpl implements ConfigurableDSLElement, Run { private final Project project; private final String name; + private final ListProperty rawSpecifications; private final ListProperty specifications; private final RunSourceSets modSources; private final RunSourceSets unitTestSources; @@ -68,7 +69,10 @@ public RunImpl(final Project project, final String name) { this.environmentVariables = this.project.getObjects().mapProperty(String.class, String.class); this.programArguments = this.project.getObjects().listProperty(String.class); this.systemProperties = this.project.getObjects().mapProperty(String.class, String.class); + + this.rawSpecifications = this.project.getObjects().listProperty(RunSpecification.class); this.specifications = this.project.getObjects().listProperty(RunSpecification.class); + this.specifications.addAll(rawSpecifications); getIsSingleInstance().convention(true); getIsClient().convention(false); @@ -265,13 +269,13 @@ public Provider> getSdkClasspathElements() { @Override public void runType(@NotNull String name) { getConfigureFromTypeWithName().set(false); // Don't re-configure - specifications.addAll(getRunTypesByName(name)); + rawSpecifications.addAll(getRunTypesByName(name)); } @Override public void run(@NotNull String name) { getConfigureFromTypeWithName().set(false); // Don't re-configure - specifications.addAll(getRunByName(name)); + rawSpecifications.addAll(getRunByName(name)); } @Override @@ -289,13 +293,12 @@ public final void configure() { } private void potentiallyAddRunTemplateFromType() { - List runTypes = specifications.map(l -> l.stream().filter(RunType.class::isInstance).map(RunType.class::cast).toList()).get(); - specifications.addAll( - runTypes.stream() - .map(RunType::getRunTemplate) - .filter(Objects::nonNull) - .toList()); + rawSpecifications.map(l -> l.stream().filter(RunType.class::isInstance).map(RunType.class::cast) + .map(RunType::getRunTemplate) + .filter(Objects::nonNull) + .toList()) + ); } private void configureFromRuns() { @@ -508,7 +511,7 @@ private void configureFromSDKs() { private void potentiallyAddRunTypeByName() { if (getConfigureFromTypeWithName().get()) { - specifications.addAll(getRunTypesByName(name)); + rawSpecifications.addAll(getRunTypesByName(name)); } } @@ -592,19 +595,19 @@ public final void configure(final @NotNull String name) { ); getConfigureFromTypeWithName().set(false); // Don't re-configure - specifications.addAll(getRunTypesByName(name)); + rawSpecifications.addAll(getRunTypesByName(name)); } @Override public final void configure(final @NotNull RunSpecification runType) { getConfigureFromTypeWithName().set(false); // Don't re-configure - this.specifications.add(project.provider(() -> runType)); + this.rawSpecifications.add(project.provider(() -> runType)); } @Override public void configure(@NotNull Provider typeProvider) { getConfigureFromTypeWithName().set(false); // Don't re-configure - this.specifications.add(typeProvider); + this.rawSpecifications.add(typeProvider); } @NotNull diff --git a/userdev/src/functionalTest/groovy/net/neoforged/gradle/userdev/RunTests.groovy b/userdev/src/functionalTest/groovy/net/neoforged/gradle/userdev/RunTests.groovy index 2a3af8bf..f32b81cf 100644 --- a/userdev/src/functionalTest/groovy/net/neoforged/gradle/userdev/RunTests.groovy +++ b/userdev/src/functionalTest/groovy/net/neoforged/gradle/userdev/RunTests.groovy @@ -103,8 +103,6 @@ class RunTests extends BuilderBasedTestSpecification { it.tasks(':runData') //We are expecting this test to fail, since there is a mod without any files included so it is fine. it.shouldFail() - it.stacktrace() - it.debug() } then: