eclipse-equinox / p2

Eclipse Public License 2.0
15 stars 41 forks source link

Add a new optional parameter to SetJvmAction so the JVM is only changed if the current value matches the value of that new parameter #127

Open kevloral opened 2 years ago

kevloral commented 2 years ago

When uninstalling the embedded JRE, the JVM is always set to null, no matter whether the user has previously modified by hand the -vm parameter in the eclipse.ini file or not. I propose adding a new optional parameter to the SetJvmAction that could be called if, ifValue or onlyIf, so that the JVM would only be changed when the current JVM value matches the value of that new parameter.

Let's see an example. The embedded JRE currently declares the following actions in its p2.inf advice file:

instructions.install = \
  org.eclipse.equinox.p2.touchpoint.eclipse.setJvm(jvm:${artifact.location}/jre/bin);

instructions.uninstall = \
  org.eclipse.equinox.p2.touchpoint.eclipse.setJvm(jvm:null);

Assuming the new optional parameter were called if, something like this would mean that, when uninstalling the JRE, the JVM will only be set to null if its value matches the one that was assigned to it when installing the JRE:

instructions.install = \
  org.eclipse.equinox.p2.touchpoint.eclipse.setJvm(jvm:${artifact.location}/jre/bin);

instructions.uninstall = \
  org.eclipse.equinox.p2.touchpoint.eclipse.setJvm(jvm:null,if:${artifact.location}/jre/bin);

The new parameter would be optional. Its absence would mean that the action would behave as it currently does.

mickaelistria commented 2 years ago

contributions welcome!