简体   繁体   English

与Eclipse相比,使用Ant构建PDE非常慢

[英]PDE build with Ant is extremly slow compared to Eclipse

I have a very large OSGi project with about 300 bundles. 我有一个非常大的OSGi项目,大约有300个捆绑包。 When I import the project in Eclipse and do a Project -> Clean... and Project -> Build All it takes about 10 minutes until everything is build and I can start my application. 当我在Eclipse中导入项目并执行“ Project -> Clean...和“ Project -> Build All时,大约要花10分钟才能Project -> Build All内容,然后才能启动我的应用程序。

I think that 10 minutes are already pretty long, but when I execute a headless PDE build with Ant scripts it takes about an hour! 我认为10分钟已经很长了,但是当我使用Ant脚本执行无头PDE构建时,大约需要一个小时! I think something goes pretty wrong... 我认为出了点问题...

Do you have any hint for me how to speed-up the Ant-based build? 您是否对我有任何提示,如何加快基于Ant的构建? Or how to track the problem down? 还是如何找出问题所在? I use the normal PDE build with a command like below. 我将正常的PDE构建与以下命令结合使用。 I have no idea why it is so much slower compared to a complete build in Eclipse. 我不知道为什么它比Eclipse中的完整构建要慢得多。

java -jar eclipse/plugins/org.eclipse.equinox.launcher_<version>.jar -application org.eclipse.ant.core.antRunner -buildfile  eclipse/plugins/org.eclipse.pde.build_<version>/scripts/build.xml -Dbuilder=<path to the build configuration folder>

Thanks, Thomas 谢谢托马斯

PS.: I know the question is very general, but even a hint how to find the performance lack would be helpful. PS .:我知道这个问题很笼统,但是即使提示如何发现性能不足也会有所帮助。

What you are seeing is expected, because you are (probably) comparing two different things: 所见即所得,因为您正在(可能)比较两个不同的事物:

When forcing a rebuild in the Eclipse IDE, you are simply compiling all java-files. 在Eclipse IDE中强制重建时,您只需编译所有Java文件。 (For our 270-bundle project, this takes about 1-2 minutes.) (对于我们的270捆绑包项目,这大约需要1-2分钟。)

When building with PDE-build, you are packaging the product as well (generating bundles and features, resolving plugin dependencies, JAR-ing everything, etc), and this takes much more time. 使用PDE-build进行构建时,您还要打包产品(生成捆绑包和功能,解决插件依赖项,对所有内容进行JAR处理等),这将花费更多的时间。 (For our project this takes about 6-7 minutes.) The equvivalent of this in the IDE would be to open your .product file, and on the "overview"-tab in the editor, you select "eclipse product export wizard". (对于我们的项目,这大约需要6-7分钟。)在IDE中,等效的操作是打开.product文件,然后在编辑器的“概述”选项卡上,选择“ eclipse产品导出向导”。

As for tips on how to speed up the build: There is no silver bullet that I know of. 至于如何加快构建的提示:我所知道的没有万灵丹。 But: Search for "tycho build eclipse", and/or see http://www.vogella.com/tutorials/EclipseTycho/article.html and https://eclipse.org/tycho/ . 但是:搜索“ tycho build eclipse”,和/或参见http://www.vogella.com/tutorials/EclipseTycho/article.htmlhttps://eclipse.org/tycho/ In other words: You can change your build to use Tycho, which enabeles you to build each plugin separately (and incrementally if you want). 换句话说:您可以将构建更改为使用Tycho,从而使您能够分别构建每个插件(如果需要,可以增量构建)。

I work on a large RCP project with around 50k classes spread over 850 projects/bundles in the workspace (with a similar number of bundle sin the target platform). 我在一个大型RCP项目中工作,该类大约有5万个类,分布在工作区中的850个项目/包中(目标平台的包数量与之相似)。 We have SSDs in both our desktops and in the Jenkins servers to speed up the build. 我们在台式机和Jenkins服务器中都有SSD,以加快构建速度。 Builds are far quicker on Linux than on Windows. 在Linux上构建比在Windows上构建快得多。 Windows workspace refresh and clean all takes around 2-3 minutes whereas a full Linux headless build takes around 25 minutes (on Windows it is over an hour). Windows工作区的所有刷新和清理工作大约需要2-3分钟,而完整的Linux无头构建大约需要25分钟(在Windows上是一个多小时)。

The PDE headless build process is not very efficient, and it does a lot of crazy I/O. PDE无头构建过程不是很高效,并且会执行很多疯狂的I / O。 At the start of the build it is common to see the scripts pause for minutes on the "generateScript" and "generateFeature" stages. 在构建开始时,通常会看到脚本在“ generateScript”和“ generateFeature”阶段暂停几分钟。 If you profile these you will see that there are millions of reads to build.properties files when it calculates the dependency tree (I got to 46 million reads for ~1000 build.properties and then decided to stop) so something isn't right there. 如果您对它们进行了分析,则在计算依赖关系树时,将看到build.properties文件的数百万次读取(我对1000个build.properties进行了4,600万次读取,然后决定停止),所以那里不对劲。 The PDE Headless build system is now effectively abandoned at Eclipse in favour of Tycho, so I doubt it will get looked at. 现在,PDE无头构建系统已在Eclipse上有效地弃用了Tycho,因此我怀疑它会被研究。

If you have Eclipse features, make sure the inclusions are sane - by including the same feature in multiple places we found that the above generateScript/generateFeature stages could take much longer than needed. 如果您具有Eclipse功能,请确保内含物合理-通过在多个位置包含相同功能,我们发现上述generateScript / generateFeature阶段可能花费的时间比所需的长得多。

If you can build your project in phases such that you can use the product of one phase as a target platform for the next do so - it really helps. 如果您可以分阶段构建项目,以便可以将一个阶段的产品用作下一个阶段的目标平台,那么它确实会有所帮助。

Finally, try and move your builds to Tycho/Maven. 最后,尝试将构建版本移至Tycho / Maven。 We haven't been able to do this except on some of our supporting projects yet (partly because of how our target platform is built, partly due to the use of customBuildCallbacks in several places, and generally due to the lack of time) but it does appear to be a much better build system. 除了某些支持项目外,我们还无法做到这一点(部分是由于目标平台的构建方式,部分是由于在多个地方使用了customBuildCallbacks,通常是由于时间紧缺),但是它确实是一个更好的构建系统。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM