Adding absolute agent path to jvm arg [message #488082] |
Fri, 25 September 2009 14:13 |
Nicolas Mising name Messages: 3 Registered: September 2009 |
Junior Member |
|
|
Hello there,
I am writing an eclipse plugin which need an agent to be attached to the eclipse launching JVM.
Manually, I just add the following jvmarg line in the eclipse.ini:
-agentpath:/home/user/eclipse/plugins/myplugin_version/libag ent.so
That is working perfectly, but need the user to perform a manual task after installing my plugin.
I would like to automate this line adding procedure using p2.
I found some documentation about the addJvmArg p2.inf directive.
So, in my plugin META-INF folder, I wrote a p2.inf that looks like this:
instructions.install = \
addJvmArg(jvmArg:-agentpath:@artifact/libagent.so);
instructions.install.import= \
org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg,
Then, generating the metadata, I can found this part of generated code in content.xml:
<instruction key='install' import='org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg,'>
addJvmArg(jvmArg:-agentpath:@artifact/libagent.so);
</instruction>
In a fresh eclipse install, I install my plugin, using the previous content.xml as metadata, then looks in the resulting eclipse.ini.
-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms40m
-Xmx256m
-agentpath:@artifact/libagent.so
The @artifact is not replaced by path of artifact
I have seen the bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=273480 that seems to looks like this, but has been workarounded.
Is someone has already done this kind of p2 custom?
Any idea to do this agent attach task?
Thanks for your p2 lights
|
|
|
Re: Adding absolute agent path to jvm arg [message #488122 is a reply to message #488082] |
Fri, 25 September 2009 15:42 |
Andrew Niefer Messages: 990 Registered: July 2009 |
Senior Member |
|
|
It doesn't look like the @{artifact} is handled by the addJvmArg action. The workaround in the bug only helps for -D system property vm args.
The only thing I can think of would be to have your p2.inf explicitly hard code the plugins/myplugin_version/libagent.so.
addJvmArg(jvmArg:-agentpath:${installFolder}/plugins/myplugin_version/libagent.so);
This would only work for normal shaped installs, and would require you to modify the p2.inf at build time. You could use something like "myplugin_@version@" in the source, and then use custom build callbacks to change it with something like: (this assumes you are including the p2.inf in your binary bundle).
build.properties:
customBuildCallbacks=true
customBuildCallbacks.inheritall=true
customBuildCallbacks.xml :
<target name="post.gather.bin.parts">
<replace file="${target.folder}/META-INF/p2.inf" token="@version@" value="${bundleVersion}" />
</target>
Nicolas wrote on Fri, 25 September 2009 10:13 | Hello there,
I am writing an eclipse plugin which need an agent to be attached to the eclipse launching JVM.
Manually, I just add the following jvmarg line in the eclipse.ini:
-agentpath:/home/user/eclipse/plugins/myplugin_version/libag ent.so
That is working perfectly, but need the user to perform a manual task after installing my plugin.
I would like to automate this line adding procedure using p2.
I found some documentation about the addJvmArg p2.inf directive.
So, in my plugin META-INF folder, I wrote a p2.inf that looks like this:
instructions.install = \
addJvmArg(jvmArg:-agentpath:@artifact/libagent.so);
instructions.install.import= \
org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg,
Then, generating the metadata, I can found this part of generated code in content.xml:
<instruction key='install' import='org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg,'>
addJvmArg(jvmArg:-agentpath:@artifact/libagent.so);
</instruction>
In a fresh eclipse install, I install my plugin, using the previous content.xml as metadata, then looks in the resulting eclipse.ini.
-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms40m
-Xmx256m
-agentpath:@artifact/libagent.so
The @artifact is not replaced by path of artifact
I have seen the bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=273480 that seems to looks like this, but has been workarounded.
Is someone has already done this kind of p2 custom?
Any idea to do this agent attach task?
Thanks for your p2 lights
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06900 seconds