Match Mercury sourceCompatibility with Gradle (#224)

* Match Mercury sourceCompatibility with Gradle

* Fix checkstyle
dev/0.11
Jamie Mansfield 2020-07-16 18:17:50 +01:00 committed by GitHub
parent c2c3e5c3c6
commit 4eb699c2fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -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());