ZEN Tool Continuous Integration
From ZenWiki
The continuous integration is based on PDE Build and Eclipse Test Framework. The PDE Build produces the binary of ZEN Client. The Eclipse Test Framework carries out the unit tests and code coverage.
The project produces two different builds from the code base.
- Release build: The build that will be released to the client. Most likely, it will be run manually.
- Test/Nightly build: The build that will be used to run unit tests. Most likely, it will be run automatically.
Contents |
Build Environment
This section describes the configuration of the build environment. By following the configuration, everyone should be able to run the build locally.
Eclipse
Download and install the following components. The location of Eclipse is assumed to be C:/eclipse.
- Eclipse 3.3 - Download Eclipse Classic
- Eclipse Test Framework
- RCP delta pack 3.3
- BIRT/DTP integration
Note: A full list of available releases is here.
PMD
Download and unzip the file to C:/
Emma
Download and unzip the file to C:/
BIRT Runtime
Download and unzip the following files to C:/
Note: The latest release can be accessed here.
BIRT source
Download and unzip the following files to C:/birt-source-2.2
Directory Structure
An overview of the build environment's directory structure.
- C:/eclipse: Installation of Eclipse, Eclipse test framework and RCP delta pack
- C:/emma-2.0.5312: Java code coverage tool
- C:/pmd-3.9: Static java code analysis tool
- C:/zen-client-build: The directory where the release build is produced.
- features/: All feature projects should be placed here.
- plugins/: All plugin projects should be placed here.
- zen.client.builder/: The build configuration files.
- C:/zen-client-test-build: The directory where the test build is produced.
- features/: All feature projects should be placed here.
- plugins/: All plugin projects should be placed here.
- zen.client.test.builder/: The build configuration files.
PDE Build
The following customizations are made to produce the binary of ZEN Client.
build.properties
The primary configuration file of PDE Build. The file itself contains information about each property. The following list highlights the properties of concerns.
- product=/zen.client.application/client-test.product: Inside zen.client.application project, there are two primary product configurations.
- client-test.product: The configuration for a testable ZEN Client with testing plugins and features.
- client.product: The configuration for a production ZEN Client without any testing plugins and features.
- archivePrefix=zenclient
- configs=win32, win32, x86
- buildDirectory=C:/zen-client-build
- buildType=S (See http://www.eclipsedltk.org/node/19)
- buildId=ReleaseBuild
- base=C:
- baseLocation=${base}/eclipse
- bootclasspath=${java.home}/lib/rt.jar;${java.home}/lib/jce.jar
- javacSource=1.5
- javacTarget=1.5
- testDirectory=${buildDirectory}/tests
productBuild.xml
Apply the workaround of bug 152577.
Modify C:/plugins/org.eclipse.pde.build_3.2.1.r321_v20060823/scripts/productBuild/productBuild.xml
C:/eclipse/plugins/org.eclipse.pde.build_3.3.0.v20070612/scripts/productBuild/productBuild.xml
<target name="generateFeature">
<delete dir="${buildDirectory}/features/org.eclipse.pde.build.container.feature"/>
<eclipse.generateFeature
featureId="org.eclipse.pde.build.container.feature"
buildDirectory="${buildDirectory}"
baseLocation="${baseLocation}"
productFile="${product}"
verify="${verify}"
pluginPath="${pluginPath}"
configInfo="${configs}"
/>
</target>
PDE Build Command
A sample command that runs the PDE Build:
java -jar C:/eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar -application org.eclipse.ant.core.antRunner -buildfile C:/eclipse/plugins/org.eclipse.pde.build_3.3.0.v20070612/scripts/productBuild/productBuild.xml -Dbuilder=C:/zen-client-build/zen.client.builder
Note: The plug-in versions depends on the Eclipse Platform that is used.
java -jar C:/startup.jar -application org.eclipse.ant.core.antRunner -buildfile C:/eclipse/plugins/org.eclipse.pde.build_3.3.0.v20070612/scripts/productBuild/productBuild.xml -Dbuilder=C:/zen-client-build/zen.client.builder
java -jar C:/startup.jar -application org.eclipse.ant.core.antRunner -buildfile C:/plugins/org.eclipse.pde.build_3.2.1.r321_v20060823/scripts/productBuild/productBuild.xml -Dbuilder=C:/zen-client-build/zen.client.builder
The command batch and shell are also available in the zen.client.builder and zen.client.test.builder project.
customTargets.xml
This file is used to link PDE Build to Eclipse Test Framework.
<!-- ===================================================================== -->
<!-- Steps to do to test the build results -->
<!-- ===================================================================== -->
<target name="test">
<echo message="Setting up tests in ${testDirectory}"/>
<delete dir="${testDirectory}"/>
<mkdir dir="${testDirectory}"/>
<echo message="${buildDirectory}/${buildLabel}/${buildId}-win32.win32.x86.zip"/>
<unzip src="${buildDirectory}/${buildLabel}/${buildId}-win32.win32.x86.zip"
dest="${testDirectory}"/>
<echo message="${builder}/test.xml"/>
<ant antfile="${builder}/test.xml"
target="all" dir="${testDirectory}">
<property name="os" value="win32" />
<property name="ws" value="win32" />
<property name="arch" value="x86" />
</ant>
</target>
Eclipse Test Framework
Eclipse Test Framework is designed for testing Eclipse. Therefore, heavy customization is needed to apply it to our project.
zen.client.builder/text.xml
This file is the starting point of the test framework. It prepares the testing environment and specifies the tests to be run. In general, common tasks should be handled here.
zen.client.builder/test.properties
The property file for the text.xml.
zen.client.builder/label.properties
This is part of the test framework, but it's not clear we will use it at this point.
test.xml in each test plugin
Unit tests are packaged in plugins, and each plugin supplies an test.xml that specifies the entry point of the unit tests.
library.xml
The original version of the file is located in C:/plugins/org.eclipse.test_3.1.0/library.xml.
The original version always invokes the tests with the default Eclipse workbench application. For our project, specify the testApplication property to zen.client.application.application. A copy of the modified version is available in zen.client.test.builder project, and it will be used in the build.
<java jar="${eclipse-home}/startup.jar" fork="true" dir="." timeout="${timeout}" jvm="${jvm}">
<arg line="-application ${application}"/>
<arg line="-dev bin -data ${data-dir}"/>
<arg line="formatter=${formatter},${test-output}"/>
<arg line="-testPluginName ${plugin-name}"/>
<arg line="-className ${classname}"/>
<!-- Customized for ZEN Client -->
<arg line="-testApplication zen.client.application.application"/>
<arg line="-os ${os}"/>
<arg line="-ws ${ws}"/>
<arg line="-arch ${arch}"/>
<arg line="-consolelog"/>
<jvmarg line="${vmargs} ${extraVMargs}"/>
<sysproperty key="PLUGIN_PATH" value="${plugin-path}"/>
</java>
