From 4eb699c2fba79832c89712df744aaee27b4278b1 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Thu, 16 Jul 2020 18:17:50 +0100 Subject: [PATCH] Match Mercury sourceCompatibility with Gradle (#224) * Match Mercury sourceCompatibility with Gradle * Fix checkstyle --- .../net/fabricmc/loom/task/MigrateMappingsTask.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/net/fabricmc/loom/task/MigrateMappingsTask.java b/src/main/java/net/fabricmc/loom/task/MigrateMappingsTask.java index 5a9cb75..a048d5a 100644 --- a/src/main/java/net/fabricmc/loom/task/MigrateMappingsTask.java +++ b/src/main/java/net/fabricmc/loom/task/MigrateMappingsTask.java @@ -41,7 +41,9 @@ import org.cadixdev.mercury.Mercury; import org.cadixdev.mercury.remapper.MercuryRemapper; import org.gradle.api.GradleException; import org.gradle.api.IllegalDependencyNotation; +import org.gradle.api.JavaVersion; import org.gradle.api.Project; +import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.options.Option; @@ -159,6 +161,14 @@ public class MigrateMappingsTask extends AbstractLoomTask { project.getLogger().lifecycle(":remapping"); Mercury mercury = SourceRemapper.createMercuryWithClassPath(project, false); + final JavaPluginConvention convention = project.getConvention().findPlugin(JavaPluginConvention.class); + final JavaVersion javaVersion = convention != null + ? + convention.getSourceCompatibility() + : + JavaVersion.current(); + mercury.setSourceCompatibility(javaVersion.toString()); + mercury.getClassPath().add(minecraftMappedProvider.getMappedJar().toPath()); mercury.getClassPath().add(minecraftMappedProvider.getIntermediaryJar().toPath());