Eclipse p2替代自定义安装处理程序 [英] Eclipse p2 alternative for custom install handlers

查看:176
本文介绍了Eclipse p2替代自定义安装处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在p2之前,可以编写一个自定义的安装处理程序,该安装程序具有在安装期间执行任何自定义任务的功能。



我看到使用p2不再支持自定义安装处理程序。
我不断听到关于自定义接触点的替代。



然而,我无法找到任何具体的示例/文档。



任何人都可以告诉我如何使用p2更新管理器获取自定义安装处理程序的功能。



编辑: / strong>描述我想做什么 -



我需要编辑eclipse.ini文件,并将-Xmx属性设置为一个值,这是基于我们是否在64位或32位环境中运行



编辑2:我尝试在我的功能中创建一个p2.inf文件,具有以下一行 -

  instructions.install = \ 
addJvmArg(jvmArg:-Xmx900m);

instructions.install.import = \
org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg,

,它的工作原理是32位和64位。

解决方案

p2.inf 绝对是执行自定义操作的正确位置。这是一个将vm参数添加到.ini中的好地方。您可以在功能/插件下方放置一个 p2.inf



于12月20日更新



我在自己的环境中尝试过,在linux 32位和64位上安装相同的功能时,可以设置不同的vm参数。您可以下载示例代码来播放。

 #创建我们创建的IU片段的要求
requires.2.namespace = org.eclipse.equinox.p2.iu
requires.2.name = configure.com.example.yourfeature.linux.x86
requires.2.range = [1.0.0,1.0.0]
requires.2.greedy = true
requires.2.filter =(&(osgi.os = linux)(osgi.arch = x86))

#创建一个名为configure.com.example.yourfeature的IU .linux.x86 for linux 32位
units.0.id = configure.com.example.yourfeature.linux.x86
units.0.version = 1.0.0
units.0。 filter =(&(osgi.os = linux)(osgi.arch = x86))
units.0.provides.1.namespace = org.eclipse.equinox.p2.iu
units.0 .provides.1.name = configure.com.example.yourfeature.linux.x86
units.0.provides.1.version = 1.0.0
units.0.instructions.configure = addJvmArg(jvmArg :-Xmx500m);
units.0.instructions.configure.import = org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg,

#create对IU片段的要求,我们正在创建
requires.3.namespace = org.eclipse.equinox.p2.iu
requires.3.name = configure.com.example.yourfeature.linux.x86_64
requires.3.range = [1.0。 0,1.0.0]
requires.3.greedy = true
requires.3.filter =(&(osgi.os = linux)(osgi.arch = x86_64))

#创建一个名为configure.com.example.yourfeature.linux.x86_64 for Linux的IU通配符64位
units.1.id = configure.com.example.yourfeature.linux.x86_64
单位.1.version = 1.0.0
units.1.filter =(&(osgi.os = linux)(osgi.arch = x86_64))
units.1.provides.1.namespace = org.eclipse.equinox.p2.iu
units.1.provides.1.name = configure.com.example.yourfeature.linux.x86_64
units.1.provides.1.version = 1.0。 0
units.1.instructions.configure = org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg(jvmArg:-Xmx900m);


Before p2, one could write a custom install handler with a feature that was executed to do any 'custom' task during installation.

I see that with p2 the custom install handler is no longer supported. I keep hearing about 'custom touchpoints' being the replacement for that.

However I cant find any concrete example/documentation for it.

Can anyone tell me how to get the functionality of custom install handlers with the p2 update manager.

Edit: A description of what I want to do -

I need to edit the eclipse.ini file and set the -Xmx property to a value based on whether we are running inside a 64 bit or 32 bit env.

Edit 2: I tried creating a p2.inf file in my feature with the following line -

instructions.install = \
addJvmArg(jvmArg:-Xmx900m);

instructions.install.import= \
org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg,

and it works, however it does not differentiate between 32 and 64 bit.

解决方案

p2.inf definitely is the right place to perform customized actions. It is a good place to add vm arguments into .ini. You could put a p2.inf under your feature/plug-in.

Updated on 20 Dec.:

I tried it on my own environment, it works well to set different vm args when installing the same feature on linux 32bit and 64bit. You could download the example code to play with it.

#create a requirement on the IU fragment we are creating
requires.2.namespace=org.eclipse.equinox.p2.iu
requires.2.name=configure.com.example.yourfeature.linux.x86
requires.2.range=[1.0.0,1.0.0]
requires.2.greedy=true
requires.2.filter=(&(osgi.os=linux)(osgi.arch=x86))

#create a IU frament named configure.com.example.yourfeature.linux.x86 for linux 32 bit
units.0.id=configure.com.example.yourfeature.linux.x86
units.0.version=1.0.0
units.0.filter=(&(osgi.os=linux)(osgi.arch=x86))
units.0.provides.1.namespace=org.eclipse.equinox.p2.iu
units.0.provides.1.name=configure.com.example.yourfeature.linux.x86
units.0.provides.1.version=1.0.0
units.0.instructions.configure=addJvmArg(jvmArg:-Xmx500m);
units.0.instructions.configure.import=org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg,

#create a requirement on the IU fragment we are creating
requires.3.namespace=org.eclipse.equinox.p2.iu
requires.3.name=configure.com.example.yourfeature.linux.x86_64
requires.3.range=[1.0.0,1.0.0]
requires.3.greedy=true
requires.3.filter=(&(osgi.os=linux)(osgi.arch=x86_64))

#create a IU frament named configure.com.example.yourfeature.linux.x86_64 for linux 64 bit
units.1.id=configure.com.example.yourfeature.linux.x86_64
units.1.version=1.0.0
units.1.filter=(&(osgi.os=linux)(osgi.arch=x86_64))
units.1.provides.1.namespace=org.eclipse.equinox.p2.iu
units.1.provides.1.name=configure.com.example.yourfeature.linux.x86_64
units.1.provides.1.version=1.0.0
units.1.instructions.configure=org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg(jvmArg:-Xmx900m);

这篇关于Eclipse p2替代自定义安装处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