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

Lorenz 0.6.0 #47

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open

Lorenz 0.6.0 #47

wants to merge 64 commits into from

Conversation

jamierocks
Copy link
Member

@jamierocks jamierocks commented Nov 21, 2020

Groovy DSL

Lorenz now has a Groovy DSL, that simplifies the creation of mappings.

def EXTRA = new ExtensionKey(String, 'extra')

def mappings = MappingSetDsl.create {
    klass('a') {
        deobf = 'Demo'
        extension EXTRA, 'demo data'
        
        field('g') { deobf = 'name' }
        
        method('h', '(Z)Ljava/lang/String;') {
            deobf = 'getName'
            
            param(0) { deobf = 'example' }
        }
    }
}

To use the Groovy DSL, simply add org.cadixdev:lorenz-dsl-groovy:0.6.0 to your build
tool.

ASM Module

Inline with changes made in Bombe 0.4.0, the ASM package is no more - with both classes
now available under the same package in the core Lorenz module.

Enigma Module

The Enigma mapping format no longer erroneously reports the standard file extension as
being "enigma", but rather the standard (as set by cuchaz's mapping project, and continued
by the Fabric Project) "mapping". The former file extension is included as a supported file
extension with the new multiple file extension functionality (detailed below).

Additionally, we now have support for reading/writing Fabric's fork of the format (which
merely differs by usage of the none/ prefix) - registered as fabric-engima.

Mapping Formats

Registration

Mapping Formats are still registered by use of service loaders, populating a registry in
MappingFormats - however their registration key (identifier) is now more explicit, and
formats are able to provide a name. Implementations must now provide the following:

  • Name (can be used by tools such as Symphony)
  • Identifier (used as the registration key)

File extensions

Mapping Formats can now specify multiple file extensions that are typical, this will allow
tools such as Symphony and Nocturne to give richer (and more useful) file choice dialogs.

Miscellaneous

  • Mapping formats can now specify whether they support reading and writing. This will allow
    tools, for example, to only show supported formats in a file save or file read dialog.

Conveniences

  • Mapping#set(key, value) now returns the Mapping allowing for fluent method calls.
  • The de-obfuscated names of Mappings are now observable, through
    Mapping#addListener(MappingChangedListener).

jamierocks and others added 30 commits October 27, 2018 15:20
Fabric don't have 'none/' in their mappings.
I want to get our repositories in shape, to accept contributions
during Hacktoberfest - though this should have been included here
a long time ago...
Signed-off-by: Jamie Mansfield <[email protected]>
Closes GH-27.

Signed-off-by: Jamie Mansfield <[email protected]>
Signed-off-by: Jamie Mansfield <[email protected]>
This will prevent any collision with another JSON implementation, if 2 need to be
in the environment for some reason.

Signed-off-by: Jamie Mansfield <[email protected]>
This isn't needed and will cause issues if the output is longer than the buffer
can handle.

Signed-off-by: Jadon Fowler <[email protected]>
for reversing and merging.

Fixes GH-34.

Co-authored-by: Jamie Mansfield <[email protected]>
In both InnerClassMapping and TopLevelClassMapping the merge methods are
implemented by looping over the members of the left side and merging
the value with the members on the right side. This properly handles both
new mappings provided by the left side, and mappings provided by both
sides. The only part it leaves out is new mappings provided by the right
side.

This commit accomplishes this by keeping track of the mappings which
have already been seen with HashSets during the iteration over the left
members, and then only applying new mappings from the right by iterating
over the right side and ignoring mappings we've already seen.

Since this commit now uses the hashCode methods, I also found a
recursive hashCode bug due to members trying to get the hashCode of
classes which contain said member. I fixed this by instead just hashing
the parent's names.
@jamierocks jamierocks added this to the 0.6.0 milestone Nov 21, 2020
jamierocks and others added 28 commits November 27, 2020 20:34
Currently the Enigma module is the only mapping format to make use
of this new API.

I have also corrected the standard file extension reported by the
Enigma mapping format - to "mapping".
I have ported those tests to Spock/Groovy, and they now perform
the copy/reverse operation directly on the class/field/method/etc.
This means that we don't need to perform all the tests in one
horrible chunk of code.
Theres a few things I've identified that need to be looked into:
 - Generic bounds in both the mapping model and Groovy DSL
 - Removing usage of the Groovy DSL in the standard Lorenz tests
 - Splitting up the Groovy DSL unit test
This isn't a complete test, field mapping handling should be added,
members that are private/protected/etc should be tested, and tests
to handle b4cb5bf should be added.
Kashike told me a while back this was no longer needed.
This was (to my knowledge) only used by Survey - but was a non-standard
mapping format, its place isn't in Lorenz in any case.
Though we may decide to change this somewhat in the future, this is a
good step to clean up the ever-growing directory listing.

With the commit, changelogs for published versions reside in
'changelogs/x.y/x.y.z.md'. Currently work-in-progress versions still
sit within `changelogs` - this is just to promote the approriate and
current changelog.
This should make it easier to support the rest of Fabric's changes.
In short, they don't write out the fully-qualified class name - just
the class' name. In practise, this just affects inner classes.
In short, they don't write out the fully-qualified class name - just
the class' name. In practise, this just affects inner classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants