如何用重命名的 eclipsec.exe 替换 myproduct.exe

How to replace myproduct.exe with renamed eclipsec.exe

我有一个 Eclipse RCP 产品。

我正在(ab?)使用位于 .product 文件所在目录中的 p2.inf 文件删除 .exe 文件并将 eclipsec.exe 文件重命名为 .执行文件。内容如下:

instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/eclipsec.exe, target:${installFolder}/myproductname.exe, overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/eclipsec.exe);

我需要使用 Maven tycho 为 windows 和 linux 构建此产品。对于 windows,p2.inf 文件指令工作正常。对于 linux 这失败了,对此我并不感到惊讶(没有 .exe 文件)。

有没有办法只为 windows 执行这些指令/忽略 p2.inf 文件 linux 当产品是用 tycho 构建时构建的(对于 linux无论如何只生成 1 个可执行文件)?

提前致谢。

第谷版本:1.0.0 Eclipse SDK 版本:4.7.0

这可以通过以下任一方式完成:

如果可能的话,第一个选项更可取,因为第二个选项更复杂并且需要更多关于 p2 的知识。

请注意,您的根本问题似乎是 Eclipse bug 185205。也许您想对其投票或发表评论。我怀疑有比通过 p2 复制更好的解决方法。

我如何在不破坏 linux build

的情况下将 eclipsec.exe 移动到 myproduct.exe(覆盖)

我在 myproduct.product 文件旁边添加了一个 myproduct.p2.inf 文件,内容如下:

instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/eclipsec.exe, target:${installFolder}/myproduct.exe, overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/eclipsec.exe);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../../linux/gtk/x86_64/myproduct/myproduct.exe);

在此状态下,Linux 构建的复制指令将失败,因为没有 eclipsec.exe 文件 (FileNotFoundException)。它仅为 Windows 构建生成。

请注意,如果找不到指定的文件,复制指令将失败,而如果指定的文件不存在,则不会执行删除指令。

解决方法

为了解决这个问题,我将空文件 org.example.feature/filesToCopy/eclipsec.exe 添加到我的功能中(包含在我的基于功能的产品中) 并将 root.linux.gtk.x86_64=filesToCopy 行添加到功能项目的 build.properties 中。这会将空 eclipsec.exe 文件复制到 Linux build.

Windows会发生什么:

  1. 该产品是用 eclipsec.exemyproduct.exe
  2. 构建的
  3. eclipsec.exe 被复制到 myproduct.exe(覆盖 myproduct.exe)
  4. eclipsec.exe被删除

--> myproduct.exe 是唯一的可执行文件(在 myproduct.ini 文件旁边)。但是所有品牌都丢失了!

Linux会发生什么:

  1. 该产品是使用 myproduct 可执行文件和一个空的 eclipsec.exe 文件构建的。
  2. eclipsec.exe 复制到 myproduct.exe
  3. eclipsec.exe被删除
  4. myproduct.exe也删了

--> linux 档案看起来和第谷建立的一模一样。所有对*.exe文件的复制和重命名,无非是为了能够执行p2.inf文件中的复制指令,而Windows 建造。

我必须自己解决,使用 windows 过滤器在此处发布完整的解决方案。

在您的应用程序的 "Product" 项目中创建文件 p2.inf (或专题项目)。

将 MYPRODUCT 更改为您自己的品牌名称。

复制时,请确保接触点操作中反斜杠后没有尾随空格,否则将不起作用。

#create a requirement on the fragment we are creating
requires.22.namespace=org.eclipse.equinox.p2.iu
requires.22.name=MYPRODUCT.eclipsecoverride.config.win32.win32.x86_64
requires.22.range=[$version$,$version$]
requires.22.greedy=true
requires.22.filter=(osgi.os=win32)

#create a IU fragment with touchpoint action
units.0.id = MYPRODUCT.eclipsecoverride.config.win32.win32.x86_64
units.0.version = $version$
units.0.provides.1.namespace=org.eclipse.equinox.p2.iu
units.0.provides.1.name=MYPRODUCT.eclipsecoverride.config.win32.win32.x86_64
units.0.provides.1.version=$version$
units.0.filter=(osgi.os=win32)
units.0.instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(\
source:${installFolder}/eclipsec.exe,\
target:${installFolder}/MYPRODUCT_console.exe,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.remove(\
path:${installFolder}/eclipsec.exe);