| <?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 name="redirector" basedir="."> |
| |
| <target name="test1" description="create ref"> |
| <redirector id="test1" output="out" /> |
| </target> |
| |
| <target name="test2" depends="test1" description="fail"> |
| <redirector refid="test1" output="out" /> |
| </target> |
| |
| <target name="test3" depends="test1" description="fail"> |
| <redirector refid="test1"> |
| <outputmapper type="flatten" /> |
| </redirector> |
| </target> |
| |
| <target name="test4" depends="test1" description="pass"> |
| <redirector> |
| <outputmapper type="flatten" /> |
| </redirector> |
| </target> |
| |
| <target name="testLogInputString" depends="cat-check" if="can-cat"> |
| <echo> |
| testLogInputString can-cat |
| </echo> |
| <exec executable="cat"> |
| <redirector inputstring="foo" loginputstring="false" /> |
| </exec> |
| </target> |
| |
| <target name="testRefid" depends="cat-check" if="can-cat"> |
| <fail message="Property testRefid.out is already set!"> |
| <condition> |
| <isset property="testRefid.out" /> |
| </condition> |
| </fail> |
| <redirector id="r" outputproperty="testRefid.out" inputstring="foo" /> |
| <exec executable="cat"> |
| <redirector refid="r" /> |
| </exec> |
| <fail> |
| <condition> |
| <not> |
| <equals arg1="${testRefid.out}" arg2="foo" /> |
| </not> |
| </condition> |
| </fail> |
| </target> |
| |
| <target name="cat-check"> |
| <property environment="env" /> |
| <condition property="can-cat"> |
| <or> |
| <available file="cat" filepath="${env.PATH}" property="can-cat" /> |
| <available file="cat.exe" filepath="${env.PATH}" property="can-cat" /> |
| <available file="cat.exe" filepath="${env.Path}" property="can-cat" /> |
| </or> |
| </condition> |
| </target> |
| |
| </project> |