From 07ded449eeff2dcdb49f7208eb3e8db12fd0bacb Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 26 May 2022 11:21:53 +0100 Subject: [PATCH] Update mercury and set source compatibility version to 17 --- build.gradle | 2 +- .../net/fabricmc/loom/task/service/SourceRemapperService.java | 4 +++- src/main/java/net/fabricmc/loom/util/Constants.java | 2 ++ src/main/java/net/fabricmc/loom/util/SourceRemapper.java | 3 ++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index d67a8ca1..e697facd 100644 --- a/build.gradle +++ b/build.gradle @@ -98,7 +98,7 @@ dependencies { implementation ('net.fabricmc:cfr:0.1.1') // source code remapping - implementation ('net.fabricmc:mercury:0.2.5') + implementation ('net.fabricmc:mercury:0.2.6') // Kotlin implementation('org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.4.2') { diff --git a/src/main/java/net/fabricmc/loom/task/service/SourceRemapperService.java b/src/main/java/net/fabricmc/loom/task/service/SourceRemapperService.java index 45d2db00..30b1ea0f 100644 --- a/src/main/java/net/fabricmc/loom/task/service/SourceRemapperService.java +++ b/src/main/java/net/fabricmc/loom/task/service/SourceRemapperService.java @@ -1,7 +1,7 @@ /* * This file is part of fabric-loom, licensed under the MIT License (MIT). * - * Copyright (c) 2021 FabricMC + * Copyright (c) 2021-2022 FabricMC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory; import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.task.RemapSourcesJarTask; +import net.fabricmc.loom.util.Constants; import net.fabricmc.loom.util.DeletingFileVisitor; import net.fabricmc.loom.util.FileSystemUtil; import net.fabricmc.loom.util.SourceRemapper; @@ -122,6 +123,7 @@ public final class SourceRemapperService implements SharedService { private Mercury createMercury() { var mercury = new Mercury(); mercury.setGracefulClasspathChecks(true); + mercury.setSourceCompatibility(Constants.MERCURY_SOURCE_VERSION); try { mercury.getProcessors().add(MercuryRemapper.create(getMappings())); diff --git a/src/main/java/net/fabricmc/loom/util/Constants.java b/src/main/java/net/fabricmc/loom/util/Constants.java index 1355279d..b01c8c58 100644 --- a/src/main/java/net/fabricmc/loom/util/Constants.java +++ b/src/main/java/net/fabricmc/loom/util/Constants.java @@ -27,6 +27,7 @@ package net.fabricmc.loom.util; import java.util.List; import com.google.common.collect.ImmutableList; +import org.eclipse.jdt.core.JavaCore; import org.gradle.api.plugins.JavaPlugin; import org.objectweb.asm.Opcodes; @@ -41,6 +42,7 @@ public class Constants { public static final String FABRIC_REPOSITORY = "https://maven.fabricmc.net/"; public static final int ASM_VERSION = Opcodes.ASM9; + public static final String MERCURY_SOURCE_VERSION = JavaCore.VERSION_17; public static final List MOD_COMPILE_ENTRIES = ImmutableList.of( new RemappedConfigurationEntry("modApi", JavaPlugin.API_CONFIGURATION_NAME, true, true, PublishingMode.COMPILE_AND_RUNTIME), diff --git a/src/main/java/net/fabricmc/loom/util/SourceRemapper.java b/src/main/java/net/fabricmc/loom/util/SourceRemapper.java index 64261ea8..3f4f3c51 100644 --- a/src/main/java/net/fabricmc/loom/util/SourceRemapper.java +++ b/src/main/java/net/fabricmc/loom/util/SourceRemapper.java @@ -1,7 +1,7 @@ /* * This file is part of fabric-loom, licensed under the MIT License (MIT). * - * Copyright (c) 2018-2021 FabricMC + * Copyright (c) 2018-2022 FabricMC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -225,6 +225,7 @@ public class SourceRemapper { public static Mercury createMercuryWithClassPath(Project project, boolean toNamed) { Mercury m = new Mercury(); m.setGracefulClasspathChecks(true); + m.setSourceCompatibility(Constants.MERCURY_SOURCE_VERSION); for (File file : project.getConfigurations().getByName(Constants.Configurations.LOADER_DEPENDENCIES).getFiles()) { m.getClassPath().add(file.toPath());