Skip to content
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

Migrate to mapping io #812

Merged
merged 13 commits into from
Nov 15, 2023
Merged

Migrate to mapping io #812

merged 13 commits into from
Nov 15, 2023

Conversation

modmuss50
Copy link
Member

@modmuss50 modmuss50 commented May 28, 2023

This fully removes TMP from the classpath and the long deprecated/internal MappingConfiguration.getMappings() API. Does this break any mods? If so how many. Either way this should be a 0.15.x change.

The mapping tree is lazily loaded, in prod with no mods the mappings are never loaded after the first launch.

Mapping IO is repackaged and bundled within the jar, mods are not expected to make use of this.

@modmuss50 modmuss50 requested review from sfPlayer1 and a team May 28, 2023 15:12
@thecatcore
Copy link
Contributor

👍, I have one of my mod, Mod Remapping API, which uses the deprecated api. Having some hook to help getting runtime mappings in one way or another would be enough in my case I think 🤔.
I should probably try to move my mod away from loader internals...

@modmuss50
Copy link
Member Author

I have one of my mod, Mod Remapping API

You appear to also be using a lot of loader internals way beyond the old API that this PR removes, thus is likely to break anyway. We cannot and do not spend time to support these kinds of mods.

I dont think we want to expose an API for getting the ful set of mappings, for 99% of usecases the MappingResolver API should be enough. There are some future changes we wish to make that would make anything beyond the already exposed API hard to maintain.

If its not you should be bundling (and repackaging, or mabe JIJ?) mapping-io and your own mappings. (Or assume they will be on the classpath)

@thecatcore
Copy link
Contributor

I've followed your advice and moved my mod await from those deprecated apis and I am now shadowing mappingsio under a different package to avoid potential conflicts.

@modmuss50
Copy link
Member Author

Note to future self: Ensure that the mappings are lazily loaded only when and as required.

acceptor.acceptClass(className, dstName);

for (MappingTree.FieldMapping field : classDef.getFields()) {
acceptor.acceptField(memberOf(className, field.getName(fromId), field.getDesc(fromId)), field.getName(toId));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will field.getName(toId) return null and break stuff? Same question for method.getName(toId) below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the code used in loom, its possible it could do just not sure if it will in practice?

@modmuss50
Copy link
Member Author

I have updated this PR to also lazily load the mappings, in prod (after the first launch) with no mods the mappings are not loaded into memory at all.

@modmuss50
Copy link
Member Author

This is still ready to release, due to the possibility of breaking mods that use TMP (Was never part of the API but still) we are going to contiune to hold onto this until a major release.

@modmuss50 modmuss50 linked an issue Oct 3, 2023 that may be closed by this pull request
protected final int fromId;
protected final int toId;

public MixinRemapper(MappingTree mappings, int fromId, int toId) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be nice to move this to Mixin, and take an asm Remapper. MIO could then have an API to create a Remapper from a MappingTree.

@modmuss50 modmuss50 changed the base branch from master to dev/0.15 November 12, 2023 17:23
@modmuss50
Copy link
Member Author

Updated to mapping-io 0.5.0 :)

# Conflicts:
#	build.gradle
#	src/main/resources/fabric-installer.json
#	src/main/resources/fabric-installer.launchwrapper.json
@modmuss50
Copy link
Member Author

I have vastly improved the memory usage over the old TMP code :) In prod its now unlikely that the mappings will ever be read.

@modmuss50 modmuss50 merged commit 58eac54 into FabricMC:dev/0.15 Nov 15, 2023
5 checks passed
lovexyn0827 added a commit to lovexyn0827/MessMod that referenced this pull request Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Nullable annotations to fabric loader
4 participants