-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port to mapping-io (Glitch's Version) (#432)
* Port to mapping-io (Glitch's Version) This is step 0 in adding the ability for Loader to use alternative intermediates for mods, or use something like mojmaps at runtime. This commit migrates the pre-existing MappingConfiguration to use mapping-io, but doesn't do much to actually refactor Loader to take advantage of mapping-io's strengths. This PR moves a few dependencies to be shadowed that Floader moved as well. Tiny Remapper was required to be moved to work with mapping-io, tiny mapping parser was removed by upstream, and I just decided to bring AccessWidener in line with upstream as well. (PS: I know QMT exists-ish, but it's not finished and I want to work on a modloader, not a mappings parser. When and if QMT is finished, we can evaluate migrating to it, but the potential to use a first-party library later shouldn't prevent us from improving Loader today) * Fix "duplicate class" spam from Tiny Remapper in RuntimeModRemapper TR eagerly opens nested ZIP files and flattens them, and this slightly bizarre behavior causes lots of issues when trying to remap mods that include JiJ candidates. To mitigate this, we create a read-only view of *only* the `.class` files. This has minimal memory impact as the FS is copy-on-write, so it is just a big map of file paths. * Update actions for Java 21 * Update actions for Java 21 take 2 * Mount instead of CoW * Remove Proguard Proguard is magically adding SequencedCollection to the LVT of MemoryMappingTree.accept in mapping-io. We couldn't find a minimal reproduction, so we're just going to move away from it for now. * Fix mods that need remapping, but don't contain any class files, causing the remapper to crash because the mod directory didn't exist. Also comment out the DedicatedServerOnly annotation on TestMixinGuiHelper, because we're not testing package-stripping annotations any more. This allows us to run the test mod. * Mount temporary files as READ_ONLY --------- Co-authored-by: AlexIIL <[email protected]> Co-authored-by: AlexIIL <[email protected]>
- Loading branch information
1 parent
3379b2e
commit fe82575
Showing
33 changed files
with
572 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
...ecraft-test/src/main/java/net/fabricmc/minecraft/test/server_only/TestMixinGuiHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
minecraft/minecraft-test/src/test/java/MappingResolverTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright 2016 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertIterableEquals; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.quiltmc.loader.api.MappingResolver; | ||
import org.quiltmc.loader.api.QuiltLoader; | ||
|
||
|
||
public class MappingResolverTest { | ||
final MappingResolver mappingResolver = QuiltLoader.getMappingResolver(); | ||
|
||
@Test | ||
void getNamespaces() { | ||
assertIterableEquals(List.of( "official", "intermediary", "named"), mappingResolver.getNamespaces()); | ||
} | ||
|
||
@Test | ||
void getCurrentRuntimeNamespace() { | ||
assertEquals("named", mappingResolver.getCurrentRuntimeNamespace()); | ||
} | ||
|
||
@Test | ||
void mapClassName() { | ||
assertEquals("net.minecraft.client.MinecraftClient", mappingResolver.mapClassName("intermediary", "net.minecraft.class_310")); | ||
assertEquals("net.minecraft.client.MinecraftClient$ChatRestriction", mappingResolver.mapClassName("intermediary", "net.minecraft.class_310$class_5859")); | ||
assertEquals("net.minecraft.Unknown", mappingResolver.mapClassName("intermediary", "net.minecraft.Unknown")); | ||
} | ||
|
||
@Test | ||
void unmapClassName() { | ||
assertEquals("net.minecraft.class_6327", mappingResolver.unmapClassName("intermediary", "net.minecraft.server.command.DebugPathCommand")); | ||
} | ||
|
||
@Test | ||
void mapFieldName() { | ||
assertEquals("world", mappingResolver.mapFieldName("intermediary", "net.minecraft.class_2586", "field_11863", "Lnet/minecraft/class_1937;")); | ||
} | ||
|
||
@Test | ||
void mapMethodName() { | ||
assertEquals("getWorld", mappingResolver.mapMethodName("intermediary", "net.minecraft.class_2586", "method_10997", "()Lnet/minecraft/class_1937;")); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
src/fabric/legacy/java/net/fabricmc/loader/launch/common/MappingConfiguration.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.