Adding the pluginbuilder files that are used in the nightly build process.
[phpeclipse.git] / utilities / pluginbuilder / build-files / customTargets.xml
1 <project name="Build specific targets and properties" default="noDefault">\r
2         <condition property="isNightlyBuild">\r
3                 <equals arg1="${buildType}" arg2="N" />\r
4         </condition>\r
5         <condition property="isNightlyOrIntegrationBuild">\r
6                 <or>\r
7                         <equals arg1="${buildType}" arg2="N" />\r
8                         <equals arg1="${buildType}" arg2="I" />\r
9                 </or>\r
10         </condition>\r
11         \r
12         <property file="${buildHome}/pluginbuilder.config" />\r
13         \r
14         <property file="${buildDirectory}/version.properties" />\r
15         <property name="buildLabel" value="${buildType}-${version.full}" />\r
16         <property name="buildId" value="${version.full}" />\r
17         \r
18         <condition property="isCVSOrCopy" value="true">\r
19                 <or>\r
20                         <equals arg1="${pluginbuilder.is.cvs}" arg2="true"/>\r
21                         <equals arg1="${pluginbuilder.is.copy}" arg2="true"/>\r
22                 </or>\r
23         </condition>\r
24         <condition property="isSVN" value="true">\r
25                 <equals arg1="${pluginbuilder.is.svn}" arg2="true"/>\r
26         </condition>\r
27         <condition property="isRunTests" value="true">\r
28                 <equals arg1="${pluginbuilder.is.runtests}" arg2="true"/>\r
29         </condition>\r
30         \r
31         \r
32         <target name="allElements">\r
33                 <condition property="isFetch" value="true">\r
34                         <equals arg1="${target}" arg2="fetchElement"/>\r
35                 </condition>\r
36             <condition property="is.svn.fetch" value="true">\r
37                         <and>\r
38                                 <equals arg1="${target}" arg2="fetchElement"/>\r
39                                 <equals arg1="${pluginbuilder.is.svn}" arg2="true"/>\r
40                         </and>\r
41             </condition>\r
42         \r
43                 <antcall target="allElementsExceptSvnFetch"/>\r
44                 <antcall target="fetchSubversion"/>\r
45         </target>\r
46         \r
47         <import file="allElements.xml"/>\r
48         <import file="subversionSupport.xml"/>\r
49         \r
50         \r
51         <!-- ===================================================================== -->\r
52         <!-- Check out map files from correct repository -->\r
53         <!-- Replace values for cvsRoot, package and mapVersionTag as desired. -->\r
54         <!-- ===================================================================== -->\r
55         <target name="getMapFiles" if="isCVSOrCopy">\r
56                 <echo message="Copying map files."/>\r
57                 <copy todir="${buildDirectory}/maps">\r
58                         <fileset dir="${buildHome}/maps" includes="*.map"></fileset>\r
59                 </copy>\r
60         </target>\r
61         \r
62         <!-- ===================================================================== -->\r
63         <!-- Steps to do before setup -->\r
64         <!-- ===================================================================== -->\r
65         <target name="preSetup" if="${product}">        \r
66                 <copy todir="${buildDirectory}" file="${buildHome}/${product}"/> \r
67         </target>\r
68         <!-- ===================================================================== -->\r
69         <!-- Steps to do after setup but before starting the build proper -->\r
70         <!-- ===================================================================== -->\r
71         <target name="postSetup">\r
72         </target>\r
73         <!-- ===================================================================== -->\r
74         <!-- Steps to do before fetching the build elements -->\r
75         <!-- ===================================================================== -->\r
76         <target name="preFetch">\r
77         </target>\r
78         <!-- ===================================================================== -->\r
79         <!-- Steps to do after fetching the build elements -->\r
80         <!-- ===================================================================== -->\r
81         <target name="postFetch">\r
82                 <condition property="is.fetch" value="true">\r
83                         <available file="${buildDirectory}/plugins"/>\r
84                 </condition>\r
85                 <fail unless="is.fetch" message="There was no plug-in fetched. Was the configuration generated? Is the repository correct?"/>\r
86                 <antcall target="replaceVersions"/>             \r
87         </target>\r
88         \r
89         <target name="replaceVersions">\r
90                 <fail unless="version.full" message="Property version.full must be set" />\r
91                 <fail unless="version.qualifier" message="Property version.qualifier must be set" />\r
92         \r
93                 <echo message="Updating versions in feature and plugin manifests. Full version: ${version.full}, qualifier: ${version.qualifier}"/>\r
94                 <!-- make sure to select the test feature file as well -->\r
95                 <replace dir="${buildDirectory}/features">\r
96                         <include name="**/feature.xml"/>\r
97                         <!-- adding the greater than on the right side is only a dirty trick to replace only the feature version -->\r
98                         <replacefilter token="version=&quot;0.0.0&quot;>" value="version=&quot;${version.full}&quot;>" />\r
99                         <replacefilter token="qualifier" value="${version.qualifier}" />\r
100                         <replacefilter token="phpeclipse.release_eclipse.version" value="${phpeclipse_build_target}" />\r
101                 </replace>\r
102                 <!-- in a manual build started with export from the feature.xml, there is no\r
103                         need to replace the versions in the plugin.xml files if they are set to 0.0.0,\r
104                         but here it needs to be -->\r
105                 <replace dir="${buildDirectory}/plugins">\r
106                         <include name="**/plugin.xml"/>\r
107                         <replacefilter token="0.0.0" value="${version.full}" />\r
108                 </replace>\r
109                 <replace dir="${buildDirectory}/plugins">\r
110                         <include name="**/META-INF/MANIFEST.MF"/>\r
111                         <replacefilter token="Bundle-Version: 0.0.0" value="Bundle-Version: ${version.full}" />\r
112                         <replacefilter token="qualifier" value="${version.qualifier}" />\r
113                 </replace>\r
114         </target>       \r
115         <!-- ===================================================================== -->\r
116         <!-- Steps to do before generating the build scripts. -->\r
117         <!-- ===================================================================== -->\r
118         <target name="preGenerate">\r
119                 <!-- fail unless="featureVersion" message="Property featureVersion must be set.\r
120                  Either directly or in case of a nightly build with nightlyBuildFeatureVersionPrefix." />\r
121                  -->\r
122         </target>\r
123         <!-- ===================================================================== -->\r
124         <!-- Steps to do after generating the build scripts. -->\r
125         <!-- ===================================================================== -->\r
126         <target name="postGenerate">\r
127         </target>\r
128         <!-- ===================================================================== -->\r
129         <!-- Steps to do before running the build.xmls for the elements being built. -->\r
130         <!-- ===================================================================== -->\r
131         <target name="preProcess">\r
132         </target>\r
133         <!-- ===================================================================== -->\r
134         <!-- Steps to do after running the build.xmls for the elements being built. -->\r
135         <!-- ===================================================================== -->\r
136         <target name="postProcess">\r
137         </target>\r
138         <!-- ===================================================================== -->\r
139         <!-- Steps to do before running assemble. -->\r
140         <!-- ===================================================================== -->\r
141         <target name="preAssemble">\r
142         </target>\r
143         <!-- ===================================================================== -->\r
144         <!-- Steps to do after  running assemble. -->\r
145         <!-- ===================================================================== -->\r
146         <target name="postAssemble">\r
147         </target>\r
148         <!-- ===================================================================== -->\r
149         <!-- Steps to do before/after packaging RCP. -->\r
150         <!-- ===================================================================== -->\r
151         <target name="prePackage">\r
152         </target>\r
153         <target name="postPackage">\r
154         </target>\r
155 \r
156         <!-- ===================================================================== -->\r
157         <!-- Steps to do after the build is done. -->\r
158         <!-- ===================================================================== -->\r
159         <property name="buildResultsDirectory" value="${buildDirectory}/results" />\r
160         <target name="postBuild" depends="-prepareBuildResultsDirectory" unless="no.postBuild">\r
161                 <antcall target="runTests"/>\r
162                 <copy todir="${buildResultsDirectory}" flatten="true">\r
163                         <fileset dir="${buildDirectory}" includes="${buildType}-**/*.zip" />\r
164                 </copy>\r
165                 <condition property="is.External.Postbuild">\r
166                         <available file="${buildHome}/build-files/postBuild.xml"/>\r
167                 </condition>\r
168                 <antcall target="callExternalPostBuild"/>\r
169         </target>\r
170         <!-- ===================================================================== -->\r
171         <!-- Run tests. -->\r
172         <!-- ===================================================================== -->\r
173         <target name="runTests" if="isRunTests">\r
174                 <property name="automatedTestsHome" location="${buildHome}/build-files/automatedTests"/>\r
175 \r
176                 <ant antfile="${automatedTestsHome}/run-tests.xml" target="run" dir="${automatedTestsHome}">\r
177                         <property name="test.result.dir" value="${buildResultsDirectory}/testresults"/>\r
178                 </ant>\r
179         </target>       \r
180         <!--======================================================-->\r
181         <!-- Gather build results  -->\r
182         <!-- ==================================================== -->\r
183         <target name="-prepareBuildResultsDirectory">\r
184                 <echo message="Creating ${buildResultsDirectory}" />\r
185                 <mkdir dir="${buildResultsDirectory}" />        \r
186         </target>\r
187 \r
188         <!--======================================================-->\r
189         <!-- Call External post build file if available -->\r
190         <!-- ==================================================== -->\r
191         <target name="callExternalPostBuild" if="is.External.Postbuild">\r
192                 <ant antfile="${buildHome}/build-files/postBuild.xml"/>\r
193         </target>\r
194         \r
195         <target name="noDefault">\r
196                 <echo message="You must specify a target when invoking this file" />\r
197         </target>\r
198 </project>\r