关于Eclipse 3.0中的插件自动构建简介

http://tech.ddvip.com   2007年08月31日    社区交流

内容摘要:Eclipse 提供了在Eclipse IDE外自动构建的能力。Eclipse本身也是采用这种方式构建的。本文将分享Eclipse自动构建的一些经验,详细介绍Eclipse插件开发的自动编译过程。

  3.PreBuild过程中要做的一件重要事情就是回调customTargets.xml文件的getMapFiles Target获取map文件。Map文件定义了将要构建的所有插件在cvs中的位置。Map文件的格式如下:

  feature|fragment|plugin@elementId=<cvs tag>,<access method>:<cvsuser>@<cvs repository>,<cvs password>[,<repository path> (no starting slash) ]

  Map文件从cvs获得后会放在buildDirectory目录下的map子目录下。Map文件可以是有多个的,脚本会将map目录下的所有map文件连接为${buildDirectory}/directory.txt文件。

  4.fetch过程同样会调用customTargets.xml文件中的allElements target。AllElements Target又将调用$ECLIPSE_HOMEpluginsorg.eclipse.pde.build_3.0.0scripts下的genericTargets.xml文件的fetchElement target。FetchElement target中会调用eclipse内置的Ant Task “eclipse.fetch”。“eclipse.fetch”会自动生成一个fetch_${plugin_id}.xml文件。它生成的原理是分析feature.xml文件,获取一个feature内包含的所有插件id, 然后在map文件中查找插件在cvs中的位置并生成fetch_$(plugin_id).xml文件。然后会执行该fetch文件将插件代码获取到本地构建机器上。

  5.Generate过程同样会回调customTargets.xml文件的allElements target。AllElements target又将调用$ECLIPSE_HOMEpluginsorg.eclipse.pde.build_3.0.0scripts下的genericTargets.xml文件的generateScript target。GenerateScript Target中会调用eclipse内置的Ant Task “eclipse.buildScript”。“eclipse.buildScript”的作用是根据插件下的plugin.xml文件生成构建插件所需的build.xml文件。大家注意到在脚本中将这个过程自动化了。同样的我们可以在ide环境中的插件开发透视图中选中一个plugin.xml文件,执行右键菜单中的pde tools->Create Ant Build File命令生成build.xml文件。如下图所示:

作者:晏斐    责编:豆豆技术应用

正在加载评论...