blob: 036448c5ee00f4ca0cee9633976b38635f53ce47 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Copyright 2003-2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="dotnet" basedir="." default="testCSC"
xmlns:dn="antlib:org.apache.ant.dotnet">
<import file="augment-path.xml"/>
<property name="build.dir" location="build"/>
<property name="src.dir" location="src"/>
<property name="out.csc" location="${src.dir}/out.cs"/>
<property name="out.app" location="${build.dir}/out.exe"/>
<property name="out.type" value="exe"/>
<target name="probe_for_apps" >
<condition property="csc.found">
<or>
<available file="csc" filepath="${augmented.PATH}"/>
<available file="csc.exe" filepath="${augmented.PATH}"/>
</or>
</condition>
<echo> csc.found=${csc.found}</echo>
<!-- Mono C# compiler -->
<condition property="mcs.found">
<available file="mcs" filepath="${augmented.PATH}"/>
</condition>
<echo> mcs.found=${mcs.found}</echo>
<!-- any C# compiler -->
<condition property="c#.found">
<or>
<isset property="csc.found"/>
<isset property="mcs.found"/>
</or>
</condition>
</target>
<target name="init" depends="probe_for_apps">
<mkdir dir="${build.dir}"/>
<property name="testCSC.exe"
location="${build.dir}/ExampleCsc.exe" />
</target>
<target name="teardown">
<delete dir="${build.dir}"/>
</target>
<target name="validate_csc" depends="init">
<fail unless="c#.found">Needed C# compiler is missing</fail>
</target>
<target name="testCSC" depends="validate_csc">
<csc
destFile="${testCSC.exe}"
targetType="exe">
<src dir="${src.dir}" includes="ex*.cs"/>
</csc>
<available property="app.created" file="${testCSC.exe}"/>
<fail unless="app.created">No app ${testCSC.exe} created</fail>
<dn:dotnetexec executable="${testCSC.exe}" failonerror="true" />
<delete file="${testCSC.exe}"/>
</target>
</project>