move to improved p2 functions
diff --git a/releng.wtpbuilder/components/wtp-patches312-tests/allElements.xml b/releng.wtpbuilder/components/wtp-patches312-tests/allElements.xml
new file mode 100644
index 0000000..0bb5016
--- /dev/null
+++ b/releng.wtpbuilder/components/wtp-patches312-tests/allElements.xml
@@ -0,0 +1,52 @@
+<project name="allElements Delegator">
+	<property name="defaultAssemblyEnabled" value="true" />
+	
+ 	<!-- ===================================================================== 	-->
+ 	<!-- Run a given ${target} on all elements being built						-->
+ 	<!-- By default ${topLevelElementType} and ${topLevelElementId} should be	--> 
+ 	<!-- defined in the builder's build.properties file.  You can customize by	--> 
+ 	<!-- setting the type/id values directly here.								-->
+	<!-- You can add additional calls to ${genericTargets} to build more top 	-->
+	<!-- level elements.									   					-->
+	<!--																		-->
+	<!-- The top level must exist in the ${buildDirectory}, ${baseLocation} or	-->
+	<!-- ${pluginPath} locations.												-->
+ 	<!-- ===================================================================== 	-->
+ 	<target name="allElementsDelegator">
+ 		<ant antfile="${genericTargets}" target="${target}">
+	 		<property name="type" value="${topLevelElementType}" />
+	 		<property name="id" value="${topLevelElementId}" />
+ 		</ant>
+ 	</target>
+ 
+	<!-- ====================================================================== -->
+	<!--  The default assemble target, this will be called to assemble each		-->	 
+	<!--  config if a custom assemble target is not defined.					-->
+	<!-- The following properties will be defined:								-->
+	<!-- 		config : The configuration being assembled eg "win32.win32.x86"	-->
+	<!-- 		element: The element being assembled eg "org.eclipse.sdk"		-->
+	<!-- 		assembleScriptName: The assemble script to be called			-->
+	<!-- ====================================================================== -->
+	<target name="defaultAssemble">
+		<ant antfile="${assembleScriptName}" dir="${buildDirectory}" />
+	</target>	
+	
+ 	<!-- =====================================================================	-->
+ 	<!-- Custom targets to assemble the built elements for particular 			-->
+ 	<!-- configurations.  These generally call the generated assemble scripts 	-->
+ 	<!-- (named in  ${assembleScriptName}) but may also add pre and post		--> 
+ 	<!-- processing      														-->
+ 	<!-- Add one target for each root element and each configuration for which	--> 
+ 	<!-- custom processing is desired. Replace element.id with the id of the 	-->
+ 	<!-- top level element being built.  A property with a matching name must 	-->
+ 	<!-- be defined for this custom target to be called instead of the 			-->
+ 	<!-- defaultAssemble target above.											-->
+	<!--	Example:  name="assemble.org.eclipse.sdk"							-->
+	<!--	Example:  name="assemble.org.eclipse.sdk.win32.win32.x86"			-->
+ 	<!-- ====================================================================== -->
+	<property name="assemble.element.id[.config.spec]" value="true" />
+ 	<target name="assemble.element.id[.config.spec]">
+ 		<ant antfile="${assembleScriptName}" dir="${buildDirectory}"/>
+ 	</target>
+	
+</project>
diff --git a/releng.wtpbuilder/components/wtp-patches312-tests/build.properties b/releng.wtpbuilder/components/wtp-patches312-tests/build.properties
index 3ae54ad..641a048 100644
--- a/releng.wtpbuilder/components/wtp-patches312-tests/build.properties
+++ b/releng.wtpbuilder/components/wtp-patches312-tests/build.properties
@@ -40,4 +40,7 @@
 
 
 configs = *,*,*
-archivesFormat = *,*,*-zip
\ No newline at end of file
+archivesFormat = *,*,*-zip
+
+topLevelElementId=org.eclipse.wtp.patch.tests.assembly.feature
+topLevelElementType=feature
\ No newline at end of file
diff --git a/releng.wtpbuilder/components/wtp-patches312-tests/customTargets.xml b/releng.wtpbuilder/components/wtp-patches312-tests/customTargets.xml
index cd4945f..60e84a0 100644
--- a/releng.wtpbuilder/components/wtp-patches312-tests/customTargets.xml
+++ b/releng.wtpbuilder/components/wtp-patches312-tests/customTargets.xml
@@ -2,9 +2,6 @@
     name="PDECustomTargets"
     default="noDefault"
     basedir=".">
-    <property
-        name="buildfeature"
-        value="org.eclipse.wtp.patch.tests.assembly.feature"/>
     <!--
         = = = standard properties pattern = = = Note to be
         cross-platform, "environment variables" are only appropriate for
@@ -34,20 +31,26 @@
         message="buildDirectory must be set"/>
     <echo
         message="buildDirectory: ${buildDirectory}"/>
-
-	<!--
-	    <property 
-	       name="p2.build.repo"
-	       value="${buildDirectory}/${buildLabel}/${component}/repository/" />
-	     <mkdir dir="${p2.build.repo}"/>
--->
-	       <echo
-	       message="p2.build.repo: ${p2.build.repo}" />	
-
+    <!--
+        <property name="p2.build.repo"
+        value="${buildDirectory}/${buildLabel}/${component}/repository/"
+        /> <mkdir dir="${p2.build.repo}"/>
+    -->
+    <echo
+        message="p2.build.repo: ${p2.build.repo}"/>
     <!--
         Run a given ${target} on all elements being built Add on <ant>
         task for each top level element being built.
     -->
