| 1 |
<project default="invalid"> |
| 2 |
<target name="invalid"> |
| 3 |
<fail>Don't call this file directly.</fail> |
| 4 |
</target> |
| 5 |
|
| 6 |
<taskdef resource="net/sf/antcontrib/antcontrib.properties"> |
| 7 |
<classpath location="${antcontrib.jar}"/> |
| 8 |
</taskdef> |
| 9 |
|
| 10 |
|
| 11 |
<target name="hassh"> <shellscript shell="sh"/> </target> |
| 12 |
<target name="hasbash"> <shellscript shell="bash"/> </target> |
| 13 |
<target name="hasperl"> <shellscript shell="perl"/> </target> |
| 14 |
<target name="haspython"> <shellscript shell="python"/> </target> |
| 15 |
<target name="hassed"> |
| 16 |
|
| 17 |
<fail /> |
| 18 |
<shellscript shell="sed"/> |
| 19 |
</target> |
| 20 |
<target name="hascmd"> |
| 21 |
<shellscript shell="cmd.exe" tmpsuffix=".bat"> |
| 22 |
<arg value="/C" /> |
| 23 |
echo a |
| 24 |
</shellscript> |
| 25 |
</target> |
| 26 |
|
| 27 |
<target name="sh.hello"> |
| 28 |
<shellscript shell="sh"> |
| 29 |
echo "hello world" |
| 30 |
</shellscript> |
| 31 |
</target> |
| 32 |
|
| 33 |
<target name="bash.hello"> |
| 34 |
<shellscript shell="bash"> |
| 35 |
echo "hello world" |
| 36 |
</shellscript> |
| 37 |
</target> |
| 38 |
|
| 39 |
|
| 40 |
<target name="python.hello"> |
| 41 |
<shellscript shell="python"> |
| 42 |
print "hello world" |
| 43 |
</shellscript> |
| 44 |
</target> |
| 45 |
|
| 46 |
<target name="perl.hello"> |
| 47 |
<shellscript shell="perl"> |
| 48 |
print STDOUT "hello world\n"; |
| 49 |
</shellscript> |
| 50 |
</target> |
| 51 |
|
| 52 |
<target name="noshell"> |
| 53 |
<shellscript shell="!!!!^^^a shell that should not exist^^^^^!!!!"/> |
| 54 |
</target> |
| 55 |
|
| 56 |
|
| 57 |
<target name="sh.inputstring"> |
| 58 |
<shellscript shell="sh" inputstring="echo hello world"/> |
| 59 |
</target> |
| 60 |
|
| 61 |
<target name="sed.test"> |
| 62 |
<shellscript shell="sed" > |
| 63 |
<arg value="-e"/> |
| 64 |
<arg value="s/FOO/BAR/g"/> |
| 65 |
FOO bar bar bar FOO bar bar |
| 66 |
</shellscript> |
| 67 |
</target> |
| 68 |
|
| 69 |
<target name="sh.property"> |
| 70 |
<property name="my.sh.property" value="this is a property"/> |
| 71 |
<shellscript executable="sh"> |
| 72 |
echo ${my.sh.property} |
| 73 |
</shellscript> |
| 74 |
</target> |
| 75 |
|
| 76 |
<target name="sh.set.property"> |
| 77 |
<shellscript shell="sh" outputproperty="sh.set.property"> |
| 78 |
echo hello world |
| 79 |
</shellscript> |
| 80 |
</target> |
| 81 |
|
| 82 |
<target name="sh.tmp.suffix"> |
| 83 |
<shellscript shell="sh" tmpsuffix=".bat"> |
| 84 |
echo $0 |
| 85 |
</shellscript> |
| 86 |
</target> |
| 87 |
|
| 88 |
<target name="cmd.test"> |
| 89 |
<shellscript shell="cmd.exe" tmpsuffix=".bat"> |
| 90 |
<arg value="/C"/> |
| 91 |
<arg value="call"/> |
| 92 |
echo hello world |
| 93 |
</shellscript> |
| 94 |
</target> |
| 95 |
|
| 96 |
<target name="dir.test"> |
| 97 |
<mkdir dir="subdir"/> |
| 98 |
<shellscript shell="sh" dir="subdir" outputproperty="dir.test.property"> |
| 99 |
current=`pwd` |
| 100 |
echo "dir is $current" |
| 101 |
</shellscript> |
| 102 |
<delete dir="subdir"/> |
| 103 |
</target> |
| 104 |
|
| 105 |
<target name="command.test"> |
| 106 |
<shellscript command="this should not work"/> |
| 107 |
</target> |
| 108 |
</project> |