-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output to hashed mappings #14
base: main
Are you sure you want to change the base?
Conversation
Includes merging intermediary and hashed into one main mappings tree so that dependencies can be remapped when required.
|
||
void setIntermediaryMinecraftProvider(IntermediaryMinecraftProvider<?> intermediaryMinecraftProvider); | ||
|
||
+ void setHashedMinecraftProvider(HashedMinecraftProvider<?> hashedinecraftProvider); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo of Minecraft
in the parameter name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx lol
+ /** | ||
+ * Hashed mappings are a hashed version of the raw official mappings. | ||
+ * | ||
+ * @see <a href="https://github.com/QuiltMC/mappings-hasher/">github.com/QuiltMC/mappings-hasher/</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ * @see <a href="https://github.com/QuiltMC/mappings-hasher/">github.com/QuiltMC/mappings-hasher/</a> | |
+ * @see <a href="https://github.com/QuiltMC/rfcs/blob/master/specification/0041-hashed-mappings-specification.md</a> |
+ private TinyRemapper createTinyRemapper(MappingsNamespace intermediateMappings) { | ||
try { | ||
- TinyRemapper tinyRemapper = TinyRemapperHelper.getTinyRemapper(project, "intermediary", "named"); | ||
+ TinyRemapper tinyRemapper = TinyRemapperHelper.getTinyRemapper(project, "hashed", "named"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the namespace depend on which intermediateMappings you provided in the argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, I might have left that in from debugging
return false; | ||
} | ||
|
||
- if (!MappingsNamespace.INTERMEDIARY.toString().equals(mappings.getSrcNamespace())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this break depending on mods with transitive AWs in Intermediary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mapping tree passed is just the normal loom mapping provider but with the source namespace switched to hashed, it's not the namespace of the transitive AW.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait you might be right actually, I'll have to do a little more digging.
- for (Path minecraftJar : extension.getMinecraftJars(MappingsNamespace.INTERMEDIARY)) { | ||
- remapper.readClassPathAsync(minecraftJar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you never fill the intermediary remapper's classpath?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, there was a reason I did this but I don't remember it, you're right it would probably make more sense to populate the remapper's classpath.
+ // Hashed is always the base layer | ||
+ builtLayers.add(new HashedMappingsSpec()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is okay as long as we're able to layer Intermediary on top of Hashed, for e.g. Quilted Fabric API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would intermediary get layered on top of hashed? All the dependencies get remapped to named for dev and hashed in loader and intermediary is merged into the mapping tree regardless
+import net.fabricmc.loom.util.SidedClassVisitor; | ||
+import net.fabricmc.tinyremapper.TinyRemapper; | ||
+ | ||
+public abstract sealed class HashedMinecraftProvider<M extends MinecraftProvider> extends AbstractMappedMinecraftProvider<M> permits HashedMinecraftProvider.MergedImpl, HashedMinecraftProvider.SingleJarImpl, HashedMinecraftProvider.SplitImpl { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in this case what you should do instead is modify the Intermediary minecraft provider to be extendable by hashed, and then only override the methods you actually have to change, since i believe most of this class is duplicated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be smarter yes lol, I'll do that now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't know if this is worth all the changes it would take, it would be hard to make this work with the mess of generics that is MinecraftJarConfiguration
.
+ | ||
+ if (mappings.equals("net.fabricmc:intermediary")) return MappingsNamespace.INTERMEDIARY; | ||
+ | ||
+ return MappingsNamespace.HASHED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is unsound; it will assume any "intermediate_mappings" value besides fabric intermediary is hashed, but with loader plugins we can't promise that's the case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, I did this so it would fall back to hashed. I can instead have it explicitly check for hashed or an empty value (implicitly hashed) and have it throw an exception if the value's unknown if that's preferred.
This is what I get for messing with branch names lol. |
This pr adds support for hashed mappings within loom. Mods will now, by default, output with hashed mappings instead of intermediary. Additionally, all dependencies will be able to be remapped from either hashed or intermediary to named when in a dev environment.
This probably shouldn't be merged until loader has hashed support. Also, QuiltMC/sponge-mixin-compile-extensions#1 has to be merged and published on the maven for mixins to get remapped correctly.