Channels ▼
RSS

Open Source

Automating An Eclipse RCP Build


Packaging the Project

After the build compiles all of the source code in the workspace with Buckminster, it executes a Buckminster target to package the result. When building an Eclipse feature using Buckminster, one would ordinarily package the result into a P2 repository using the automatically generated "site.p2" target. In this case, however, I need the plug-ins packaged as a product with a launcher. So I have created a different target in a cspex file (Listing Three).

Listing Three: The cspex file.

<cspecExtension xmlns:com="http://www.eclipse.org/buckminster/Common-1.0"
                    xmlns="http://www.eclipse.org/buckminster/CSpec-1.0">
    <actions>
    	...
        <public name="create.product.test" actor="ant">
            <actorProperties>
                <property key="buildFile" value="product.ant" />
                <property key="targets" value="create.product" />
            </actorProperties>
            <properties>
                <property key="profile" value="Profile" />
                <property key="iu" value="com.asolutions.lightning.test_product" />
            </properties>
            <prerequisites alias="repository">
                <attribute name="site.p2" />
            </prerequisites>
            <products alias="destination" base="../../">
                <path path="test-product/" />
            </products>
        </public>
		...
    </actions>
</cspecExtension>

The cspex file allows me to add custom targets to the built-in targets provided by Buckminster. The new target calls site.p2 and then installs the product into the file system. In this case, the build installs the test product with the command create.product.test. (This command actually runs the embedded version of Ant that comes with Buckminster to perform the work.)

Running the Tests

After the test product is installed in the file system, the build needs to run the tests. The Eclipse Test Framework includes an Ant file for this, but since it is a little limited, I have replaced that functionality with a custom Ant file. Because the test framework is launched as an Eclipse application and can run only a single test or test suite at a time, a test suite called "AllTests" has to be included for each plug-in fragment.

The test target in Ant launches the test framework from within the test product. It takes the name of the plug-in that contains the tests, and then saves the resulting JUnit test reports. Ant then invokes the SWTBot framework, which runs user-interface tests and saves the resulting reports. These test reports can be displayed by the Eclipse IDE. Assuming all tests pass, Ant packages the final product and the build is complete.

An automated build is one of the key units in any professional development effort. With it, developers can have confidence in the product. As a bonus, it allows the use of a continuous integration server (such as Jenkins) to keep the team on track. With the advances made in Eclipse 3.6 and the Lightning template project, an automated build for Eclipse RCP is finally within the reach of the whole community.


— Micah Hainline is a software engineer at Asynchrony Solutions Inc. He works on mobile applications, Web technologies, rich client applications, and enterprise architecture.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video