Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fabricmc/mapping-io
Mapping-IO is a small and efficient library for working with deobfuscation mapping files.
https://github.com/fabricmc/mapping-io
Last synced: 3 months ago
JSON representation
Mapping-IO is a small and efficient library for working with deobfuscation mapping files.
- Host: GitHub
- URL: https://github.com/fabricmc/mapping-io
- Owner: FabricMC
- License: apache-2.0
- Created: 2021-06-08T20:13:59.000Z (over 3 years ago)
- Default Branch: dev
- Last Pushed: 2024-09-09T20:05:13.000Z (3 months ago)
- Last Synced: 2024-10-07T10:46:52.925Z (3 months ago)
- Language: Java
- Homepage:
- Size: 521 KB
- Stars: 41
- Watchers: 6
- Forks: 18
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Mapping-IO
Mapping-IO is a small and efficient library for working with deobfuscation mapping files. It has readers and writers for [numerous formats](./src/main/java/net/fabricmc/mappingio/format/MappingFormat.java), and provides extensive mapping manipulation facilities.The API is inspired by ObjectWeb's [ASM](https://asm.ow2.io/): At its core, Mapping-IO is [visitor-based](./src/main/java/net/fabricmc/mappingio/MappingVisitor.java), but it also provides a [tree API](./src/main/java/net/fabricmc/mappingio/tree/) for in-memory storage and easier data manipulation.
Utilities for more sophisticated use cases can be found in the [mapping-io-extras](./mapping-io-extras/) module; they've been moved out from the core publication due to their additional dependencies.
## Usage
Reading and writing can be easily achieved via the [`MappingReader`](./src/main/java/net/fabricmc/mappingio/MappingReader.java) and [`MappingWriter`](./src/main/java/net/fabricmc/mappingio/MappingWriter.java) interfaces:
```java
MappingReader.read(inputPath, /* optional */ inputFormat,
MappingWriter.create(outputPath, outputFormat));
```The above example reads mappings from the input path directly into a `MappingWriter`, writing all contents to disk in the specified format.
Keep in mind that the conversion process might be lossy if the two formats' feature sets differ; see the comparison table [here](https://fabricmc.net/wiki/documentation:mapping_formats) for more details.You can also read into a tree first:
```java
VisitableMappingTree tree = new MemoryMappingTree();MappingReader.read(inputPath, inputFormat, tree);
tree.accept(MappingWriter.create(outputPath, outputFormat));
```If the input format is known beforehand and more direct control over specific reading parameters is desired, the formats' readers (or writers) may also be invoked directly.
Mapping manipulation is achieved either via the tree API or specialized `MappingVisitor`s, hand-crafted or utilizing first-party ones found in the [adapter](./src/main/java/net/fabricmc/mappingio/adapter/) package.
For further information, please consult the project's Javadocs.
### Maven
Mapping-IO is available from the [FabricMC Maven](https://maven.fabricmc.net/net/fabricmc/mapping-io), version 0.4.2 and onwards can also be found on Maven Central.Gradle snippet:
```gradle
repositories {
mavenCentral()
}dependencies {
api 'net.fabricmc:mapping-io:${mappingio_version}'
}
```