summaryrefslogtreecommitdiffstats
path: root/test/resources/platform/shellscript.xml
blob: fc00d91d19ded519bcf105fa7eb42f44f9389075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<project default="invalid">
  <target name="invalid">
    <fail>Don't call this file directly.</fail>
  </target>

  <taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath location="${antcontrib.jar}"/>
  </taskdef>

  <!-- targets used to check if a shell exists -->
  <target name="hassh"> <shellscript shell="sh"/> </target>
  <target name="hasbash"> <shellscript shell="bash"/> </target>
  <target name="hasperl"> <shellscript shell="perl"/> </target>
  <target name="haspython"> <shellscript shell="python"/> </target>
  <target name="hassed">
      <!-- Temporary hack, since SED is hanging the tests on windows -->
      <fail />
      <shellscript shell="sed"/>
  </target>
  <target name="hascmd">
      <shellscript shell="cmd.exe" tmpsuffix=".bat">
          <arg value="/C" />
          echo a
      </shellscript>
  </target>

  <target name="sh.hello">
    <shellscript shell="sh">
      echo "hello world"
    </shellscript>
  </target>

  <target name="bash.hello">
    <shellscript shell="bash">
      echo "hello world"
    </shellscript>
  </target>

  <!-- python needs to start on the first col -->
  <target name="python.hello">
    <shellscript shell="python">
print "hello world"
    </shellscript>
  </target>

  <target name="perl.hello">
    <shellscript shell="perl">
      print STDOUT "hello world\n";
    </shellscript>
  </target>

  <target name="noshell">
    <shellscript shell="!!!!^^^a shell that should not exist^^^^^!!!!"/>
  </target>

  
  <target name="sh.inputstring">
    <shellscript shell="sh" inputstring="echo hello world"/>
  </target>

  <target name="sed.test">
    <shellscript shell="sed" >
      <arg value="-e"/>
      <arg value="s/FOO/BAR/g"/>
      FOO bar bar bar FOO bar bar
    </shellscript>
  </target>

  <target name="sh.property">
    <property name="my.sh.property" value="this is a property"/>
    <shellscript executable="sh">
      echo ${my.sh.property}
    </shellscript>
  </target>

  <target name="sh.set.property">
    <shellscript shell="sh" outputproperty="sh.set.property">
      echo hello world
    </shellscript>
  </target>

  <target name="sh.tmp.suffix">
    <shellscript shell="sh" tmpsuffix=".bat">
      echo $0
    </shellscript>
  </target>

  <target name="cmd.test">
    <shellscript shell="cmd.exe" tmpsuffix=".bat">
      <arg value="/C"/>
      <arg value="call"/>
      echo hello world
    </shellscript>
  </target>

  <target name="dir.test">
    <mkdir dir="subdir"/>
    <shellscript shell="sh" dir="subdir" outputproperty="dir.test.property">
      current=`pwd`
      echo "dir is $current"
    </shellscript>
    <delete dir="subdir"/>
  </target>

  <target name="command.test">
    <shellscript command="this should not work"/>
  </target>
</project>