Migrate from Kryo to Json for project files #208
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will switch Mundus over to storing the .registry and project .pro files in JSON format, using libGDX's json library.
JsonIOManager replaces KryoManager. I added MigrationIOManager class which is used for Dependency Injection going forward. On registry load it checks if registry is a kryo file, if so, it backs it up, then migrates it to JSON then loads the registry as JSON.
On Project Load, if the .pro file appears to be a kryo file, also backs it up then migrates that .pro file to JSON.
Several reasons for this decision:
Issue Build issues on newer JDK's (workaround available) #170 because we use TaggedFieldSerializer in Kryo, any JDK above 1.8 causes an exception. While a workaround is available I have had atleast 3-4 people contact me on discord having this issue and not knowing how to resolve it. This is concerning as it discourages new users of Mundus right off the bat and requiring them to add jvm workarounds if using a JDK > 1.8 is not a good long term fix.
Using Kryo makes these files more dangerous to modify (personal opinion). For example, this warning here:
Mundus/editor/src/main/com/mbrlabs/mundus/editor/core/kryo/KryoManager.java
Line 57 in f21643a
It is now easy to view the contents of these files, and edit them if for some reason they become corrupted which cannot be done with Kryo.
The .registry files and .pro don't hold much information, so the file size increase is trivial
For the time being KryoManager and the MigrationIOManager will stay in the repo to support backward compatibility. Ideally at some future date, they can be removed.