You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

apply.xml 4.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <project name="apply-test" basedir=".">
  2. <target name="init">
  3. <property environment="env"/>
  4. <!-- UNIX -->
  5. <available file="sh" filepath="${env.PATH}" property="sh.executable"/>
  6. <!-- CYGWIN -->
  7. <available file="sh.exe" filepath="${env.PATH}" property="sh.exe.executable"/>
  8. <condition property="test.can.run">
  9. <or>
  10. <isset property="sh.executable"/>
  11. <isset property="sh.exe.executable"/>
  12. </or>
  13. </condition>
  14. <!-- UNIX -->
  15. <available file="wc" filepath="${env.PATH}" property="wc.executable"/>
  16. <!-- CYGWIN -->
  17. <available file="wc.exe" filepath="${env.PATH}" property="wc.exe.executable"/>
  18. <condition property="wc.can.run">
  19. <or>
  20. <isset property="wc.executable"/>
  21. <isset property="wc.exe.executable"/>
  22. </or>
  23. </condition>
  24. <!-- UNIX -->
  25. <available file="sed" filepath="${env.PATH}" property="sed.executable"/>
  26. <!-- CYGWIN -->
  27. <available file="sed.exe" filepath="${env.PATH}" property="sed.exe.executable"/>
  28. <condition property="sed.can.run">
  29. <or>
  30. <isset property="sed.executable"/>
  31. <isset property="sed.exe.executable"/>
  32. </or>
  33. </condition>
  34. </target>
  35. <target name="xyz">
  36. <echo file="x">s/x/blah/g${line.separator}</echo>
  37. <echo file="y">s/y/blah/g${line.separator}</echo>
  38. <echo file="z">s/z/blah/g${line.separator}</echo>
  39. <fileset id="xyz" dir="${basedir}" includes="x,y,z" />
  40. </target>
  41. <target name="no-redirect" depends="init,xyz" if="test.can.run">
  42. <apply executable="sh">
  43. <arg value="parrot.sh"/>
  44. <fileset refid="xyz" />
  45. </apply>
  46. </target>
  47. <target name="redirect1" depends="init,xyz" if="test.can.run">
  48. <apply executable="sh" output="redirect.out" append="true">
  49. <arg value="parrot.sh"/>
  50. <fileset refid="xyz" />
  51. </apply>
  52. </target>
  53. <target name="redirect2" depends="init,xyz" if="test.can.run">
  54. <apply executable="sh" output="redirect.out"
  55. error="redirect.err" append="true">
  56. <arg value="parrot.sh"/>
  57. <fileset refid="xyz" />
  58. </apply>
  59. </target>
  60. <target name="redirect3" depends="init,xyz" if="test.can.run">
  61. <apply executable="sh" logerror="true" append="true"
  62. output="redirect.out" outputproperty="redirect.out">
  63. <arg value="parrot.sh"/>
  64. <fileset refid="xyz" />
  65. </apply>
  66. </target>
  67. <target name="redirect4" depends="init,xyz" if="test.can.run">
  68. <apply executable="sh" append="true"
  69. error="redirect.err" errorproperty="redirect.err"
  70. output="redirect.out" outputproperty="redirect.out">
  71. <arg value="parrot.sh"/>
  72. <fileset refid="xyz" />
  73. </apply>
  74. </target>
  75. <target name="redirect5" depends="init,xyz" if="sed.can.run">
  76. <apply executable="sed" inputstring="x y z${line.separator}" append="true"
  77. error="redirect.err" errorproperty="redirect.err"
  78. output="redirect.out" outputproperty="redirect.out">
  79. <arg value="-f"/>
  80. <fileset refid="xyz" />
  81. </apply>
  82. </target>
  83. <target name="redirect6" depends="init,xyz" if="sed.can.run">
  84. <echo file="redirect.in">x y z${line.separator}</echo>
  85. <apply executable="sed" input="redirect.in" append="true"
  86. error="redirect.err" errorproperty="redirect.err"
  87. output="redirect.out" outputproperty="redirect.out">
  88. <arg value="-f"/>
  89. <fileset refid="xyz" />
  90. </apply>
  91. </target>
  92. <target name="redirect7" depends="init,xyz" if="sed.can.run">
  93. <apply executable="sed" inputstring="x y z${line.separator}"
  94. error="redirect.err" output="redirect.out"
  95. outputproperty="redirect.out">
  96. <arg value="-f"/>
  97. <fileset refid="xyz" />
  98. </apply>
  99. </target>
  100. <target name="redirect7b" depends="redirect7">
  101. <echo>redirect.out=${redirect.out}</echo>
  102. </target>
  103. <target name="cleanup">
  104. <delete>
  105. <fileset dir="${basedir}" includes="redirect.*" />
  106. <fileset refid="xyz" />
  107. </delete>
  108. </target>
  109. </project>