+    <available
+        property="allElementsFile"
+        file="${builder}/allElements.xml"
+        value="${builder}/allElements.xml"/>
+    <property
+        name="allElementsFile"
+        location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
+    <import
+        file="${allElementsFile}"/>
     <target
         name="allElements">
         <echo
@@ -70,91 +73,20 @@
             message="generic target: ${genericTargets}"/>
         <echo
             level="info"
-            message="buildfeature: ${buildfeature}"/>
+            message="topLevelElementId: ${topLevelElementId}"/>
         <echo
             message="compilerArg: ${compilerArg}"/>
         <echo
-            message="individualSourceBundles: ${individualSourceBundles}"/>
-        <ant
-            antfile="${genericTargets}"
-            target="${target}">
-            <property
-                name="type"
-                value="feature"/>
-            <property
-                name="id"
-                value="${buildfeature}"/>
-        </ant>
+            message="individualSourceBundles: ${individualSourceBundles}"/>        
+        <antcall
+            target="allElementsDelegator"/>
     </target>
-    <!--
-        Targets to assemble the built elements for particular
-        configurations These generally call the generated assemble
-        scripts (named in ${assembleScriptName}) but may also add pre
-        and post processing Add one target for each root element and
-        each configuration
-    -->
-	
-	    <target 
-	       name="assemble.org.eclipse.wtp.patch.tests.assembly.feature.p2">
-	        <property
-	            name="archiveName"
-	            value="wtp-patches-tests-${buildLabel}.zip"/>
-	    	 <echo message="running in p2 assembly: ${assembleScriptName}" />
-	        <ant
-	            antfile="${assembleScriptName}"
-	            dir="${buildDirectory}"/>	    
-	    </target>	
-       <target 
-          name="assemble.org.eclipse.wtp.patch.tests.assembly.feature.group.group.group">
-              <echo message="running in group.group.group assembly: ${assembleScriptName}" />
-              <property
-                   name="archiveName"
-                   value="wtp-patches-tests-${buildLabel}.zip"/>
-               <echo message="running in p2 assembly: ${assembleScriptName}" />
-               <ant
-                   antfile="${assembleScriptName}"
-                   dir="${buildDirectory}"/>
-       </target>	
-    <target
-        name="assemble.org.eclipse.wtp.patch.tests.assembly.feature">
-        <property
-            name="archiveName"
-            value="wtp-patches-tests-${buildLabel}.zip"/>
-        <ant
-            antfile="${assembleScriptName}"
-            dir="${buildDirectory}"/>
-    </target>
-    <target
-        name="prePackage"/>
-    <target
-        name="postPackage">
-        <property
-            name="archiveName"
-            value="wtp-patches-tests-${buildLabel}.zip"/>
-            <!--
-        <ant
-            antfile="${wtp.builder.home}/scripts/build/buildutilities.xml"
-            target="unpackUpdateJarsAndCreateZippedPackages">
-            <property
-                name="buildDirectory"
-                value="${buildDirectory}"/>
-            <property
-                name="buildLabel"
-                value="${buildLabel}"/>
-            <property
-                name="archiveName"
-                value="${archiveName}"/>
-        </ant>
-        -->
-    </target>
-
-
+    
     <!--
         Check out map files from repository
-        -->
+    -->
     <target
         name="getMapFiles">
-
         <!-- for now, get all, at once. May componetize later. -->
         <ant
             antfile="${wtp.builder.home}/scripts/build/maptasks.xml"
@@ -162,7 +94,7 @@
     </target>
 
 
-    <!-- 
+    <!--
         Steps to do before setup
     -->
     <target
@@ -184,7 +116,7 @@
 
         <!-- Get the dependencies -->
         <antcall
-            target="getDependencies"/>
+            target="getDependencies"/>            
     </target>
     <!--
         =====================================================================
@@ -202,23 +134,35 @@
                 name="base.install.dir"
                 value="${buildRoot}"/>
         </ant>
-    </target>
+    </target>    
 
     <!--
       Steps to do before fetching the build elements
     -->
     <target
-        name="preFetch"></target>
-
-    <!-- 
-      Steps to do after fetching the build elements
-    -->
+        name="preFetch"></target>    
     <target
         name="postFetch"></target>
 
-    <!--
-      Steps to do before generating the build scripts.
+
+    <!-- 
+       Steps to do before the repositories are being processed 
     -->
+    
+    <target
+        name="preProcessRepos">
+    </target>
+
+    <!-- 
+       Steps to do after the repositories have been processed 
+    -->
+    <target
+        name="postProcessRepos">
+    </target>
+    
+    <!-- 
+        Steps to do before generating the build scripts. 
+     -->
     <target
         name="preGenerate"></target>
 
@@ -262,23 +206,42 @@
             target="gatherLogs"/>
     </target>
 
-    <!-- 
-    	  Steps to do before running assemble. 
-     -->
+    <!-- Steps to do before running assemble. -->
+ 
     <target
-        name="preAssemble"></target>
+        name="preAssemble">
+    </target>
+ 
+
 
     <!--
       Steps to do after  running assemble.
     -->
     <target
         name="postAssemble"></target>
-
+ 
     <!--
       Steps to do after the build is done.
     -->
     <target
-        name="postBuild"></target>
+        name="prePackage">
+    </target>
+
+    <!-- Steps to do after  running package. -->
+
+    <target
+        name="postPackage">
+    </target>
+ 
+    <!--
+      Steps to do after the build is done.
+    -->
+ 
+    <target
+        name="postBuild">
+        <antcall
+            target="gatherLogs"/>
+    </target>
 
     <!--
       Steps to do to test the build results
