blob: b2508b375a2b06b54316cda3f677c8fcebde06ed [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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
https://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="msbuild" basedir="." default="echo"
xmlns:au="antlib:org.apache.ant.antunit"
xmlns:dn="antlib:org.apache.ant.dotnet">
<import file="../augment-path.xml"/>
<target name="setUp">
<condition property="msbuild.found">
<or>
<available file="MSBuild.exe" filepath="${augmented.PATH}"/>
<available file="MSBuild.exe"/>
</or>
</condition>
</target>
<target name="test-echo" if="msbuild.found">
<dn:msbuild buildfile="src/msbuild.proj">
<dn:target name="echo"/>
<dn:property name="foo" value="bar"/>
</dn:msbuild>
<au:assertLogContains text="foo is bar"/>
</target>
<target name="test-nested-file" if="msbuild.found">
<property name="foo" value="baz"/>
<dn:msbuild>
<dn:build>
<Project DefaultTargets="echo"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="echo">
<Message Text="foo is ${foo}"/>
</Target>
</Project>
</dn:build>
</dn:msbuild>
<au:assertLogContains text="foo is baz"/>
</target>
<target name="test-nested-task" if="msbuild.found">
<property name="foo2" value="xyzzy"/>
<dn:msbuild errorProperty="msbuild.failed1">
<dn:build>
<Message Text="foo is ${foo2}"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"/>
</dn:build>
</dn:msbuild>
<au:assertLogContains text="foo is xyzzy"/>
<au:assertFalse message="no failure">
<isset property="msbuild.failed1"/>
</au:assertFalse>
</target>
<target name="test-fail" if="msbuild.found">
<au:expectfailure message="MSBuild should fail">
<dn:msbuild>
<dn:build>
<Error Text="Failed"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"/>
</dn:build>
</dn:msbuild>
</au:expectfailure>
</target>
<target name="test-hidden-failure" if="msbuild.found">
<dn:msbuild failOnError="false">
<dn:build>
<Error Text="Failed"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"/>
</dn:build>
</dn:msbuild>
</target>
<target name="test-hidden-failure-property" if="msbuild.found">
<dn:msbuild failOnError="false" errorProperty="msbuild.failed">
<dn:build>
<Error Text="Failed"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"/>
</dn:build>
</dn:msbuild>
<au:assertPropertySet name="msbuild.failed"/>
</target>
</project>