Skip to content

Commit

Permalink
Fix parchment not enabled detection
Browse files Browse the repository at this point in the history
Add test to cover parchment usage
  • Loading branch information
marchermans committed Aug 14, 2024
1 parent 3e2cc7b commit 60f2069
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public ParchmentExtensions(Project project) {
+ ":" + DEFAULT_PARCHMENT_ARTIFACT_PREFIX + minecraftVersion
+ ":" + mappingVersion
+ "@zip";
})
}).orElse("")
)
);
getConflictPrefix().convention("p_");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package net.neoforged.gradle.userdev

import net.neoforged.trainingwheels.gradle.functional.BuilderBasedTestSpecification
import org.gradle.testkit.runner.TaskOutcome

class ParchmentTests extends BuilderBasedTestSpecification {

@Override
protected void configurePluginUnderTest() {
pluginUnderTest = "net.neoforged.gradle.neoform";
injectIntoAllProject = true;
}

def "parchment can be used"() {
given:
def project = create("parchment_can_be_used", {
it.property("neogradle.subsystems.parchment.minecraftVersion", "1.21")
it.property("neogradle.subsystems.parchment.mappingsVersion", "2024.07.28")
it.build("""
plugins {
id 'net.neoforged.gradle.userdev'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
dependencies {
implementation 'net.neoforged:neoforge:+'
}
""")
it.file("src/main/java/net/neoforged/gradle/userdev/ConfigurationCacheTests.java", """
package net.neoforged.gradle.userdev;
import net.minecraft.client.Minecraft;
public class ConfigurationCacheTests {
public static void main(String[] args) {
System.out.println(Minecraft.getInstance().getClass().toString());
}
}
""")
it.withToolchains()
it.withGlobalCacheDirectory(tempDir)
})

when:
def run = project.run {
it.tasks('compileJava')
it.arguments('--warning-mode', 'fail', '--stacktrace')
}

then:
run.task(':compileJava').outcome == TaskOutcome.SUCCESS
run.task(':neoFormApplyParchment').outcome == TaskOutcome.SUCCESS
}
}

0 comments on commit 60f2069

Please sign in to comment.