mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-30 05:05:20 -05:00
Filter unknown invokedynamic bsm
This commit is contained in:
@@ -33,6 +33,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.fabricmc.loom.util.*;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.file.RegularFileProperty;
|
||||
import org.gradle.api.provider.Property;
|
||||
@@ -44,12 +45,7 @@ import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
import net.fabricmc.loom.providers.MappingsProvider;
|
||||
import net.fabricmc.loom.util.GradleSupport;
|
||||
import net.fabricmc.loom.util.MixinRefmapHelper;
|
||||
import net.fabricmc.loom.util.NestedJars;
|
||||
import net.fabricmc.loom.util.TinyRemapperMappingsHelper;
|
||||
import net.fabricmc.loom.util.accesswidener.AccessWidenerJarProcessor;
|
||||
import net.fabricmc.loom.util.JarRemapper;
|
||||
import net.fabricmc.stitch.util.Pair;
|
||||
import net.fabricmc.tinyremapper.OutputConsumerPath;
|
||||
import net.fabricmc.tinyremapper.TinyRemapper;
|
||||
@@ -104,7 +100,8 @@ public class RemapJarTask extends Jar {
|
||||
project.getConfigurations().getByName("compileClasspath").getFiles()
|
||||
);
|
||||
Path[] classpath = classpathFiles.stream().map(File::toPath).filter((p) -> !input.equals(p) && Files.exists(p)).toArray(Path[]::new);
|
||||
|
||||
|
||||
LoggerFilter.replaceSystemOut();
|
||||
TinyRemapper.Builder remapperBuilder = TinyRemapper.newRemapper();
|
||||
|
||||
remapperBuilder = remapperBuilder.withMappings(TinyRemapperMappingsHelper.create(extension.isForge() ? mappingsProvider.getMappingsWithSrg() : mappingsProvider.getMappings(), fromM, toM, false));
|
||||
|
||||
@@ -62,6 +62,7 @@ public class JarRemapper {
|
||||
}
|
||||
|
||||
public void remap() throws IOException {
|
||||
LoggerFilter.replaceSystemOut();
|
||||
TinyRemapper.Builder remapperBuilder = TinyRemapper.newRemapper();
|
||||
mappingProviders.forEach(remapperBuilder::withMappings);
|
||||
|
||||
|
||||
47
src/main/java/net/fabricmc/loom/util/LoggerFilter.java
Normal file
47
src/main/java/net/fabricmc/loom/util/LoggerFilter.java
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2016, 2017, 2018 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.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class LoggerFilter {
|
||||
public static void replaceSystemOut() {
|
||||
try {
|
||||
PrintStream previous = System.out;
|
||||
System.setOut(new PrintStream(previous) {
|
||||
@Override
|
||||
public PrintStream printf(@NotNull String format, Object... args) {
|
||||
if (format.equals("unknown invokedynamic bsm: %s/%s%s (tag=%d iif=%b)%n")) {
|
||||
return this;
|
||||
}
|
||||
return super.printf(format, args);
|
||||
}
|
||||
});
|
||||
} catch (SecurityException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,6 +146,7 @@ public class ModProcessor {
|
||||
project.getLogger().lifecycle(":remapping " + remapList.size() + " mods (TinyRemapper, " + fromM + " -> " + toM + ")");
|
||||
|
||||
TinyTree mappings = extension.isForge() ? mappingsProvider.getMappingsWithSrg() : mappingsProvider.getMappings();
|
||||
LoggerFilter.replaceSystemOut();
|
||||
TinyRemapper remapper = TinyRemapper.newRemapper()
|
||||
.withMappings(TinyRemapperMappingsHelper.create(mappings, fromM, toM, false))
|
||||
.renameInvalidLocals(false)
|
||||
|
||||
Reference in New Issue
Block a user