@@ -291,7 +254,7 @@
     -->
     <target
         name="publish"></target>
-
+ 
     <!--
       Helper targets
     -->
@@ -299,7 +262,7 @@
         name="gatherLogs"
         if="logsAvailable">
         <mkdir
-            dir="${buildDirectory}/${buildLabel}/testcompilelogs"/>
+            dir="${buildDirectory}/${buildLabel}/compilelogs"/>
         <echo
             level="debug"
             message="logExtension: ${logExtension}"/>
@@ -313,10 +276,10 @@
                 value="${logExtension}"/>
         </antcall>
         <unzip
-            dest="${buildDirectory}/${buildLabel}/testcompilelogs"
+            dest="${buildDirectory}/${buildLabel}/compilelogs"
             overwrite="true">
             <fileset
-                dir="${buildDirectory}/features/${buildfeature}">
+                dir="${buildDirectory}/features/${topLevelElementId}">
                 <include
                     name="**/*.log.zip"/>
             </fileset>
@@ -334,7 +297,7 @@
     </target>
 
     <!--
-      Default target 
+        Default target
     -->
     <target
         name="noDefault">
diff --git a/releng.wtpbuilder/components/wtp-patches312-tests/customTargetsORIG.xml b/releng.wtpbuilder/components/wtp-patches312-tests/customTargetsORIG.xml
new file mode 100644
index 0000000..2219052
--- /dev/null
+++ b/releng.wtpbuilder/components/wtp-patches312-tests/customTargetsORIG.xml
@@ -0,0 +1,345 @@
+<project
+    name="PDECustomTargets"
+    default="noDefault"
+    basedir=".">
+    <property
+        name="topLevelElementId"
+        value="org.eclipse.wtp.patch.tests.assembly.feature"/>
+    <!--
+        = = = standard properties pattern = = = Note to be
+        cross-platform, "environment variables" are only appropriate for
+        some variables, e.g. ones we set, since properties are case
+        sensitive, even if the environment variables on your operating
+        system are not, e.g. it will be ${env.Path} not ${env.PATH} on
+        Windows
+    -->
+    <property
+        environment="env"/>
+    <!--
+        Let users override standard properties, if desired. If
+        directory, file, or some properties do not exist, then standard
+        properties will be used.
+    -->
+    <property
+        file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/>
+
+    <!-- let this project specify properties, if not already set -->
+    <property
+        file="build.properties"/>
+    <fail
+        message="dependency.properties must be specified by distribution script"
+        unless="dependency.properties"/>
+    <fail
+        unless="buildDirectory"
+        message="buildDirectory must be set"/>
+    <echo
+        message="buildDirectory: ${buildDirectory}"/>
+
+	<!--
+	    <property 
+	       name="p2.build.repo"
+	       value="${buildDirectory}/${buildLabel}/${component}/repository/" />
+	     <mkdir dir="${p2.build.repo}"/>
+-->
+	       <echo
+	       message="p2.build.repo: ${p2.build.repo}" />	
+
+    <!--
+        Run a given ${target} on all elements being built Add on <ant>
+        task for each top level element being built.
+    -->
+    <target
+        name="allElements">
+        <echo
+            level="info"
+            message="target: ${target} "/>
+        <echo
+            level="info"
+            message="basedir: ${basedir}"/>
+        <echo
+            level="info"
+            message="component: ${component}"/>
+        <echo
+            level="info"
+            message="buildDirectory: ${buildDirectory}"/>
+        <echo
+            level="info"
+            message="baseLocation: ${baseLocation}"/>
+        <echo
+            level="info"
+            message="generic target: ${genericTargets}"/>
+        <echo
+            level="info"
+            message="topLevelElementId: ${topLevelElementId}"/>
+        <echo
+            message="compilerArg: ${compilerArg}"/>
+        <echo
+            message="individualSourceBundles: ${individualSourceBundles}"/>
+        <ant
+            antfile="${genericTargets}"
+            target="${target}">
+            <property
+                name="type"
+                value="feature"/>
+            <property
+                name="id"
+                value="${topLevelElementId}"/>
+        </ant>
+    </target>
+    <!--
+        Targets to assemble the built elements for particular
+        configurations These generally call the generated assemble
+        scripts (named in ${assembleScriptName}) but may also add pre
+        and post processing Add one target for each root element and
+        each configuration
+    -->
+	
+	    <target 
+	       name="assemble.org.eclipse.wtp.patch.tests.assembly.feature.p2">
+	        <property
+	            name="archiveName"
+	            value="wtp-patches-tests-${buildLabel}.zip"/>
+	    	 <echo message="running in p2 assembly: ${assembleScriptName}" />
+	        <ant
+	            antfile="${assembleScriptName}"
+	            dir="${buildDirectory}"/>	    
+	    </target>	
+       <target 
+          name="assemble.org.eclipse.wtp.patch.tests.assembly.feature.group.group.group">
+              <echo message="running in group.group.group assembly: ${assembleScriptName}" />
+              <property
+                   name="archiveName"
+                   value="wtp-patches-tests-${buildLabel}.zip"/>
+               <echo message="running in p2 assembly: ${assembleScriptName}" />
+               <ant
+                   antfile="${assembleScriptName}"
+                   dir="${buildDirectory}"/>
+       </target>	
+    <target
+        name="assemble.org.eclipse.wtp.patch.tests.assembly.feature">
+        <property
+            name="archiveName"
+            value="wtp-patches-tests-${buildLabel}.zip"/>
+        <ant
+            antfile="${assembleScriptName}"
+            dir="${buildDirectory}"/>
+    </target>
+    <target
+        name="prePackage"/>
+    <target
+        name="postPackage">
+        <property
+            name="archiveName"
+            value="wtp-patches-tests-${buildLabel}.zip"/>
+            <!--
+        <ant
+            antfile="${wtp.builder.home}/scripts/build/buildutilities.xml"
+            target="unpackUpdateJarsAndCreateZippedPackages">
+            <property
+                name="buildDirectory"
+                value="${buildDirectory}"/>
+            <property
+                name="buildLabel"
+                value="${buildLabel}"/>
+            <property
+                name="archiveName"
+                value="${archiveName}"/>
+        </ant>
+        -->
+    </target>
+
+
+    <!--
+        Check out map files from repository
+        -->
+    <target
+        name="getMapFiles">
+
+        <!-- for now, get all, at once. May componetize later. -->
+        <ant
+            antfile="${wtp.builder.home}/scripts/build/maptasks.xml"
+            target="fetchAllMaps"/>
+    </target>
+
+
+    <!-- 
+        Steps to do before setup
+    -->
+    <target
+        name="preSetup"></target>
+    <!--
+        Steps to do after setup but before starting the build proper
+    -->
+    <target
+        name="postSetup">
+        <dirname
+            file="${ant.file}"
+            property="component.dir"/>
+        <echo
+            level="debug"
+            message="ant.file: ${ant.file}"/>
+        <echo
+            level="debug"
+            message="component.dir: ${component.dir}"/>
+
+        <!-- Get the dependencies -->
+        <antcall
+            target="getDependencies"/>
+    </target>
+    <!--
+        =====================================================================
+    -->
+    <!-- Get the dependencies based on releng maps -->
+    <!--
+        =====================================================================
+    -->
+    <target
+        name="getDependencies">
+        <ant
+            antfile="${component.dir}/dependency.xml"
+            target="get">
+            <property
+                name="base.install.dir"
+                value="${buildRoot}"/>
+        </ant>
+    </target>
+
+    <!--
+      Steps to do before fetching the build elements
+    -->
+    <target
+        name="preFetch"></target>
+
+    <!-- 
+      Steps to do after fetching the build elements
+    -->
+    <target
+        name="postFetch"></target>
+
+    <!--
+      Steps to do before generating the build scripts.
+    -->
+    <target
+        name="preGenerate"></target>
+
+    <!-- 
+      Steps to do after generating the build scripts.
+     -->
+    <target
+        name="postGenerate">
+        <echo
+            message="buildDirectory: ${buildDirectory}"/>
+        <customizeAccessRules
+            bundleDirectory="${buildDirectory}/plugins"
+            defaultRules="+org/eclipse/wst/**/*, +org/eclipse/jst/**/*"/>
+    </target>
+    <!--
+        Steps to do before running the build.xmls for the elements being
+        built.
+    -->
+    <target
+        name="preProcess">
+        <replace
+            dir="${buildDirectory}/plugins"
+            value="${timestamp}"
+            token="@build@">
+            <include
+                name="**/about.mappings"/>
+        </replace>
+    </target>
+    <!--
+        Steps to do after running the build.xmls for the elements being
+        built.
+    -->
+    <target
+        name="postProcess">
+        <condition
+            property="logsAvailable">
+            <istrue
+                value="${javacVerbose}"/>
+        </condition>
+        <antcall
+            target="gatherLogs"/>
+    </target>
+
+    <!-- 
+    	  Steps to do before running assemble. 
+     -->
+    <target
+        name="preAssemble"></target>
+
+    <!--
+      Steps to do after  running assemble.
+    -->
+    <target
+        name="postAssemble"></target>
+
+    <!--
+      Steps to do after the build is done.
+    -->
+    <target
+        name="postBuild"></target>
+
+    <!--
+      Steps to do to test the build results
+    -->
+    <target
+        name="test"></target>
+
+    <!--
+      Steps to do to publish the build results
+    -->
+    <target
+        name="publish"></target>
+
+    <!--
+      Helper targets
+    -->
+    <target
+        name="gatherLogs"
+        if="logsAvailable">
+        <mkdir
+            dir="${buildDirectory}/${buildLabel}/testcompilelogs"/>
+        <echo
+            level="debug"
+            message="logExtension: ${logExtension}"/>
+        <antcall
+            target="allElements">
+            <param
+                name="target"
+                value="gatherLogs"/>
+            <param
+                name="logExtension"
+                value="${logExtension}"/>
+        </antcall>
+        <unzip
+            dest="${buildDirectory}/${buildLabel}/testcompilelogs"
+            overwrite="true">
+            <fileset
+                dir="${buildDirectory}/features/${topLevelElementId}">
+                <include
+                    name="**/*.log.zip"/>
+            </fileset>
+        </unzip>
+    </target>
+    <target
+        name="clean"
+        unless="noclean">
+        <antcall
+            target="allElements">
+            <param
+                name="target"
+                value="cleanElement"/>
+        </antcall>
+    </target>
+
+    <!--
+      Default target 
+    -->
+    <target
+        name="noDefault">
+        <echo
+            level="error"
+            message="You must specify a target when invoking this file"/>
+    </target>
+</project>
\ No newline at end of file
diff --git a/releng.wtpbuilder/components/wtp-patches312/allElements.xml b/releng.wtpbuilder/components/wtp-patches312/allElements.xml
new file mode 100644
index 0000000..0bb5016
--- /dev/null
+++ b/releng.wtpbuilder/components/wtp-patches312/allElements.xml
@@ -0,0 +1,52 @@
+<project name="allElements Delegator">
+	<property name="defaultAssemblyEnabled" value="true" />
+	
+ 	<!-- ===================================================================== 	-->
+ 	<!-- Run a given ${target} on all elements being built						-->
+ 	<!-- By default ${topLevelElementType} and ${topLevelElementId} should be	--> 
+ 	<!-- defined in the builder's build.properties file.  You can customize by	--> 
+ 	<!-- setting the type/id values directly here.								-->
+	<!-- You can add additional calls to ${genericTargets} to build more top 	-->
+	<!-- level elements.									   					-->
+	<!--																		-->
+	<!-- The top level must exist in the ${buildDirectory}, ${baseLocation} or	-->
+	<!-- ${pluginPath} locations.												-->
+ 	<!-- ===================================================================== 	-->
+ 	<target name="allElementsDelegator">
+ 		<ant antfile="${genericTargets}" target="${target}">
+	 		<property name="type" value="${topLevelElementType}" />
+	 		<property name="id" value="${topLevelElementId}" />
+ 		</ant>
+ 	</target>
+ 
+	<!-- ====================================================================== -->
+	<!--  The default assemble target, this will be called to assemble each		-->	 
+	<!--  config if a custom assemble target is not defined.					-->
+	<!-- The following properties will be defined:								-->
+	<!-- 		config : The configuration being assembled eg "win32.win32.x86"	-->
+	<!-- 		element: The element being assembled eg "org.eclipse.sdk"		-->
+	<!-- 		assembleScriptName: The assemble script to be called			-->
+	<!-- ====================================================================== -->
+	<target name="defaultAssemble">
+		<ant antfile="${assembleScriptName}" dir="${buildDirectory}" />
+	</target>	
+	
+ 	<!-- =====================================================================	-->
+ 	<!-- Custom targets to assemble the built elements for particular 			-->
+ 	<!-- configurations.  These generally call the generated assemble scripts 	-->
+ 	<!-- (named in  ${assembleScriptName}) but may also add pre and post		--> 
+ 	<!-- processing      														-->
+ 	<!-- Add one target for each root element and each configuration for which	--> 
+ 	<!-- custom processing is desired. Replace element.id with the id of the 	-->
+ 	<!-- top level element being built.  A property with a matching name must 	-->
+ 	<!-- be defined for this custom target to be called instead of the 			-->
+ 	<!-- defaultAssemble target above.											-->
+	<!--	Example:  name="assemble.org.eclipse.sdk"							-->
+	<!--	Example:  name="assemble.org.eclipse.sdk.win32.win32.x86"			-->
+ 	<!-- ====================================================================== -->
+	<property name="assemble.element.id[.config.spec]" value="true" />
+ 	<target name="assemble.element.id[.config.spec]">
+ 		<ant antfile="${assembleScriptName}" dir="${buildDirectory}"/>
+ 	</target>
+	
+</project>
diff --git a/releng.wtpbuilder/components/wtp-patches312/build.properties b/releng.wtpbuilder/components/wtp-patches312/build.properties
index 01cf294..d58733b 100644
--- a/releng.wtpbuilder/components/wtp-patches312/build.properties
+++ b/releng.wtpbuilder/components/wtp-patches312/build.properties
@@ -39,4 +39,7 @@
 p2.gathering=true
 
 configs = *,*,*
