Friday, May 7, 2010

How to automate Build Process of Eclipse Plugins ?

Lets assume that eclipse code need to be built using ant targets defined in the build.xml of main product
PRODUCT_BUILD_HOME = C:\codebase\myProduct\build
ECLIPSE_TOOL_BUILD_HOME = C:\codebase\myProduct\eclipseTool\build

Let’s assume following are the locations of the build script of the main product code and eclipse tool code :

Step-1 :Set up main build Properties (PRODUCT_BUILD_HOME) :

We need to provide the locations of eclipse code and installation so that ant target can build our eclipse tool’s code.

In the main build.properties file in PRODUCT_BUILD_HOME set the following two properties for Eclipse Tool directories

# Because of the way Eclipse PDE build operates, we need to set the absolute path

eclipse.tool.home= C:/codebase/myProduct/eclipseTool
eclipse.home=C:/install/eclipse

eclipse.tool.clean.compileLog=Y

Step-2 :Set up buildEclipseCode Ant Target in the main build xml (PRODUCT_BUILD_HOME):
We need to find out the equinox jar that will build the eclipse tool’s code.
build.xml








































































Step 3 : Set up Eclipse Tool Build Scripts (EclipseToolbuilder.bat)
Step-1 :
We should copy the scripts (allElements.xml, customTargets.xml, build.properties) from eclipse\plugins\org.eclipse.pde.build_3.x\templates\headless-build into the ECLIPSE_TOOL_BUILD_ HOME.
The main build script from product codebase should invoke the following .bat file
java -jar -Xms512M -Xmx1024M %jarLocation% -application org.eclipse.ant.core.antRunner -buildfile %pdeLocation% -Dbuilder=%buildDirectory%/eclipse-build-script -DbaseLocation=%baseLocation% -DbuildDirectory=%buildDirectory%

java BuildCleaner %buildDirectory% %cleanCompileLog%

** Note that baseLocation and buildDirectory are the fixed names as used in eclipse build scripts.

No comments: