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.

dotnet.xml 5.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?xml version="1.0"?>
  2. <project name="dotnet" basedir="." default="init">
  3. <property environment="env"/>
  4. <property name="build.dir" location="dotnet/build"/>
  5. <property name="src.dir" location="dotnet"/>
  6. <property name="out.csc" location="${src.dir}/out.cs"/>
  7. <property name="out.app" location="${classes.dir}/out.exe"/>
  8. <property name="out.type" value="exe"/>
  9. <target name="probe_for_apps" >
  10. <condition property="ilasm.found">
  11. <or>
  12. <available file="ilasm" filepath="${env.PATH}" />
  13. <available file="ilasm.exe" filepath="${env.PATH}" />
  14. <available file="ilasm.exe" filepath="${env.Path}" />
  15. </or>
  16. </condition>
  17. <echo> ilasm.found=${ilasm.found}</echo>
  18. <condition property="csc.found">
  19. <or>
  20. <available file="csc" filepath="${env.PATH}" />
  21. <available file="csc.exe" filepath="${env.PATH}" />
  22. <available file="csc.exe" filepath="${env.Path}" />
  23. </or>
  24. </condition>
  25. <echo> csc.found=${csc.found}</echo>
  26. <!-- <condition property="vbc.found">
  27. <or>
  28. <available file="vbc" filepath="${env.PATH}" />
  29. <available file="vbc.exe" filepath="${env.PATH}" />
  30. <available file="vbc.exe" filepath="${env.Path}" />
  31. </or>
  32. </condition>
  33. <echo> vbc.found=${vbc.found}</echo>
  34. -->
  35. <condition property="dotnetapps.found">
  36. <and>
  37. <isset property="csc.found"/>
  38. <!-- <isset property="vbc.found"/> -->
  39. <isset property="ilasm.found"/>
  40. </and>
  41. </condition>
  42. <echo> dotnetapps.found=${dotnetapps.found}</echo>
  43. </target>
  44. <target name="validate" depends="probe_for_apps" >
  45. <fail unless="dotnetapps.found">Needed .net apps are missing</fail>
  46. </target>
  47. <target name="init" depends="validate">
  48. <mkdir dir="${build.dir}"/>
  49. </target>
  50. <target name="teardown">
  51. <delete dir="${build.dir}"/>
  52. </target>
  53. <target name="testCSC" depends="init">
  54. <property name="testCSC.exe"
  55. location="${build.dir}/ExampleCsc.exe" />
  56. <csc
  57. destFile="${testCSC.exe}"
  58. targetType="exe"
  59. >
  60. </csc>
  61. <available property="app.created" file="${testCSC.exe}"/>
  62. <fail unless="app.created">No app ${testCSC.exe} created</fail>
  63. <exec executable="${testCSC.exe}" failonerror="true" />
  64. <delete file="${testCSC.exe}"/>
  65. </target>
  66. <target name="testCSCintrinsicFileset" depends="init">
  67. <property name="testCSC.exe"
  68. location="${build.dir}/ExampleCsc.exe"/>
  69. <csc
  70. destFile="${testCSC.exe}"
  71. targetType="exe"
  72. srcDir="."
  73. >
  74. </csc>
  75. <available property="app.created" file="${testCSC.exe}"/>
  76. <fail unless="app.created">No app ${testCSC.exe} created</fail>
  77. <exec executable="${testCSC.exe}" failonerror="true"/>
  78. <delete file="${testCSC.exe}"/>
  79. </target>
  80. <target name="testCSCdll" depends="init">
  81. <property name="testCSC.dll"
  82. location="${build.dir}/Example2.dll" />
  83. <csc
  84. destFile="${testCSC.dll}"
  85. targetType="library"
  86. executable="csc"
  87. >
  88. <src dir="${src.dir}" includes="example2.cs"/>
  89. </csc>
  90. <available property="dll.created" file="${testCSC.dll}"/>
  91. <fail unless="dll.created">No file ${testCSC.dll} created</fail>
  92. </target>
  93. <target name="testCscReferences" depends="init,testCSCdll">
  94. <property name="testCscReferences.exe"
  95. location="${build.dir}/ExampleCsc2.exe" />
  96. <csc
  97. destFile="${testCscReferences.exe}"
  98. targetType="exe"
  99. >
  100. <src file="${src.dir}/example.cs"/>
  101. <reference file="${testCSC.dll}" />
  102. <define name="RELEASE" />
  103. <define name="DEBUG" if="undefined.property"/>
  104. <define name="def3" unless="undefined.property"/>
  105. </csc>
  106. <available property="refapp.created" file="${testCscReferences.exe}"/>
  107. <fail unless="refapp.created">No app ${testCscReferences.exe} created</fail>
  108. <exec executable="${testCscReferences.exe}" failonerror="true" />
  109. </target>
  110. <target name="testILASM" depends="init">
  111. <property name="testILASM.exe"
  112. location="${build.dir}/ExampleIlasm.exe" />
  113. <ilasm
  114. destFile="${testILASM.exe}"
  115. targetType="exe"
  116. >
  117. <src dir="${src.dir}" includes="**/*.il"/>
  118. </ilasm>
  119. <available property="ilasm.created" file="${testILASM.exe}"/>
  120. <fail unless="ilasm.created">No app ${testCSC.exe} created</fail>
  121. <exec executable="${testILASM.exe}" failonerror="true" />
  122. </target>
  123. <!-- not including this in the test as it creates an exe in the src dir -->
  124. <target name="testIlasmNoDestFile" depends="init">
  125. <ilasm
  126. targetType="exe"
  127. >
  128. <src dir="${src.dir}" includes="**/*.il"/>
  129. </ilasm>
  130. </target>
  131. <!-- just here to look at fileset refid conversion by hand -->
  132. <target name="echoFileset">
  133. <fileset id="ilasm" dir="${src.dir}" includes="**/*.il" />
  134. <property name="ilasm.string" refid="ilasm"/>
  135. <echo>${ilasm.string}</echo>
  136. </target>
  137. </project>