source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/etc/testcases/taskdefs/optional/dotnet.xml@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 11.4 KB
Line 
1<?xml version="1.0"?>
2
3<project name="dotnet" basedir="." default="init">
4 <property environment="env"/>
5 <property name="build.dir" location="dotnet/build"/>
6 <property name="src.dir" location="dotnet"/>
7
8 <property name="out.csc" location="${src.dir}/out.cs"/>
9 <property name="out.app" location="${build.dir}/out.exe"/>
10 <property name="out.type" value="exe"/>
11
12 <target name="probe_for_apps" >
13 <condition property="ilasm.found">
14 <or>
15 <available file="ilasm" filepath="${env.PATH}" />
16 <available file="ilasm.exe" filepath="${env.PATH}" />
17 <available file="ilasm.exe" filepath="${env.Path}" />
18 </or>
19 </condition>
20 <echo> ilasm.found=${ilasm.found}</echo>
21 <condition property="csc.found">
22 <or>
23 <available file="csc" filepath="${env.PATH}" />
24 <available file="csc.exe" filepath="${env.PATH}" />
25 <available file="csc.exe" filepath="${env.Path}" />
26 </or>
27 </condition>
28 <echo> csc.found=${csc.found}</echo>
29 <!-- visual basic compiler -->
30 <condition property="vbc.found">
31 <or>
32 <available file="vbc" filepath="${env.PATH}" />
33 <available file="vbc.exe" filepath="${env.PATH}" />
34 <available file="vbc.exe" filepath="${env.Path}" />
35 </or>
36 </condition>
37 <echo> vbc.found=${vbc.found}</echo>
38 <!-- visual J# compiler -->
39 <condition property="jsharp.found">
40 <or>
41 <available file="vjc" filepath="${env.PATH}" />
42 <available file="vjc.exe" filepath="${env.PATH}" />
43 <available file="vjc.exe" filepath="${env.Path}" />
44 </or>
45 </condition>
46 <echo> jsharp.found=${jsharp.found}</echo>
47
48 <!-- Mono C# compiler -->
49 <condition property="mcs.found">
50 <available file="mcs" filepath="${env.PATH}" />
51 </condition>
52 <echo> mcs.found=${mcs.found}</echo>
53
54 <!-- any C# compiler -->
55 <condition property="c#.found">
56 <or>
57 <isset property="csc.found"/>
58 <isset property="mcs.found"/>
59 </or>
60 </condition>
61
62 <!-- Mono's ilasm -->
63 <condition property="mono.ilasm.found">
64 <available file="ilasm" filepath="${env.PATH}" />
65 </condition>
66 <echo> mono.ilasm.found=${mono.ilasm.found}</echo>
67
68 <condition property="ildasm.found">
69 <or>
70 <available file="ildasm" filepath="${env.PATH}" />
71 <available file="ildasm.exe" filepath="${env.PATH}" />
72 <available file="ildasm.exe" filepath="${env.Path}" />
73 </or>
74 </condition>
75 <echo> ildasm.found=${ildasm.found}</echo>
76
77 <condition property="dotnetapps.found">
78 <or>
79 <and>
80 <isset property="mcs.found"/>
81 <isset property="mono.ilasm.found"/>
82 </and>
83 <and>
84 <isset property="csc.found"/>
85<!-- <isset property="vbc.found"/> -->
86 <isset property="ilasm.found"/>
87 </and>
88 </or>
89 </condition>
90 <echo> dotnetapps.found=${dotnetapps.found}</echo>
91
92 <condition property="mono.executable" value="mono">
93 <and>
94 <not>
95 <os family="mac"/>
96 </not>
97 <or>
98 <available file="mono" filepath="${env.PATH}" />
99 <available file="mono.exe" filepath="${env.PATH}" />
100 </or>
101 </and>
102 </condition>
103 <property name="mono.executable" value="mint"/>
104
105 <!-- now set a prop of the compiler name to whatever we found -->
106 <condition property="cs.compiler" value="csc">
107 <isset property="csc.found"/>
108 </condition>
109
110 <condition property="cs.compiler" value="mcs">
111 <isset property="mcs.found"/>
112 </condition>
113
114 </target>
115
116 <target name="init" depends="probe_for_apps">
117 <mkdir dir="${build.dir}"/>
118 </target>
119
120 <target name="teardown">
121 <delete dir="${build.dir}"/>
122 </target>
123
124 <target name="validate_csc" depends="init">
125 <fail unless="c#.found">Needed C# compiler is missing</fail>
126 </target>
127
128 <target name="validate_ilasm" depends="init">
129 <fail unless="ilasm.found">Needed ilasm is missing</fail>
130 </target>
131
132 <target name="validate_jsharp" depends="init">
133 <fail unless="jsharp.found">No vjc on the path</fail>
134 </target>
135
136
137 <target name="testCSC" depends="testCSC-Mono,testCSC-MS"/>
138
139 <target name="testCSC-MS" depends="validate_csc" if="csc.found">
140 <property name="testCSC.exe"
141 location="${build.dir}/ExampleCsc.exe" />
142 <csc
143 destFile="${testCSC.exe}"
144 targetType="exe"
145 >
146 </csc>
147 <available property="app.created" file="${testCSC.exe}"/>
148 <fail unless="app.created">No app ${testCSC.exe} created</fail>
149 <exec executable="${testCSC.exe}" failonerror="true" />
150 <delete file="${testCSC.exe}"/>
151 </target>
152
153 <target name="testCSC-Mono" depends="validate_csc" if="mcs.found">
154 <property name="testCSC.exe"
155 location="${build.dir}/ExampleCsc.exe" />
156 <csc
157 destFile="${testCSC.exe}"
158 targetType="exe"
159 includedefaultreferences="true"
160 >
161 </csc>
162 <available property="app.created" file="${testCSC.exe}"/>
163 <fail unless="app.created">No app ${testCSC.exe} created</fail>
164 <exec executable="${mono.executable}" failonerror="true">
165 <arg value="${testCSC.exe}"/>
166 </exec>
167 <delete file="${testCSC.exe}"/>
168 </target>
169
170 <target name="testCSCintrinsicFileset"
171 depends="testCSCintrinsicFileset-MS,testCSCintrinsicFileset-Mono"/>
172
173 <target name="testCSCintrinsicFileset-MS" depends="validate_csc" if="csc.found">
174 <property name="testCSC.exe"
175 location="${build.dir}/ExampleCsc.exe"/>
176 <csc
177 destFile="${testCSC.exe}"
178 targetType="exe"
179 srcDir="."
180 >
181 </csc>
182 <available property="app.created" file="${testCSC.exe}"/>
183 <fail unless="app.created">No app ${testCSC.exe} created</fail>
184 <exec executable="${testCSC.exe}" failonerror="true" />
185 <delete file="${testCSC.exe}"/>
186 </target>
187
188 <target name="testCSCintrinsicFileset-Mono" depends="validate_csc" if="mcs.found">
189 <property name="testCSC.exe"
190 location="${build.dir}/ExampleCsc.exe"/>
191 <csc
192 destFile="${testCSC.exe}"
193 targetType="exe"
194 srcDir="."
195 includedefaultreferences="true"
196 >
197 </csc>
198 <available property="app.created" file="${testCSC.exe}"/>
199 <fail unless="app.created">No app ${testCSC.exe} created</fail>
200 <exec executable="${mono.executable}" failonerror="true">
201 <arg value="${testCSC.exe}"/>
202 </exec>
203 <delete file="${testCSC.exe}"/>
204 </target>
205
206 <target name="testCSCdll" depends="testCSCdll-MS,testCSCdll-Mono"/>
207
208 <target name="testCSCdll-MS" depends="validate_csc" if="csc.found">
209 <property name="testCSC.dll"
210 location="${build.dir}/Example2.dll" />
211 <csc
212 destFile="${testCSC.dll}"
213 targetType="library"
214 executable="csc"
215 >
216 <src dir="${src.dir}" includes="example2.cs"/>
217 </csc>
218 <available property="dll.created" file="${testCSC.dll}"/>
219 <fail unless="dll.created">No file ${testCSC.dll} created</fail>
220 </target>
221
222 <target name="testCSCdll-Mono" depends="validate_csc" if="mcs.found">
223 <property name="testCSC.dll"
224 location="${build.dir}/Example2.dll" />
225 <csc
226 destFile="${testCSC.dll}"
227 targetType="library"
228 includedefaultreferences="true"
229 >
230 <src dir="${src.dir}" includes="example2.cs"/>
231 </csc>
232 <available property="dll.created" file="${testCSC.dll}"/>
233 <fail unless="dll.created">No file ${testCSC.dll} created</fail>
234 </target>
235
236 <target name="testCscReferences"
237 depends="testCscReferences-MS,testCscReferences-Mono"/>
238
239 <target name="testCscReferences-MS" depends="validate_csc,testCSCdll-MS"
240 if="csc.found">
241 <property name="testCscReferences.exe"
242 location="${build.dir}/ExampleCsc2.exe" />
243 <csc
244 destFile="${testCscReferences.exe}"
245 targetType="exe"
246 >
247 <src file="${src.dir}/example.cs"/>
248 <reference file="${testCSC.dll}" />
249 <define name="RELEASE" />
250 <define name="DEBUG" if="undefined.property"/>
251 <define name="def3" unless="undefined.property"/>
252 </csc>
253 <available property="refapp.created" file="${testCscReferences.exe}"/>
254 <fail unless="refapp.created">No app ${testCscReferences.exe} created</fail>
255 <exec executable="${testCscReferences.exe}" failonerror="true" />
256 </target>
257
258 <target name="testCscReferences-Mono" depends="validate_csc,testCSCdll-Mono"
259 if="mcs.found">
260 <property name="testCscReferences.exe"
261 location="${build.dir}/ExampleCsc2.exe" />
262 <csc
263 destFile="${testCscReferences.exe}"
264 targetType="exe"
265 includedefaultreferences="true"
266 >
267 <src file="${src.dir}/example.cs"/>
268 <reference file="${testCSC.dll}" />
269 <define name="RELEASE" />
270 <define name="DEBUG" if="undefined.property"/>
271 <define name="def3" unless="undefined.property"/>
272 </csc>
273 <available property="refapp.created" file="${testCscReferences.exe}"/>
274 <fail unless="refapp.created">No app ${testCscReferences.exe} created</fail>
275 <exec executable="${mono.executable}" failonerror="true">
276 <arg value="${testCscReferences.exe}"/>
277 </exec>
278 </target>
279
280 <target name="testILASM" depends="validate_ilasm" if="ilasm.found">
281 <property name="testILASM.exe"
282 location="${build.dir}/ExampleIlasm.exe" />
283 <ilasm
284 destFile="${testILASM.exe}"
285 targetType="exe"
286 >
287 <src dir="${src.dir}" includes="*.il"/>
288 </ilasm>
289 <available property="ilasm.created" file="${testILASM.exe}"/>
290 <fail unless="ilasm.created">No app ${testILASM.exe} created</fail>
291 <exec executable="${testILASM.exe}" failonerror="true" />
292 </target>
293
294 <!-- not including this in the test as it creates an exe in the src dir -->
295
296 <target name="testIlasmNoDestFile" depends="validate_ilasm">
297 <ilasm
298 targetType="exe"
299 >
300 <src dir="${src.dir}" includes="**/*.il"/>
301 </ilasm>
302 </target>
303
304 <!-- just here to look at fileset refid conversion by hand -->
305 <target name="echoFileset">
306 <fileset id="ilasm" dir="${src.dir}" includes="**/*.il" />
307 <property name="ilasm.string" refid="ilasm"/>
308 <echo>${ilasm.string}</echo>
309 </target>
310
311 <target name="testILDASM" depends="testILASM" if="ildasm.found">
312 <property name="testILDASM.il"
313 location="${build.dir}/ExampleIldasm.il" />
314 <ildasm
315 srcFile="${testILASM.exe}"
316 destFile="${testILDASM.il}"
317 metadata="true"
318 header="true"
319 linenumbers="true"
320 encoding="ascii"
321 />
322 <available property="ildasm.created" file="${testILDASM.il}"/>
323 <fail unless="ildasm.created">No file ${testILDASM.il} created</fail>
324 </target>
325
326 <!-- this is an error -->
327 <target name="testILDASM_empty" depends="validate_ilasm" >
328 <ildasm/>
329 </target>
330
331 <target name="jsharp" depends="init" if="jsharp.found" >
332 <property name="jsharp.exe"
333 location="${build.dir}/jsharp.exe" />
334 <jsharpc
335 destFile="${jsharp.exe}"
336 targetType="exe"
337 >
338 <src dir="dotnet" includes="*.java"/>
339 </jsharpc>
340 <exec executable="${jsharp.exe}" failonerror="true" />
341 </target>
342
343 <target name="testCSCresponseFile" depends="validate_csc" >
344 <property name="testCSCresponseFile.exe"
345 location="${build.dir}/testCSCresponseFile.exe" />
346 <csc
347 destFile="${testCSCresponseFile.exe}"
348 targetType="exe"
349 executable="${cs.compiler}"
350 useResponseFile="true"
351 >
352 </csc>
353 <available property="app.created" file="${testCSCresponseFile.exe}"/>
354 <fail unless="app.created">No app ${testCSCresponseFile.exe} created</fail>
355 <delete file="${testCSCresponseFile.exe}"/>
356 </target>
357
358
359</project>
360
Note: See TracBrowser for help on using the repository browser.