Compilation Order and Parallelization

By default, PDE/Build compiles plug-ins by delegating through the feature structure. Features are visited depth first, the plug-ins within each feature are compiled in dependency-order (as determined by the OSGi resolver).

This means that all dependencies of a given bundle must contained in the same feature, or in a feature that appears earlier in the depth-first traversal of the feature inclusion hierarchy. This can make it difficult to organize your features.

Flattening Dependencies

New in 3.5 is a builder property flattenDependencies. Setting this property to true will cause PDE/Build to instead sort all plug-ins regardless accross feature boundaries. PDE/Build will then generate a new build script compile.<feature>.xml which lists all plug-ins in order sorted by their dependencies. This allows you to partition your bundles into different features according to their functionality without worrying about their inter-dependencies.

Parallel Compilation

If flattenDependencies is specified, then PDE/Build is then able to compile bundles in parallel. It does this by partitioning the sorted list of bundles into groups where each group contains bundles that depend only on bundles in earlier groups.

Each group is then wrapped in an Ant <parallel> task. The following properties control the parallelization behaviour:

parallelCompilationSet to true to enable parallel compilation. (Requires flattenDependencies=true)
parallelThreadCountThe maximum number of threads to use. Default is 3. Corresponds to threadCount on the ant parallel task.
parallelThreadsPerProcessorThe maximum number of threads to use per available processor. Corresponds to threadsPerProcessor on the ant parallel task.

The resulting compile script that gets generated then looks something like this:

  <project name="Compile master" default="main">
     <target name="main">
        <parallel threadsPerProcessor='3'>
             <ant antfile="build.xml" dir="plugins/org.eclipse.osgi" target="build.jars"/>
        <parallel threadsPerProcessor='3'>
             <ant antfile="build.xml" dir="plugins/org.eclipse.equinox.common" target="build.jars"/>
             <ant antfile="build.xml" dir="plugins/org.eclipse.equinox.p2.jarprocessor" target="build.jars"/>
        <parallel threadsPerProcessor='3'>
             <ant antfile="build.xml" dir="plugins/org.eclipse.update.configurator" target="build.jars"/>
             <ant antfile="build.xml" dir="plugins/org.eclipse.equinox.simpleconfigurator" target="build.jars"/>
             <ant antfile="build.xml" dir="plugins/org.eclipse.equinox.frameworkadmin" target="build.jars"/>
             <ant antfile="build.xml" dir="plugins/" target="build.jars"/>
             <ant antfile="build.xml" dir="plugins/org.eclipse.core.databinding.observable" target="build.jars"/>
             <ant antfile="build.xml" dir="plugins/org.eclipse.swt" target="build.jars"/>