blob: 8d4aafec2eb6dd0dc7d807a5cb229bb06722bdb8 [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
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 default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
<import file="../antunit-base.xml" />
<property name="ant-build" location="../../../../build"/>
<property name="javac-dir" location="${ant-build}/ant-unit/javac-dir"/>
<property name="build-dir" location="${javac-dir}/build"/>
<target name="test-includeDestClasses">
<property name="DATE" value="09/10/1999 4:30 pm"/>
<delete dir="${javac-dir}/src"/>
<mkdir dir="${javac-dir}/src"/>
<echo file="${javac-dir}/src/A.java">
public class A { B b;}
</echo>
<echo file="${javac-dir}/src/B.java">
public class B { }
</echo>
<delete dir="${javac-dir}/classes" quiet="yes"/>
<mkdir dir="${javac-dir}/classes"/>
<javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes"/>
<touch file="${javac-dir}/src/B.java" datetime="${DATE}"/>
<touch file="${javac-dir}/classes/B.class" datetime="${DATE}"/>
<!-- following should not update B.class -->
<delete quiet="yes" file="${javac-dir}/classes/A.class"/>
<javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes"/>
<au:assertTrue>
<isfileselected file="${javac-dir}/classes/B.class">
<date datetime="${DATE}" when="equal"/>
</isfileselected>
</au:assertTrue>
<!-- following should update B.class -->
<delete quiet="yes" file="${javac-dir}/classes/A.class"/>
<javac srcdir="${javac-dir}/src"
destdir="${javac-dir}/classes" includeDestClasses="no"/>
<au:assertFalse>
<isfileselected file="${javac-dir}/classes/B.class">
<date datetime="${DATE}" when="equal"/>
</isfileselected>
</au:assertFalse>
</target>
<target name="test-updated-property">
<delete quiet="yes" dir="${build-dir}"/>
<mkdir dir="${build-dir}"/>
<javac srcdir="javac-dir/good-src" destdir="${build-dir}"
updatedProperty="classes-updated"/>
<au:assertTrue>
<equals arg1="${classes-updated}" arg2="true"/>
</au:assertTrue>
<javac srcdir="javac-dir/good-src" destdir="${build-dir}"
updatedProperty="classes-updated-2"/>
<au:assertFalse>
<isset property="classes-updated-2"/>
</au:assertFalse>
</target>
<target name="test-error-property">
<delete quiet="yes" dir="${build-dir}"/>
<mkdir dir="${build-dir}"/>
<javac srcdir="javac-dir/good-src" destdir="${build-dir}"
failOnError="false"
errorProperty="compile-failed"/>
<au:assertTrue>
<equals arg1="${compile-failed}" arg2="${compile-failed}"/>
</au:assertTrue>
<javac srcdir="javac-dir/bad-src" destdir="${build-dir}"
failOnError="false"
errorProperty="compile-failed"/>
<au:assertTrue>
<equals arg1="${compile-failed}" arg2="true"/>
</au:assertTrue>
</target>
</project>