-archivesFormat = *,*,*-zip
\ No newline at end of file
+archivesFormat = *,*,*-zip
+
+topLevelElementId=org.eclipse.wtp.patch.assembly.feature
+topLevelElementType=feature
\ No newline at end of file
diff --git a/releng.wtpbuilder/components/wtp-patches312/customTargets.xml b/releng.wtpbuilder/components/wtp-patches312/customTargets.xml
index 6f09650..60e84a0 100644
--- a/releng.wtpbuilder/components/wtp-patches312/customTargets.xml
+++ b/releng.wtpbuilder/components/wtp-patches312/customTargets.xml
@@ -2,9 +2,6 @@
     name="PDECustomTargets"
     default="noDefault"
     basedir=".">
-    <property
-        name="buildfeature"
-        value="org.eclipse.wtp.patch.assembly.feature"/>
     <!--
         = = = standard properties pattern = = = Note to be
         cross-platform, "environment variables" are only appropriate for
@@ -34,20 +31,26 @@
         message="buildDirectory must be set"/>
     <echo
         message="buildDirectory: ${buildDirectory}"/>
-	
-<!--	
-    <property 
-	name="p2.build.repo"
-	value="${buildDirectory}/${buildLabel}/${component}/repository/" />
-     <mkdir dir="${p2.build.repo}"/>
-     -->
-	<echo
-	message="p2.build.repo: ${p2.build.repo}" />
-	
+    <!--
+        <property name="p2.build.repo"
+        value="${buildDirectory}/${buildLabel}/${component}/repository/"
+        /> <mkdir dir="${p2.build.repo}"/>
+    -->
+    <echo
+        message="p2.build.repo: ${p2.build.repo}"/>
     <!--
         Run a given ${target} on all elements being built Add on <ant>
         task for each top level element being built.
     -->
