Core project set related tasks

Describes the usage of the core project set related tasks.

<executeProjectSet>

Scope: All Project Types

Description

The executeProjectSet task allows you iterate over a set of projects. The project set can be defined using a (comma separated) list of projects or a team project set file.

With the nested forEachProject element you can execute tasks for each project that is defined in the project set. The build order of the contained projects are computed automatically.

Arguments

The executeProjectSet task provides the following arguments:

Argument Description Required
workspaceDirectory Absolute path of the workspace directory Either 'workspaceDirectory' or 'workspaceId' has to be specified
workspaceId The identifier of a defined workspace (see <workspaceDefinition>) Either 'workspaceDirectory' or 'workspaceId' has to be specified
projectNames comma separated list of project names either 'projectNames' or 'teamProjectSet' has to be specified
teamProjectSet name of an eclipse team project set file either 'projectNames' or 'teamProjectSet' has to be specified
pathSeparator The system-dependent path-separator character. This character is used to separate filenames in a sequence of files. no (default: On UNIX systems, this character is ':'; on Microsoft Windows systems it is ';')
dirSeparator The system-dependent default name-separator character. no (default: On UNIX systems the value of this field is '/'; on Microsoft Windows systems it is '\')
allWorkspaceProjects If set to true all projects in the workspace will be added to the set of projects. Otherwise only those projects are taken into account that are defined either in a team project set file or in the projectNames attribute. either 'allProject' or 'teamProjectSet' or 'projectNames' has to be specified
resolveBuildOrder If set to true the build order of the specified projects will be resolved. no (default: true)
projectReferenceTypes Projects can have references of different types. With the projectReferenceTypes you can define, which kind of reference should be taken into account while computing the build order. Currently the following values are possible: jdt, platform. no (default: all available reference types)
prefix the prefix for all scoped properties and references no (default: executeProjectSet)

Nested Elements

To iterate over the projects defined in the executeProjectSet task, you can define one or more nested elements. Those elements can contain several task calls, similar to a target element. The following elements are defined:

  • forEachProject: executed for each project

Scoped properties

Several properties and references are "passed in", so you can access them within the forEachProject element. The following scoped properties are available:

Property Description
<prefix>.project.name The name of the project
<prefix>.project.directory Absolute path of the project directory
<prefix>.<project nature name> true (this property is set for each project nature the project contains)

Scoped references

The following scoped references are available:

Reference Description
<prefix>.project.directory.path The project directory as an ant path

Example usage

Working with project set files

The following example shows how to iterate over a project set defined by a team project set file (projectSet.psf):

<ant4eclipse:executeProjectSet workspace="${workspace}"
		               teamprojectset="projectSet.psf" >
 
  <ant4eclipse:forEachProject>
    <echo>${executeProjectSet.project.name}</echo>
  </ant4eclipse:forEachProject>
 
</ant4eclipse:executeProjectSet>

The following example only iterates over the java projects of the team project set:

<ant4eclipse:executeProjectSet workspaceDirectory="${workspace}"
		               teamprojectset="projectSet.psf" >
 
  <ant4eclipse:forEachProject filter="(executeProjectSet.org.eclipse.jdt.core.javanature=*)" >
    <echo>${executeProjectSet.project.name}</echo>
  </ant4eclipse:forEachProject>
 
</ant4eclipse:executeProjectSet>

Defining a project set by a list of project names

The following example shows how to iterate over a project set defined by all projects defined in the workspace:

<ant4eclipse:executeProjectSet workspaceDirectory="${workspace}"
		               projectNames="simpleProject, secondProject" >
 
  <ant4eclipse:forEachProject>
    <echo>${executeProjectSet.project.name}</echo>
  </ant4eclipse:forEachProject>
 
</ant4eclipse:executeProjectSet>

Choosing all projects within a workspace

The following example shows how to iterate over a project set defined by all projects defined in the workspace.

<ant4eclipse:executeProjectSet workspaceDirectory="${workspace}"
		               allWorkspaceProjects="true" >
 
  <ant4eclipse:forEachProject>
    <echo>${executeProjectSet.project.name}</echo>
  </ant4eclipse:forEachProject>
 
</ant4eclipse:executeProjectSet>

<getBuildOrder>

Scope: All Project Types

Description

The getBuildOrder task computes the order in which projects of a workspace must be built. The task requires either a Team Project Set file containing the projects or a property with a list of project names to be computed. The project set resp. the project names must contain all needed projects. If a project that is referenced by a project listed in the project set or in projectNames is not included, the task will fail. All projects that are needed to compute the build order must exist in the workspace, otherwise the task will fail.

Arguments

The getBuildOrder task provides the following arguments:

Argument Description Required
workspaceDirectory Absolute path of the workspace directory Either 'workspaceDirectory' or 'workspaceId' has to be specified
workspaceId The identifier of a defined workspace (see <workspaceDefinition>) Either 'workspaceDirectory' or 'workspaceId' has to be specified
buildOrderProperty The name of a property that will hold the computed build order yes
teamProjectSet The location of a team project set file that contains the projects either 'allProject' or 'teamProjectSet' or 'projectNames' has to be specified
projectNames A list with names of projects that should be ordered either 'allProject' or 'teamProjectSet' or 'projectNames' has to be specified
allWorkspaceProjects If set to true the build order of all projects in the workspace will be computed. Otherwiseonly those projects are taken into account that are defined either in a team project set file or in the projectNames attribute. either 'allProject' or 'teamProjectSet' or 'projectNames' has to be specified
projectReferenceTypes Projects can have references of different types. With the projectReferenceTypes you can define, which kind of reference should be taken into account while computing the build order. Currently the following values are possible: jdt, platform. no (default: all available reference types)

Example usage

The following example computes the build order of all the projects contained in the team project set projectSet.psf:

<getBuildOrder workspace="${workspaceDir}"
               teamprojectset="projectSet.psf"
               buildOrderProperty="test" />

<cvsGetProjectSet>

Scope: All Project Types

Description

Use the cvsGetProjectSet task to automatically check out all projects defined in a team project set. The cvsGetProjectSet requires the name of a Team Project Set file and a destination directory into which the projects will be checked out. Furthermore you need to specify a username and a password for CVS. Ant4eclipse then checks out all projects listed in the file in the version / from the branch that is mentioned in the file.

Arguments

The cvsGetProjectSet task provides the following arguments:

Argument Description Required
workspaceDirectory Absolute path of the workspace directory Either 'workspaceDirectory' or 'workspaceId' has to be specified
workspaceId The identifier of a defined workspace (see <workspaceDefinition>) Either 'workspaceDirectory' or 'workspaceId' has to be specified
projectset Project Set File that defines the projects to be checked out yes
cvsUser User for CVS-connection yes
cvsPwd Password for CVS-connection yes
command Determine whether the project set should be checked out, updated or exported. You can use one of the following values:
  • checkout: Checks out the complete projects from CVS (cvs co)
  • update: Updates the projects: receive/remove changed files only (cvs update)
  • export: Like checkout, but removes the CVS directories, so the checked out projects have no connection to CVS anymore (cvs export)
yes

Example usage

The following example shows how to checkout projects defined in a team project set:

<cvsGetProjectSet cvsUser="myCvsUserId"
                  cvsPwd="myCvsPassword"
                  command="checkout"
                  projectSet="myProjectSet.psf"
                  workspace="${workspace.dir}" />

<svnGetProjectSet>

Scope: All Project Types

Description

Use the svnGetProjectSet task to automatically check out all projects defined in a subversion-based team project set. The svnGetProjectSet requires the name of a Team Project Set file and a destination directory into which the projects will be checked out. Furthermore you may need to specify a username and a password for SVN, that depends on your repository. Ant4eclipse will check out all projects listed in the file in the version / from the branch that is speciified in the file.

Arguments

Argument Description Required
workspaceDirectory Absolute path of the workspace directory Either 'workspaceDirectory' or 'workspaceId' has to be specified
workspaceId The identifier of a defined workspace (see <workspaceDefinition>) Either 'workspaceDirectory' or 'workspaceId' has to be specified
projectset Project Set File that defines the projects to be
checked out
yes
username User for SVN-connection no
password Password for SVN-connection no
command Determine whether the project set should be checked
out, updated or exported
yes (one of: checkout, export or update)
javahl Determines whether the svn-Task should try to use the (native) javahl library no (defaults to 'true')
javasvn Determines whether the svn-Task should try to use the pure-java SVN binding (svnkit) no (defaults to 'true')
dateFormatter formatter definition used to format/parse dates (e.g. when revision is specified as date). no
dateTimeZone time zone used to format/parse dates (e.g. when revision is specified as date). no

The svnGetProjectSet-Tasks takes a command argument that detemines how a project will be received from the CVS repository:

  • checkout: Checks out the complete projects from SVN (svn checkout)
  • update: Updates the projects: receive/remove changed files only (svn checkout)
  • export: Like checkout, but removes the .SVN directories, so the checked out projects have no connection to SVN anymore (svn export)

Setup

  1. In order to use the svnGetProjectSet task you must have svn-ant installed, which can be obtained from http://subclipse.tigris.org/svnant.html. Ant4Eclipse is built and tested against the 1.1.0-RC2 version of svn-ant.
  2. You'll need to have the jar files shipped with svn-ant in one of your Ant lib-directories (i.e. a directory you'll point ant with "-lib" to). Note: You can not use the classpath elements in the taskdef (see below) for svn-ant since that results in a ClassCastException due to Classloader mismatch.
  3. You'll need to add a taskdef element to your build file to make Ant (and Ant4Eclipse) aware of the svn-Task (that is used internally by Ant4Eclipse): &lt;taskdef resource="org/tigris/subversion/svnant/svnantlib.xml"/&gt;

Providers

The svnGetProjectSetTask has been tested with PSF-files exported by the Subclipse and the Subversive plugins. If you'll discover any problems with a PSF file please send us the PSF file and information which plugin you used to export it (including the plugin's version!)

Examples

The following example shows how to checkout projects defined in a team project set. Note that it is required to have ant4eclipse.jar as well as the jars from the svn-ant-Project in your classpath (see "Setup" above):

<project name="..." default="...">
 
  <!-- define Ant4Eclipse tasks -->
  <taskdef uri="antlib:org.ant4eclipse" resource="org/ant4eclipse/antlib.xml" />
 
  <!-- define svnant tasks -->
  <taskdef resource="org/tigris/subversion/svnant/svnantlib.xml" />
 
  <target name="checkout-psf">
    <!-- Check out the contents of "myProjectSet.psf" into the directory "${workspace.dir}" -->
    <ant4eclipse:svnGetProjectSet username="myCvsUserId"
                                  password="myCvsPassword"
                                  command="checkout"
                                  projectSet="myProjectSet.psf"
                                  workspace="${workspace.dir}">
 
  </target>
</project>