Skip to content

Conversation

@SiboVG
Copy link
Member

@SiboVG SiboVG commented Feb 14, 2025

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 the CDOverride.jar plugin, a new file is created CDOverride-migrate-new.jar. The ASM library is then used to modify the byte-code if the XX-migrate-new.jar to migrate references from net.sf.openrocket to info.openrocket.core/swing. Finally, when the UI loaded in SwingStartup, it checks if there are any XX-migrated-new.jar files present in the Plugins directory. If so, it notifies the user and renames the JAR file from XX-migrated-new.jar to XX-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.

image

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).
image

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).

@JoePfeiffer
Copy link
Contributor

Wow. Going in and editing the jar never would have occurred to me!

@SiboVG
Copy link
Member Author

SiboVG commented Feb 16, 2025

Wow. Going in and editing the jar never would have occurred to me!

I tried other ways (e.g. mirroring the code to a net.sf.openrocket package), but they all failed or were inelegant. This works well for the 2 plugins I tested.

@JoePfeiffer JoePfeiffer merged commit 3af012c into openrocket:unstable Feb 16, 2025
1 check passed
@SiboVG SiboVG deleted the issue-2676 branch February 16, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Create interface code for plugins/scripts that use the old net.sf.openrocket package

2 participants