+    <available
+        property="allElementsFile"
+        file="${builder}/allElements.xml"
+        value="${builder}/allElements.xml"/>
+    <property
+        name="allElementsFile"
+        location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
+    <import
+        file="${allElementsFile}"/>
     <target
         name="allElements">
         <echo
@@ -70,98 +73,20 @@
             message="generic target: ${genericTargets}"/>
         <echo
             level="info"
-            message="buildfeature: ${buildfeature}"/>
-       <echo
+            message="topLevelElementId: ${topLevelElementId}"/>
+        <echo
             message="compilerArg: ${compilerArg}"/>
         <echo
-            message="individualSourceBundles: ${individualSourceBundles}"/>
-        <ant
-            antfile="${genericTargets}"
-            target="${target}">
-            <property
-                name="type"
-                value="feature"/>
-            <property
-                name="id"
-                value="${buildfeature}"/>
-        </ant>
+            message="individualSourceBundles: ${individualSourceBundles}"/>        
+        <antcall
+            target="allElementsDelegator"/>
     </target>
+    
     <!--
-        Targets to assemble the built elements for particular
-        configurations These generally call the generated assemble
-        scripts (named in ${assembleScriptName}) but may also add pre
-        and post processing Add one target for each root element and
-        each configuration
-    -->
-	
-    <target 
-    	name="assemble.org.eclipse.wtp.patch.assembly.feature.p2">
-       <echo message="running in p2 assembly: ${assembleScriptName}" />
-
-    	<property
-           name="archiveName"
-           value="wtp-${buildLabel}.zip"/>
-    	
-       <ant
-           antfile="${assembleScriptName}"
-           dir="${buildDirectory}"/>    
-    </target>
-	
-	    <target 
-	       name="assemble.org.eclipse.wtp.patch.assembly.feature.group.group.group">
-	    
-	    	
-	    	<echo message="running in group.group.group assembly: ${assembleScriptName}" />
-	    	       <property
-	    	           name="archiveName"
-	    	           value="wtp-${buildLabel}.zip"/>
-	    	       
-	    	       <ant
-	    	           antfile="${assembleScriptName}"
-	    	           dir="${buildDirectory}"/>    
-
-	    </target>
-		
-    <target
-        name="assemble.org.eclipse.wtp.patch.assembly.feature">
-        <property
-            name="archiveName"
-            value="wtp-${buildLabel}.zip"/>
-        <ant
-            antfile="${assembleScriptName}"
-            dir="${buildDirectory}"/>
-    </target>
-    <target
-        name="prePackage"/>
-    <target
-        name="postPackage">
-        <property
-            name="archiveName"
-            value="wtp-${buildLabel}.zip"/>
-    	<!--
-        <ant
-            antfile="${wtp.builder.home}/scripts/build/buildutilities.xml"
-            target="unpackUpdateJarsAndCreateZippedPackages">
-            <property
-                name="buildDirectory"
-                value="${buildDirectory}"/>
-            <property
-                name="buildLabel"
-                value="${buildLabel}"/>
-            <property
-                name="archiveName"
-                value="${archiveName}"/>
-        </ant>
-        -->
-    </target>
-
-
-    <!-- 
         Check out map files from repository
     -->
     <target
         name="getMapFiles">
