[#2676] Migrate old net.sf.openrocket plugins at startup #2719
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 fixes #2676. When OR scans the Plugins directory at startup, it checks if the JAR uses the old package structure (
net.sf.openrocket). If it does, and it does not find a migrated version of that JAR, it starts the migration process. The migration process involves creating a copy of the JAR file with suffix-migrated-new. E.g. for theCDOverride.jarplugin, a new file is createdCDOverride-migrate-new.jar. The ASM library is then used to modify the byte-code if theXX-migrate-new.jarto migrate references fromnet.sf.openrockettoinfo.openrocket.core/swing. Finally, when the UI loaded inSwingStartup, it checks if there are anyXX-migrated-new.jarfiles present in the Plugins directory. If so, it notifies the user and renames the JAR file fromXX-migrated-new.jartoXX-migrated.jar. I had to use this workaround because I can not yet use Swing components while loading the Plugins at startup because for some reason this messes with the Guice injections.In the end, you are left with both the original JAR (so it works with older installed versions of OR) and the migrated JAR (compatible with OR 24.12).

I also added some backward compatibility code for the popular MultiLevelWind plugin (which is now built-in in OpenRocket, but users will still have the plugin loaded in their old designs).