# Automating PWSAD Plug-in build

### From P4WSADWiki

[edit]

## Introduction

One way to generate distribution version of P4WSAD is to invoke External menu item "Export" from Eclipse. This is documented here Exporting P4WSAD plugins. However, if you need to construct automated build (for example, generating daily build or automating test), you need to build plug-ins without running inside Eclipse itself. This is known as "headless" build. This articles will show step by step for running P4WSAD headless build.

[edit]

## Use cases for headless build

- Generate plug-ins for Eclipse 3.0 or greater

- Generate plug-ins for Eclipse 2.1.3 (WSAD 5.1 compatiable)

- Run set of unit tests for Eclipse 3.0 plug-ins

- Run sets of unit tests for Eclipse 2.1.3

[edit]

## Background Reading

Here is list of background materials necessary for understanding this article.

- [1] This articles talks about build and test automation of plug-ins in general. Althought it is out of date, principle remains same.

- [2] Wiki FAQ page for PDE build.

- [3] PDE build mailing list.

- [4] Techniques for supporting multiple versions of Eclipse.

[edit]

## Environmental Setup

We need to set up following environment to run P4WSAD build automation scripts. The script should work on all supported Eclipse platforms but it is only tested on Windows platform.

- Install Java 1.4 or greater from java.sun.com

- Install Ant. We will be using Ant as main script for build. Ant is replacement for 'Make' and is standard for building Java applications. Make sure 'ant' command is on executable path. To test it, open command shell and type 'ant -version'. Ant should be version 1.6 or greater because our script take advantage of 'import' capability which are only present in version 1.6.

- Set up Eclipe environment
  - Download Eclipse 3.2 distribution file.
  - Download Eclipse 2.1.3 distribution file.
  - Install Eclipse 3.2 from distribution file by expanding zip or .gz file. Keep original distribution files as we are going to construct test eclipse setup for running junit test.

[edit]

## P4WSAD Project Setup

- Check out P4WSAD using appropriate p4 commands
- modify file "common.properties" in the top level directory

- - eclipse.home Location of Eclipse 3.2 location
  - eclipse.sdk.zip.32 Location of Eclipse 3.2 SDK zip(.gz) location
  - eclipse.sdk.zip.213 Location of Eclipse 2.1.3 SDK zip(.gz) location
  - p4wsad.plugin.site Directory where p4WSAD site would be built
  - os Name of Os.
  - arch CPU Architecture
  - ws Window System

[edit]

## Build artifacts

All build related requires files and resulting artifacts are stored in the top level directory "/build".

- /frameworks This directory contains all required library files
  - /objfac This directory contains open source plug-in that can apply preprocesss java files depends on rule
  - eclipse-test-framework-3.2.zip' This zip file contains Eclipse 3.2 test harness framework
  - eclipse-test-framework-213.zip' This zip file contains Eclipse 2.1.3 test harness framework
  - /format/junit.xls' This is XLS file for formatting junit result into HTML file
- /result This file contains junit results
  - html This directory contains junit result formattedin HTML.
  - summary This directory summarized junit result
  - xml This directory contains raw junit XML result
- /site This directory contains generated P4WSAD plugin
- /test This directory is a test eclipse location to run plugin tests.

[edit]

## Script files

Main Ant script files are located in the root directory. They are build-32.xml for generating Eclipse 3.2 plugins and run tests. For Eclipse 2.1.3, use build-213.xml. Other files are:

- common.properties Common properties files. It specifies SDK files.
- common-system.xml Common parent build files.
- common-plugin.xml Common build file for all plug-in.

These script are launched from ant and will then kick off Eclipse to invoke plug-in specific files. For each plug-in, there are following files:

- build-32.xml Build files for Eclipse 3.2
- build-213.xml Build files for Eclipse 2.1.3
- p4wsad.properties This specifies plug-in specific properties.

[edit]

## Steps to Run script

goto top level directory. run following command:

     ant -buildfile build-32.xml

This will generate full distribution file under directory ./build/site and perform junit tests. Result of junit tests will be stored in the './build/results'.

To run build and test for Eclipse 2.1.3. Type command:

    and -buildfile build-213.xml

Retrieved from "http://localhost/index.php/Automating_PWSAD_Plug-in_build"

##### Views

- Article
- Discussion
- Edit
- History

##### Personal tools

- Log in / create account

##### Search

##### Toolbox

- What links here
- Related changes
- Upload file
- Special pages
- Printable version
- Permanent link