/ShowMeTheBestReply/build.xml

http://showmethebestreply.googlecode.com/ · XML · 142 lines · 94 code · 20 blank · 28 comment · 0 complexity · 6655e1766381872dd0154e613fbd49cb MD5 · raw file

  1. <project xmlns:ivy="antlib:org.apache.ivy.ant" name="showmethebestreply" default="test">
  2. <property environment="env"/>
  3. <property name="ivy.install.version" value="2.0.0" />
  4. <condition property="ivy.home" value="${env.IVY_HOME}">
  5. <isset property="env.IVY_HOME" />
  6. </condition>
  7. <property name="ivy.home" value="${user.home}/.ant" />
  8. <property name="ivy.jar.dir" value="${ivy.home}/lib" />
  9. <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />
  10. <target name="download-ivy" unless="offline">
  11. <available file="${ivy.jar.file}" property="ivy.available"/>
  12. <antcall target="-download-ivy" />
  13. </target>
  14. <target name="-download-ivy" unless="ivy.available">
  15. <mkdir dir="${ivy.jar.dir}"/>
  16. <!-- download Ivy from web site so that it can be used even without any special installation -->
  17. <get src="http://www.apache.org/dist/ant/ivy/${ivy.install.version}/apache-ivy-${ivy.install.version}-bin.zip"
  18. dest="${ivy.home}/ivy.zip" usetimestamp="true" verbose="true"/>
  19. <unzip src="${ivy.home}/ivy.zip" dest="${ivy.jar.dir}">
  20. <patternset>
  21. <include name="**/*.jar"/>
  22. </patternset>
  23. <mapper type="flatten"/>
  24. </unzip>
  25. </target>
  26. <target name="init-ivy" depends="download-ivy" unless="ivy.lib.path">
  27. <!-- try to load ivy here from ivy home, in case the user has not already dropped
  28. it into ant's lib dir (note that the latter copy will always take precedence).
  29. We will not fail as long as local lib dir exists (it may be empty) and
  30. ivy is in at least one of ant's lib dir or the local lib dir. -->
  31. <path id="ivy.lib.path">
  32. <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
  33. </path>
  34. <taskdef resource="org/apache/ivy/ant/antlib.xml"
  35. uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
  36. </target>
  37. <property name="lib.dir" value="${basedir}/lib"/>
  38. <macrodef name="grails">
  39. <attribute name="script"/>
  40. <attribute name="args" default="" />
  41. <sequential>
  42. <grailsTask script="@{script}" args="@{args}" classpathref="grails.classpath">
  43. <compileClasspath refid="compile.classpath"/>
  44. <testClasspath refid="test.classpath"/>
  45. <runtimeClasspath refid="app.classpath"/>
  46. </grailsTask>
  47. </sequential>
  48. </macrodef>
  49. <!-- =================================
  50. target: resolve
  51. ================================= -->
  52. <target name="-resolve" description="--> Retrieve dependencies with ivy" depends="init-ivy">
  53. <ivy:retrieve pattern="${lib.dir}/[conf]/[artifact]-[revision].[ext]"/>
  54. </target>
  55. <target name="-init-grails" depends="-resolve">
  56. <path id="grails.classpath">
  57. <fileset dir="${lib.dir}/build"/>
  58. <fileset dir="${lib.dir}"/>
  59. </path>
  60. <path id="compile.classpath">
  61. <fileset dir="${lib.dir}/compile"/>
  62. </path>
  63. <path id="test.classpath">
  64. <fileset dir="${lib.dir}/test"/>
  65. </path>
  66. <path id="app.classpath">
  67. <fileset dir="${lib.dir}/runtime"/>
  68. </path>
  69. <taskdef name="grailsTask"
  70. classname="grails.ant.GrailsTask"
  71. classpathref="grails.classpath"/>
  72. </target>
  73. <target name="deps-report" depends="-resolve" description="--> Generate report of module dependencies.">
  74. <ivy:report conf="*"/>
  75. </target>
  76. <!-- =================================
  77. target: clean
  78. ================================= -->
  79. <target name="clean" description="--> Cleans a Grails application">
  80. <delete failonerror="true">
  81. <fileset dir="${lib.dir}/build" includes="*/"/>
  82. <fileset dir="${lib.dir}/compile" includes="*/"/>
  83. <fileset dir="${lib.dir}/runtime" includes="*/"/>
  84. <fileset dir="${lib.dir}/test" includes="*/"/>
  85. </delete>
  86. <antcall target="--grails-clean"/>
  87. </target>
  88. <!-- extra target to avoid errors on Windows because libs on classpath can not be deleted -->
  89. <target name="--grails-clean" depends="-init-grails">
  90. <grails script="Clean"/>
  91. </target>
  92. <!-- =================================
  93. target: compile
  94. ================================= -->
  95. <target name="compile" depends="-init-grails" description="--> Compiles a Grails application">
  96. <grails script="Compile"/>
  97. </target>
  98. <!-- =================================
  99. target: war
  100. ================================= -->
  101. <target name="war" depends="-init-grails" description="--> Creates a WAR of a Grails application">
  102. <grails script="War"/>
  103. </target>
  104. <!-- =================================
  105. target: test
  106. ================================= -->
  107. <target name="test" depends="-init-grails" description="--> Run a Grails applications unit tests">
  108. <grails script="TestApp"/>
  109. </target>
  110. <!-- =================================
  111. target: run
  112. ================================= -->
  113. <target name="run" depends="-init-grails" description="--> Runs a Grails application using embedded Jetty">
  114. <grails script="RunApp"/>
  115. </target>
  116. <!-- =================================
  117. target: deploy
  118. ================================= -->
  119. <target name="deploy" depends="war" description="--> The deploy target (initially empty)">
  120. <!-- TODO -->
  121. </target>
  122. </project>