-
         <!-- for now, get all, at once. May componetize later. -->
         <ant
             antfile="${wtp.builder.home}/scripts/build/maptasks.xml"
@@ -169,7 +94,7 @@
     </target>
 
 
-    <!-- 
+    <!--
         Steps to do before setup
     -->
     <target
@@ -191,7 +116,7 @@
 
         <!-- Get the dependencies -->
         <antcall
-            target="getDependencies"/>
+            target="getDependencies"/>            
     </target>
     <!--
         =====================================================================
@@ -209,23 +134,35 @@
                 name="base.install.dir"
                 value="${buildRoot}"/>
         </ant>
-    </target>
+    </target>    
 
     <!--
       Steps to do before fetching the build elements
     -->
     <target
-        name="preFetch"></target>
-
-    <!-- 
-      Steps to do after fetching the build elements
-    -->
+        name="preFetch"></target>    
     <target
         name="postFetch"></target>
 
-    <!--
-      Steps to do before generating the build scripts.
+
+    <!-- 
+       Steps to do before the repositories are being processed 
     -->
+    
+    <target
+        name="preProcessRepos">
+    </target>
+
+    <!-- 
+       Steps to do after the repositories have been processed 
+    -->
+    <target
+        name="postProcessRepos">
+    </target>
+    
+    <!-- 
+        Steps to do before generating the build scripts. 
+     -->
     <target
         name="preGenerate"></target>
 
@@ -268,56 +205,43 @@
         <antcall
             target="gatherLogs"/>
     </target>
-    <!--
-        Steps to do before running assemble. Note: in version 2.0 (and
-        previous) we need to build the explorer war file by invoking
-        script. In 3.0 forward, we do not, so this simple existence
-        check allows us to use the same script for both streams
-    -->
-    <property
-        name="buildwarfilename"
-        value="${buildDirectory}/plugins/org.eclipse.wst.ws.explorer/build-war.xml"/>
+
+    <!-- Steps to do before running assemble. -->
+ 
     <target
-        name="preAssemble"
-        depends="buildwar">
+        name="preAssemble">
     </target>
-    <target
-        name="checkForBuildFile">
-        <condition
-            property="buildFileExists">
-            <available
-                file="${buildwarfilename}"/>
-        </condition>
-    </target>
-    <target
-        name="buildwar"
-        depends="checkForBuildFile"
-        if="buildFileExists">
-        <ant
-            antfile="${buildwarfilename}">
-            <property
-                name="baseLocation"
-                value="${baseLocation}"/>
-            <property
-                name="basedir"
-                value="${buildDirectory}/plugins/org.eclipse.wst.ws.explorer"/>
-            <property
-                name="buildDirectory"
-                value="${buildDirectory}"/>
-        </ant>
-    </target>
+ 
+
 
     <!--
       Steps to do after  running assemble.
     -->
     <target
         name="postAssemble"></target>
