Skip to content

Commit 28df289

Browse files
committed
Fix CI mode for 26.1
1 parent 615e888 commit 28df289

4 files changed

Lines changed: 84 additions & 42 deletions

File tree

dsl/common/src/main/groovy/net/neoforged/gradle/dsl/common/util/Constants.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Constants {
1414
public static final String BINPARCHER_TOOL_ARTIFACT = "net.neoforged.installertools:binarypatcher:2.1.7:fatjar"
1515
public static final String ACCESSTRANSFORMER_TOOL_ARTIFACT = "net.neoforged.accesstransformers:at-cli:11.0.2:fatjar"
1616
public static final String FART_TOOL_ARTIFACT = "net.neoforged:AutoRenamingTool:2.0.4:all"
17-
public static final String INSTALLERTOOLS_TOOL_ARTIFACT = "net.neoforged.installertools:installertools:4.0.6:fatjar"
17+
public static final String INSTALLERTOOLS_TOOL_ARTIFACT = "net.neoforged.installertools:installertools:4.0.13:fatjar"
1818
public static final String JARSPLITTER_TOOL_ARTIFACT = "net.neoforged.installertools:jarsplitter:2.1.7"
1919
public static final String DECOMPILER_TOOL_ARTIFACT = "org.vineflower:vineflower:1.10.1"
2020

userdev/src/functionalTest/groovy/net/neoforged/gradle/userdev/AdvancedFmlTests.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class AdvancedFmlTests extends BuilderBasedTestSpecification {
8787
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
8888
8989
dependencies {
90-
implementation 'net.neoforged:neoforge:+'
90+
implementation 'net.neoforged:neoforge:[21.11,21.12)'
9191
}
9292
""")
9393
it.file("src/main/java/net/neoforged/gradle/userdev/FunctionalTests.java", """

userdev/src/functionalTest/groovy/net/neoforged/gradle/userdev/FutureMCVersionTests.groovy

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,58 @@ class FutureMCVersionTests extends BuilderBasedTestSpecification {
4444
def run = project.run {
4545
it.tasks(':neoFormRecompile')
4646
it.stacktrace()
47+
it.debug()
4748
}
4849

4950
then:
5051
run.task(':neoFormRecompile').outcome == TaskOutcome.SUCCESS
5152
}
5253

54+
def "a mod with userdev as dependency can run the compile task for that dependency with the decompiler disabled"() {
55+
given:
56+
def project = create("running_compile_with_compiler_disabled", {
57+
it.build("""
58+
java.toolchain.languageVersion = JavaLanguageVersion.of(25)
59+
60+
repositories {
61+
maven {
62+
name = "Maven for PR #2879" // https://github.com/neoforged/NeoForge/pull/2879
63+
url = uri("https://prmaven.neoforged.net/NeoForge/pr2879")
64+
content {
65+
includeModule("net.neoforged", "neoforge")
66+
includeModule("net.neoforged", "testframework")
67+
}
68+
}
69+
}
70+
71+
dependencies {
72+
implementation 'net.neoforged:neoforge:26.1.0.0-alpha.3+snapshot-1'
73+
}
74+
""")
75+
it.file("src/main/java/net/neoforged/gradle/userdev/FunctionalTests.java", """
76+
package net.neoforged.gradle.userdev;
77+
78+
import net.minecraft.client.Minecraft;
79+
80+
public class FunctionalTests {
81+
public static void main(String[] args) {
82+
System.out.println(Minecraft.getInstance().getClass().toString());
83+
}
84+
}
85+
""")
86+
it.withToolchains()
87+
it.withGlobalCacheDirectory(tempDir)
88+
it.property("neogradle.subsystems.decompiler.enabled", "false")
89+
})
90+
91+
when:
92+
def run = project.run {
93+
it.tasks(':compileJava')
94+
it.stacktrace()
95+
}
5396

97+
then:
98+
run.task(':compileJava').outcome == TaskOutcome.SUCCESS
99+
run.task(":neoFormDecompile") == null
100+
}
54101
}

userdev/src/main/java/net/neoforged/gradle/userdev/runtime/extension/UserDevRuntimeExtension.java

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.neoforged.gradle.userdev.runtime.extension;
22

3+
import com.google.common.collect.Lists;
4+
import com.google.common.collect.Maps;
35
import net.neoforged.gradle.common.dependency.ExtraJarDependencyManager;
46
import net.neoforged.gradle.common.runtime.extensions.CommonRuntimeExtension;
57
import net.neoforged.gradle.common.runtime.tasks.BinaryAccessTransformer;
@@ -41,6 +43,7 @@
4143
import org.jetbrains.annotations.Nullable;
4244

4345
import java.io.File;
46+
import java.io.Serial;
4447
import java.util.List;
4548
import java.util.Map;
4649
import java.util.Objects;
@@ -232,7 +235,7 @@ public UserDevRuntimeExtension(Project project)
232235
final FileTree userDevJar)
233236
{
234237
return (steps, functions) -> {
235-
if (!useCombinedJarWithNeoForgeOnRecompile(userDevProfile) || !isObfuscatedVersion(userDevProfile.getNeoForm().get()))
238+
if (!useCombinedJarWithNeoForgeOnRecompile(userDevProfile))
236239
{
237240
return;
238241
}
@@ -244,6 +247,7 @@ public UserDevRuntimeExtension(Project project)
244247
steps.removeIf(step -> step.getType().equals("merge"));
245248
steps.removeIf(step -> step.getType().equals("mergeMappings"));
246249
steps.removeIf(step -> step.getType().equals("rename"));
250+
steps.removeIf(step -> step.getType().equals("preProcessJar"));
247251

248252
final int decompileIndex = ListUtils.removeIfAndReturnIndex(
249253
steps, step -> step.getType().equals("decompile")
@@ -256,6 +260,7 @@ public UserDevRuntimeExtension(Project project)
256260
"decompile", "decompile",
257261
Map.of(
258262
"libraries", "{listLibrariesOutput}",
263+
"inputLibraries", "{listLibrariesOutput}",
259264
"input", "{setupOutput}"
260265
)
261266
)
@@ -294,47 +299,37 @@ private record SetupConfiguration(
294299
private SetupConfiguration buildSetupConfiguration(final UserdevProfile userDevProfile, final FileTree userDevJar)
295300
{
296301
final Decompiler decompilerSubsystemConfiguration = getProject().getExtensions().getByType(Subsystems.class).getDecompiler();
297-
if (decompilerSubsystemConfiguration.getIsDisabled().get() && useCombinedJarWithNeoForgeOnRecompile(userDevProfile))
298-
{
299-
return new SetupConfiguration(
300-
List.of(
301-
"--task", "PROCESS_MINECRAFT_JAR",
302-
"--input", "{client}",
303-
"--input", "{server}",
304-
"--output", "{output}",
305-
"--input-mappings", "{clientMappings}",
306-
"--neoform-data", "{neoform}",
307-
"--apply-patches", "{patches}"
308-
),
309-
Map.of(
310-
"client", "{downloadClientOutput}",
311-
"clientMappings", "{downloadClientMappingsOutput}",
312-
"server", "{downloadServerOutput}",
313-
"neoform", "{neoform}",
314-
"patches", userDevProfile.getBinaryPatchFile()
315-
.map(patchFilePath -> userDevJar
316-
.matching(matcher -> matcher.include(patchFilePath))
317-
.getSingleFile()).get().getAbsolutePath()
318-
)
319-
);
302+
final List<String> arguments = Lists.newArrayList(
303+
"--task", "PROCESS_MINECRAFT_JAR",
304+
"--input", "{client}",
305+
"--input", "{server}",
306+
"--output", "{output}",
307+
"--neoform-data", "{neoform}"
308+
);
309+
final Map<String, String> values = Maps.newHashMap(Map.of(
310+
"client", "{downloadClientOutput}",
311+
"server", "{downloadServerOutput}",
312+
"neoform", "{neoform}"
313+
));
314+
315+
if (isObfuscatedVersion(userDevProfile.getNeoForm().get())) {
316+
arguments.addAll(List.of(
317+
"--input-mappings", "{clientMappings}"
318+
));
319+
values.put("clientMappings", "{downloadClientMappingsOutput}");
320320
}
321321

322-
return new SetupConfiguration(
323-
List.of(
324-
"--task", "PROCESS_MINECRAFT_JAR",
325-
"--input", "{client}",
326-
"--input", "{server}",
327-
"--output", "{output}",
328-
"--input-mappings", "{clientMappings}",
329-
"--neoform-data", "{neoform}"
330-
),
331-
Map.of(
332-
"client", "{downloadClientOutput}",
333-
"clientMappings", "{downloadClientMappingsOutput}",
334-
"server", "{downloadServerOutput}",
335-
"neoform", "{neoform}"
336-
)
337-
);
322+
if (decompilerSubsystemConfiguration.getIsDisabled().get() && useCombinedJarWithNeoForgeOnRecompile(userDevProfile)) {
323+
arguments.addAll(List.of(
324+
"--apply-patches", "{patches}"
325+
));
326+
values.put("patches", userDevProfile.getBinaryPatchFile()
327+
.map(patchFilePath -> userDevJar
328+
.matching(matcher -> matcher.include(patchFilePath))
329+
.getSingleFile()).get().getAbsolutePath());
330+
}
331+
332+
return new SetupConfiguration(arguments, values);
338333
}
339334

340335
private boolean useCombinedJarWithNeoForgeOnRecompile(final UserdevProfile userDevProfile)

0 commit comments

Comments
 (0)