1<!--
2     Copyright (c) 2003, 2009 IBM Corporation and others.
3     All rights reserved. This program and the accompanying materials
4     are made available under the terms of the Eclipse Public License v1.0
5     which accompanies this distribution, and is available at
6     http://www.eclipse.org/legal/epl-v10.html
7
8     Contributors:
9         IBM Corporation - initial API and implementation
10 -->
11<project name="Build All Elements" default="main">
12
13<!-- ===================================================================== -->
14<!-- Global properties.  See the build.properties for information on -->
15<!-- the properties which callers can control. -->
16<!-- ===================================================================== -->
17<property name="builder" location="${user.dir}"/>
18<property name="builderDirectory" location="${builder}"/>
19<property name="buildProperties" location="${builder}/build.properties"/>
20<property file="${buildProperties}"/>
21<available property="customTargets" file="${builder}/customTargets.xml" value="${builder}/customTargets.xml"/>
22<property name="customTargets" location="${eclipse.pdebuild.templates}/headless-build/customTargets.xml"/>
23<property name="genericTargets" location="${eclipse.pdebuild.scripts}/genericTargets.xml"/>
24
25<!-- ===================================================================== -->
26<!-- main entry point to setup, fetch, generate, build etc. Use -->
27<!-- the customTargets.xml to modify the build behaviour. -->
28<!-- ===================================================================== -->
29
30<!-- ******* add in the descriptions for each of the top level targets to teh target decl -->
31<target name="main" description="the main build target">
32  	<antcall target="preBuild" />
33	<antcall target="processRepos"/>
34 	<antcall target="fetch" />
35	<antcall target="generate" />
36	<antcall target="process" />
37	<antcall target="assemble" />
38	<antcall target="package" />
39	<antcall target="postBuild" />
40</target>
41
42<!-- ===================================================================== -->
43<!-- Steps to do before starting the build.  Typical setup includes -->
44<!-- fetching the map files and building the directory.  -->
45<!-- ===================================================================== -->
46<target name="preBuild">
47	<mkdir dir="${buildDirectory}" />
48	<ant antfile="${customTargets}" target="preSetup" />
49	<ant antfile="${customTargets}" target="getMapFiles" />
50	<concat destfile="${buildDirectory}/directory.txt" fixlastline="yes">
51		<fileset dir="${buildDirectory}" includes="maps/**/*.map"/>
52	</concat>
53	<ant antfile="${customTargets}" target="postSetup" />
54</target>
55
56<!-- ===================================================================== -->
57<!-- This will transform the content of the repositories listed such that they   -->
58<!-- are in a format against which PDE Build can succesfully build   -->
59<!-- ===================================================================== -->
60<target name="processRepos" if="repoBaseLocation">
61	<subant target="preProcessRepos" failonerror="false" inheritAll="true" >
62		<fileset file="${customTargets}" />
63	</subant>
64	<ant antfile="${customTargets}" target="allElements">
65		<property name="target" value="transformRepos" />
66	</ant>
67	<subant target="postProcessRepos" failonerror="false" inheritAll="true" >
68		<fileset file="${customTargets}" />
69	</subant>
70</target>
71
72<!-- ===================================================================== -->
73<!-- Fetch the elements identified in the customTargets -->
74<!-- ===================================================================== -->
75<target name="fetch" unless="skipFetch">
76	<ant antfile="${customTargets}" target="preFetch"/>
77	<!-- Generates and then execute the fetch scripts for each build element-->
78	<ant antfile="${customTargets}" target="allElements">
79		<property name="target" value="fetchElement" />
80	</ant>
81
82	<ant antfile="${customTargets}" target="postFetch"/>
83</target>
84
85<!-- ===================================================================== -->
86<!-- Generate the build scripts for each element identified in the customTargets -->
87<!-- ===================================================================== -->
88<target name="generate">
89	<ant antfile="${customTargets}" target="preGenerate"/>
90	<!-- Generate the build.xml for each build element-->
91	<ant antfile="${customTargets}" target="allElements">
92		<property name="target" value="generateScript" />
93	</ant>
94	<ant antfile="${customTargets}" target="postGenerate"/>
95</target>
96
97<!-- ===================================================================== -->
98<!-- Run the build scripts for each element identified in the customTargets -->
99<!-- ===================================================================== -->
100<target name="process">
101	<!-- Run custom tasks before processing, i.e. creating source build zip files -->
102	<ant antfile="${customTargets}" target="preProcess" />
103
104	<!-- Process all of the build elements-->
105	<ant antfile="${customTargets}" target="allElements">
106		<property name="target" value="processElement" />
107	</ant>
108
109	<!-- Run custom tasks after compiling, i.e. reporting compile errors -->
110	<ant antfile="${customTargets}" target="postProcess" />
111</target>
112
113<!-- ===================================================================== -->
114<!-- Assemble the build elements into final distributions -->
115<!-- ===================================================================== -->
116<target name="assemble">
117	<ant antfile="${customTargets}" target="preAssemble"/>
118	<ant antfile="${customTargets}" target="allElements">
119		<property name="target" value="assembleElement"/>
120	</ant>
121	<ant antfile="${customTargets}" target="postAssemble"/>
122</target>
123
124<!-- ===================================================================== -->
125<!-- Package the build elements into final distributions -->
126<!-- ===================================================================== -->
127<target name="package" if="runPackager">
128	<ant antfile="${customTargets}" target="prePackage"/>
129	<ant antfile="${customTargets}" target="allElements">
130		<property name="target" value="packageElement"/>
131	</ant>
132	<ant antfile="${customTargets}" target="postPackage"/>
133</target>
134
135<!-- ===================================================================== -->
136<!-- Do any steps required after the build (e.g., posting, testing, ...) -->
137<!-- ===================================================================== -->
138<target name="postBuild">
139	<ant antfile="${customTargets}" target="postBuild" />
140</target>
141
142<!-- ===================================================================== -->
143<!-- Clean the build elements.  This target is here as an entry -->
144<!-- point to the customTargets.  It is not called directly in the normal -->
145<!-- course of events. -->
146<!-- ===================================================================== -->
147<target name="clean">
148  <ant antfile="${customTargets}" target="allElements">
149     <property name="target" value="cleanElement"/>
150  </ant>
151</target>
152
153</project>
154