-
+ 
     <!--
       Steps to do after the build is done.
     -->
     <target
-        name="postBuild"></target>
+        name="prePackage">
+    </target>
+
+    <!-- Steps to do after  running package. -->
+
+    <target
+        name="postPackage">
+    </target>
+ 
+    <!--
+      Steps to do after the build is done.
+    -->
+ 
+    <target
+        name="postBuild">
+        <antcall
+            target="gatherLogs"/>
+    </target>
 
     <!--
       Steps to do to test the build results
@@ -330,7 +254,7 @@
     -->
     <target
         name="publish"></target>
-
+ 
     <!--
       Helper targets
     -->
@@ -355,7 +279,7 @@
             dest="${buildDirectory}/${buildLabel}/compilelogs"
             overwrite="true">
             <fileset
-                dir="${buildDirectory}/features/${buildfeature}">
+                dir="${buildDirectory}/features/${topLevelElementId}">
                 <include
                     name="**/*.log.zip"/>
             </fileset>
@@ -373,7 +297,7 @@
     </target>
 
     <!--
-      Default target 
+        Default target
     -->
     <target
         name="noDefault">
diff --git a/releng.wtpbuilder/components/wtp-patches312/customTargetsORIG.xml b/releng.wtpbuilder/components/wtp-patches312/customTargetsORIG.xml
new file mode 100644
index 0000000..b827d96
--- /dev/null
+++ b/releng.wtpbuilder/components/wtp-patches312/customTargetsORIG.xml
@@ -0,0 +1,357 @@
+<project
+    name="PDECustomTargets"
+    default="noDefault"
+    basedir=".">
+    <property
+        name="topLevelElementId"
+        value="org.eclipse.wtp.patch.assembly.feature"/>
+    <!--
+        = = = standard properties pattern = = = Note to be
+        cross-platform, "environment variables" are only appropriate for
+        some variables, e.g. ones we set, since properties are case
+        sensitive, even if the environment variables on your operating
+        system are not, e.g. it will be ${env.Path} not ${env.PATH} on
+        Windows
+    -->
+    <property
+        environment="env"/>
+    <!--
+        Let users override standard properties, if desired. If
+        directory, file, or some properties do not exist, then standard
+        properties will be used.
+    -->
+    <property
+        file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/>
+
+    <!-- let this project specify properties, if not already set -->
+    <property
+        file="build.properties"/>
+    <fail
+        message="dependency.properties must be specified by distribution script"
+        unless="dependency.properties"/>
+    <fail
+        unless="buildDirectory"
+        message="buildDirectory must be set"/>
+    <echo
+        message="buildDirectory: ${buildDirectory}"/>
+    <!--
+        <property name="p2.build.repo"
+        value="${buildDirectory}/${buildLabel}/${component}/repository/"
+        /> <mkdir dir="${p2.build.repo}"/>
+    -->
+    <echo
+        message="p2.build.repo: ${p2.build.repo}"/>
+    <!--
+        Run a given ${target} on all elements being built Add on <ant>
+        task for each top level element being built.
+    -->
+    <target
+        name="allElements">
+        <echo
+            level="info"
+            message="target: ${target} "/>
+        <echo
+            level="info"
+            message="basedir: ${basedir}"/>
+        <echo
+            level="info"
+            message="component: ${component}"/>
+        <echo
+            level="info"
+            message="buildDirectory: ${buildDirectory}"/>
+        <echo
+            level="info"
+            message="baseLocation: ${baseLocation}"/>
+        <echo
+            level="info"
+            message="generic target: ${genericTargets}"/>
+        <echo
+            level="info"
+            message="topLevelElementId: ${topLevelElementId}"/>
+        <echo
+            message="compilerArg: ${compilerArg}"/>
+        <echo
+            message="individualSourceBundles: ${individualSourceBundles}"/>
+        <ant
+            antfile="${genericTargets}"
+            target="${target}">
+            <property
+                name="type"
+                value="feature"/>
+            <property
+                name="id"
+                value="${topLevelElementId}"/>
+        </ant>
+    </target>
+    <!--
+        Targets to assemble the built elements for particular
+        configurations These generally call the generated assemble
+        scripts (named in ${assembleScriptName}) but may also add pre
+        and post processing Add one target for each root element and
+        each configuration
+    -->
+    <target
+        name="assemble.org.eclipse.wtp.patch.assembly.feature.p2">
+        <echo
+            message="running in p2 assembly: ${assembleScriptName}"/>
+    </target>
+    <target
+        name="assemble.org.eclipse.wtp.patch.assembly.feature.group.group.group">
+        <echo
+            message="running in group.group.group assembly: ${assembleScriptName}"/>
+        <property
+            name="archiveName"
+            value="wtp-${buildLabel}.zip"/>
+        <ant
+            antfile="${assembleScriptName}"
+            dir="${buildDirectory}"/>
+    </target>
+    <target
+        name="assemble.org.eclipse.wtp.patch.assembly.feature">
+        <property
+            name="archiveName"
+            value="wtp-${buildLabel}.zip"/>
+        <ant
+            antfile="${assembleScriptName}"
+            dir="${buildDirectory}"/>
+    </target>
+    <target
+        name="prePackage"/>
+    <target
+        name="postPackage">
+        <property
+            name="archiveName"
+            value="wtp-${buildLabel}.zip"/>
+        <!--
+            <ant
+            antfile="${wtp.builder.home}/scripts/build/buildutilities.xml"
+            target="unpackUpdateJarsAndCreateZippedPackages"> <property
+            name="buildDirectory" value="${buildDirectory}"/> <property
+            name="buildLabel" value="${buildLabel}"/> <property
+            name="archiveName" value="${archiveName}"/> </ant>
+        -->
+    </target>
+
+
+    <!-- 
+        Check out map files from repository
+    -->
+    <target
+        name="getMapFiles">
+
+        <!-- for now, get all, at once. May componetize later. -->
+        <ant
+            antfile="${wtp.builder.home}/scripts/build/maptasks.xml"
+            target="fetchAllMaps"/>
+    </target>
+
+
+    <!-- 
+        Steps to do before setup
+    -->
+    <target
+        name="preSetup"></target>
+    <!--
+        Steps to do after setup but before starting the build proper
+    -->
+    <target
+        name="postSetup">
+        <dirname
+            file="${ant.file}"
+            property="component.dir"/>
+        <echo
+            level="debug"
+            message="ant.file: ${ant.file}"/>
+        <echo
+            level="debug"
+            message="component.dir: ${component.dir}"/>
+
+        <!-- Get the dependencies -->
+        <antcall
+            target="getDependencies"/>
+    </target>
+    <!--
+        =====================================================================
+    -->
+    <!-- Get the dependencies based on releng maps -->
+    <!--
+        =====================================================================
+    -->
+    <target
+        name="getDependencies">
+        <ant
+            antfile="${component.dir}/dependency.xml"
+            target="get">
+            <property
+                name="base.install.dir"
+                value="${buildRoot}"/>
+        </ant>
+    </target>
+
+    <!--
+      Steps to do before fetching the build elements
+    -->
+    <target
+        name="preFetch"></target>
+    <target
+        name="postFetch"></target>
+
+    <!-- 
+       Steps to do before the repositories are being processed 
+    -->
+    
+    <target
+        name="preProcessRepos">
+    </target>
+
+    <!-- 
+       Steps to do after the repositories have been processed 
+    -->
+    <target
+        name="postProcessRepos">
+    </target>
+    <!--
+      Steps to do before generating the build scripts.
+    -->
+    <target
+        name="preGenerate"></target>
+
+    <!-- 
+      Steps to do after generating the build scripts.
+     -->
+    <target
+        name="postGenerate">
+        <echo
+            message="buildDirectory: ${buildDirectory}"/>
+        <customizeAccessRules
+            bundleDirectory="${buildDirectory}/plugins"
+            defaultRules="+org/eclipse/wst/**/*, +org/eclipse/jst/**/*"/>
+    </target>
+    <!--
+        Steps to do before running the build.xmls for the elements being
+        built.
+    -->
+    <target
+        name="preProcess">
+        <replace
+            dir="${buildDirectory}/plugins"
+            value="${timestamp}"
+            token="@build@">
+            <include
+                name="**/about.mappings"/>
+        </replace>
+    </target>
+    <!--
+        Steps to do after running the build.xmls for the elements being
+        built.
+    -->
+    <target
+        name="postProcess">
+        <condition
+            property="logsAvailable">
+            <istrue
+                value="${javacVerbose}"/>
+        </condition>
+        <antcall
+            target="gatherLogs"/>
+    </target>
+
+    <!-- Steps to do before running assemble. -->
+ 
+    <target
+        name="preAssemble">
+    </target>
+
+
+
+    <!--
+      Steps to do after  running assemble.
+    -->
+    <target
+        name="postAssemble"></target>
+
+    <!--
+      Steps to do after the build is done.
+    -->
+    <target
+        name="prePackage">
+    </target>
+
+    <!-- Steps to do after  running package. -->
+
+    <target
+        name="postPackage">
+    </target>
+
+    <!--
+      Steps to do after the build is done.
+    -->
+    <target
+        name="postBuild">
+        <antcall
+            target="gatherLogs"/>
+    </target>
+
+    <!--
+      Steps to do to test the build results
+    -->
+    <target
+        name="test"></target>
+
+    <!--
+      Steps to do to publish the build results
+    -->
+    <target
+        name="publish"></target>
+
+    <!--
+      Helper targets
+    -->
+    <target
+        name="gatherLogs"
+        if="logsAvailable">
+        <mkdir
+            dir="${buildDirectory}/${buildLabel}/compilelogs"/>
+        <echo
+            level="debug"
+            message="logExtension: ${logExtension}"/>
+        <antcall
+            target="allElements">
+            <param
+                name="target"
+                value="gatherLogs"/>
+            <param
+                name="logExtension"
+                value="${logExtension}"/>
+        </antcall>
+        <unzip
+            dest="${buildDirectory}/${buildLabel}/compilelogs"
+            overwrite="true">
+            <fileset
+                dir="${buildDirectory}/features/${topLevelElementId}">
+                <include
+                    name="**/*.log.zip"/>
+            </fileset>
+        </unzip>
+    </target>
+    <target
+        name="clean"
+        unless="noclean">
+        <antcall
+            target="allElements">
+            <param
+                name="target"
+                value="cleanElement"/>
+        </antcall>
+    </target>
+
+    <!--
+      Default target 
+    -->
+    <target
+        name="noDefault">
+        <echo
+            level="error"
+            message="You must specify a target when invoking this file"/>
+    </target>
+</project>
\ No newline at end of file