Max, and all,
I don't know what is in place or planned for automating plugin builds. I searched this mailing list archive and found discussions in Jan 2005, and Dec 2004 regarding builds of plugins and source directory structure, but neither of these addressed an automated mechanism. This email is a contribution. I hope its helpful at this stage. Attached is a prototype build file to show a possibility and I can continue if it fits into your plans.
Here are goals of the hibernate plugin build script: - builds all plugins from one command: ant -f plugin-build.xml <target>
- deposits zipped binary and source of plugins into a drop directory.
- supports build directly after 'cvs checkout' of the plugins, but after other libs in Ext are built.
- simplify directions on the plugin contribution howto by providing additional build targets (to be identified).
- will copy resources into a plugin before building (leverages org.hibernate.eclipse/hibernate-build.xml update target.)
- synchronize with the plugin build environment used by developer in PDE session. In other words, if a new library is added into the plugin's build path by a plugin developer using the eclipse PDE, the new dependency should be picked up without further manual intervenetion (like adding a jar file to an ant property).
According to Clayberg and Rubel (in "Eclipse: Building Commercial Quality Plug-ins", Addison-Wesley), there are two cool mechanisms in eclipse that helps: 1) the PDE can generate a build.xml, and 2) the generated build.xml can be run 'headless' (without the user interface).
Here is proposed files and structure:
HibernateExt plugin-build.xml org.hibernate.eclipse.* (for each plugin) build.xml (eclipse generated file) hibernate-build.xml (provided by plugin developer)
Attached is a the initial prototype of plugin-build.xml. There is more to do; this is a proof-of-concept demo. It can build org.hibernate.eclipse zip files if org.hibernate.eclipse/build.xml was generated by developer in eclipse PDE, and if you have 3.1M6 installed (Headless build in 3.1M5a didn't work). Modify the eclipse.home and workspace properties in plugin-build.xml. Run in HibernateExt as: ant -f plugin-build.xml zip.plugin
By convention, each plugin's hibernate-build.xml would have well-known public targets for the plugin-build.xml to run: 'pre-build', and others as needed. In org.hibernate.eclipse/hibernate-build.xml, the target pre-build would antcall 'update'. A set of properties would be made available to hibernate-build.xml (to be defined).
To generate a build.xml by hand: in eclipse, right click on the plugin.xml in the plugin's project and select PDE Tools > Create Ant Build File. I expect there is a way to generate this file headless, and I will look for it. If so, then generating the build.xml file per plugin would be part of the automatic build, and PDE developer wouldn't have to remember to generate it manually, and it wouldn't be in cvs.
I'm on the lookout for examples. I looked into the PDE plugin source code, but not enough to assure myself it can be reused; I spent only enough time to realize that I need to spend much more time on it :-). If anyone can assure me that this or some other plugin build scripts can be reused here, I'll pursue it.
Comments?
John
<?xml version="1.0" encoding="UTF-8"?> <project name="plugins"> <property name="eclipse.home" location="/opt/eclipse-3.1-M6"/>
<!-- use an absolute path, the workspace directory will be created if non-existent --> <property name="workspace" location="/usr/tmp/eclipse-build-workspace"/> <!-- - if you don't want eclipse output set value to "" - if you do want eclipse output, set value to "-consolelog" --> <property name="eclipse.console.flag" value=""/> <target name="eclipse-launcher" description="Invoke a 'headless' eclipse" > <java classname="org.eclipse.core.launcher.Main" fork="true" dir="${work.dir}"> <classpath> <pathelement location="${eclipse.home}/startup.jar"/> </classpath> <arg line="-data ${workspace}" /> <arg line="-application ${application}"/> <arg line="${eclipse.console.flag}"/> <arg line="${application.args}" /> </java> </target> <target name="ant-runner" description="Invoke an ant build within 'headless' eclipse"> <antcall target="eclipse-launcher"> <param name="application" value="org.eclipse.ant.core.antRunner" /> <param name="application.args" value="-buildfile ${buildfile} ${targets}" /> <param name="work.dir" value="${plugin.name}"/> </antcall> </target> <target name="zip.plugin" description="run 'zip.plugin' target in a plugin's build.xml"> <antcall target="ant-runner"> <param name="buildfile" value="build.xml"/> <param name="targets" value="zip.plugin"/> <param name="plugin.name" value="org.hibernate.eclipse"/> </antcall> </target> </project>