Update to Mapping-IO 0.7.0 & Tiny Remapper 0.11 (#1245)

* Update to Mapping-IO 0.7.0

* Update to Mapping-IO 0.7.1

* Revert changes

* Update tiny remapper

* Fix invalid tiny v2 header.
This commit is contained in:
modmuss
2025-01-26 14:02:16 +00:00
committed by GitHub
parent cb8ba8fe1d
commit 9bcce94d5a
8 changed files with 69 additions and 8 deletions

View File

@@ -6,9 +6,9 @@ gson = "2.10.1"
guava = "33.0.0-jre"
stitch = "0.6.2"
tiny-remapper = "0.10.4"
tiny-remapper = "0.11.0"
access-widener = "2.1.0"
mapping-io = "0.6.1"
mapping-io = "0.7.1"
lorenz-tiny = "4.0.2"
mercury = "0.4.2"
loom-native = "0.2.0"

View File

@@ -55,6 +55,7 @@ import net.fabricmc.loom.extension.RemapperExtensionHolder;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.Pair;
import net.fabricmc.loom.util.TinyRemapperHelper;
import net.fabricmc.loom.util.TinyRemapperLoggerAdapter;
import net.fabricmc.loom.util.ZipUtils;
import net.fabricmc.loom.util.kotlin.KotlinClasspathService;
import net.fabricmc.loom.util.kotlin.KotlinRemapperClassloader;
@@ -139,7 +140,7 @@ public class ModProcessor {
knownIndyBsms.addAll(modDependency.getMetadata().knownIdyBsms());
}
TinyRemapper.Builder builder = TinyRemapper.newRemapper()
TinyRemapper.Builder builder = TinyRemapper.newRemapper(TinyRemapperLoggerAdapter.INSTANCE)
.withKnownIndyBsm(knownIndyBsms)
.withMappings(TinyRemapperHelper.create(mappingConfiguration.getMappingsService(project, serviceFactory).getMappingTree(), fromM, toM, false))
.renameInvalidLocals(false)

View File

@@ -38,7 +38,7 @@ import net.fabricmc.loom.api.mappings.intermediate.IntermediateMappingsProvider;
*/
public abstract class NoOpIntermediateMappingsProvider extends IntermediateMappingsProvider {
private static final String HEADER_OFFICIAL_MERGED = "tiny\t2\t0\tofficial\tintermediary";
private static final String HEADER_OFFICIAL_LEGACY_MERGED = "tiny\t2\t0\tintermediary\tclientOfficial\tserverOfficial\t";
private static final String HEADER_OFFICIAL_LEGACY_MERGED = "tiny\t2\t0\tintermediary\tclientOfficial\tserverOfficial";
@Override
public void provide(Path tinyMappings) throws IOException {

View File

@@ -32,6 +32,7 @@ import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
import net.fabricmc.loom.configuration.ConfigContext;
import net.fabricmc.loom.configuration.providers.BundleMetadata;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.TinyRemapperLoggerAdapter;
import net.fabricmc.tinyremapper.NonClassCopyMode;
import net.fabricmc.tinyremapper.OutputConsumerPath;
import net.fabricmc.tinyremapper.TinyRemapper;
@@ -94,7 +95,7 @@ public abstract sealed class SingleJarMinecraftProvider extends MinecraftProvide
TinyRemapper remapper = null;
try {
remapper = TinyRemapper.newRemapper().build();
remapper = TinyRemapper.newRemapper(TinyRemapperLoggerAdapter.INSTANCE).build();
Files.deleteIfExists(minecraftEnvOnlyJar);

View File

@@ -46,6 +46,7 @@ import net.fabricmc.accesswidener.AccessWidenerReader;
import net.fabricmc.accesswidener.AccessWidenerVisitor;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
import net.fabricmc.loom.util.TinyRemapperLoggerAdapter;
import net.fabricmc.tinyremapper.TinyRemapper;
import net.fabricmc.tinyremapper.api.TrEnvironment;
@@ -70,7 +71,7 @@ public abstract class ValidateAccessWidenerTask extends DefaultTask {
@TaskAction
public void run() {
final TinyRemapper tinyRemapper = TinyRemapper.newRemapper().build();
final TinyRemapper tinyRemapper = TinyRemapper.newRemapper(TinyRemapperLoggerAdapter.INSTANCE).build();
for (File file : getTargetJars().getFiles()) {
tinyRemapper.readClassPath(file.toPath());

View File

@@ -54,6 +54,7 @@ import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.extension.RemapperExtensionHolder;
import net.fabricmc.loom.task.AbstractRemapJarTask;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.TinyRemapperLoggerAdapter;
import net.fabricmc.loom.util.kotlin.KotlinClasspathService;
import net.fabricmc.loom.util.kotlin.KotlinRemapperClassloader;
import net.fabricmc.loom.util.service.Service;
@@ -130,7 +131,7 @@ public class TinyRemapperService extends Service<TinyRemapperService.Options> im
}
private TinyRemapper createTinyRemapper() {
TinyRemapper.Builder builder = TinyRemapper.newRemapper()
TinyRemapper.Builder builder = TinyRemapper.newRemapper(TinyRemapperLoggerAdapter.INSTANCE)
.withKnownIndyBsm(Set.copyOf(getOptions().getKnownIndyBsms().get()));
for (MappingsService.Options options : getOptions().getMappings().get()) {

View File

@@ -74,7 +74,7 @@ public final class TinyRemapperHelper {
int intermediaryNsId = mappingTree.getNamespaceId(MappingsNamespace.INTERMEDIARY.toString());
TinyRemapper.Builder builder = TinyRemapper.newRemapper()
TinyRemapper.Builder builder = TinyRemapper.newRemapper(TinyRemapperLoggerAdapter.INSTANCE)
.withMappings(create(mappingTree, fromM, toM, true))
.withMappings(out -> JSR_TO_JETBRAINS.forEach(out::acceptClass))
.renameInvalidLocals(true)

View File

@@ -0,0 +1,57 @@
/*
* This file is part of fabric-loom, licensed under the MIT License (MIT).
*
* Copyright (c) 2025 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.fabricmc.loom.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.fabricmc.tinyremapper.api.TrLogger;
public final class TinyRemapperLoggerAdapter implements TrLogger {
public static final TinyRemapperLoggerAdapter INSTANCE = new TinyRemapperLoggerAdapter();
private static final Logger LOGGER = LoggerFactory.getLogger("TinyRemapper");
private TinyRemapperLoggerAdapter() {
}
@Override
public void log(Level level, String message) {
switch (level) {
case ERROR:
LOGGER.error(message);
break;
case WARN:
LOGGER.warn(message);
break;
case INFO:
LOGGER.info(message);
break;
case DEBUG:
LOGGER.debug(message);
break;
}
}
}