build.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?xml version="1.0"?>
  2. <!--
  3. Build file for the "attributes" sample application.
  4. Demonstrates how to compile an application that has the security
  5. configuration defined by Commons Attributes in its Java source code.
  6. $Id$
  7. -->
  8. <project name="attributes" default="all" basedir=".">
  9. <property file="build.properties"/>
  10. <property file="project.properties"/>
  11. <path id="attribute-compiler-classpath">
  12. <fileset dir="${lib.dir}">
  13. <include name="**/commons-attributes-compiler-SNAPSHOT.jar"/>
  14. <include name="**/commons-collections.jar"/>
  15. <include name="**/xjavadoc-1.0.jar"/>
  16. </fileset>
  17. </path>
  18. <path id="qa-portalpath">
  19. <pathelement location="classes"/>
  20. <fileset dir="${dist.lib.dir}">
  21. <include name="acegi-security.jar"/>
  22. </fileset>
  23. <fileset dir="${lib.dir}">
  24. <include name="**/spring.jar"/>
  25. <include name="**/aopalliance.jar"/>
  26. <include name="**/commons-logging.jar"/>
  27. <include name="**/commons-attributes-api-SNAPSHOT.jar"/>
  28. <include name="**/commons-collections.jar"/>
  29. <include name="**/xml-apis.jar"/>
  30. </fileset>
  31. </path>
  32. <path id="jalopy-classpath">
  33. <fileset dir="${lib.dir}/jalopy">
  34. <include name="**/*.jar"/>
  35. </fileset>
  36. </path>
  37. <target name="attribute-compiler" description="Generate Commons Attributes sources from original sources">
  38. <taskdef name='attribute-compiler'
  39. classname="org.apache.commons.attributes.compiler.AttributeCompiler"
  40. classpathref="attribute-compiler-classpath"/>
  41. <attribute-compiler
  42. destdir="${src.generated.dir}"
  43. attributePackages="net.sf.acegisecurity">
  44. <fileset dir="${src.dir}"/>
  45. </attribute-compiler>
  46. </target>
  47. <target name="compile-classes" description="Compile generated and original sources">
  48. <mkdir dir="${build.dir}"/>
  49. <javac destdir="${build.dir}" classpathref="qa-portalpath">
  50. <src path="${src.dir}"/>
  51. <src path="${src.generated.dir}"/>
  52. </javac>
  53. <copy todir="${build.dir}">
  54. <fileset dir="${src.dir}">
  55. <include name="*.xml"/>
  56. </fileset>
  57. </copy>
  58. </target>
  59. <target name="format" description="Formats all project source code">
  60. <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
  61. <classpath refid="jalopy-classpath"/>
  62. </taskdef>
  63. <jalopy fileformat="unix"
  64. convention="${jalopy.xml}"
  65. history="file"
  66. historymethod="adler32"
  67. loglevel="error"
  68. threads="2"
  69. classpathref="qa-portalpath">
  70. <fileset dir="${src.dir}">
  71. <include name="**/*.java"/>
  72. </fileset>
  73. </jalopy>
  74. </target>
  75. <target name="tests" depends="compile-classes" description="Run tests">
  76. <delete dir="${reports.dir}"/>
  77. <mkdir dir="${reports.dir}"/>
  78. <junit printsummary="yes" haltonfailure="yes">
  79. <classpath location="${build.dir}"/>
  80. <classpath refid="qa-portalpath"/>
  81. <formatter type="plain"/>
  82. <batchtest fork="yes" todir="${reports.dir}">
  83. <fileset dir="${build.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
  84. </batchtest>
  85. </junit>
  86. </target>
  87. <target name="clean" description="Clean output dirs (generated, classes, reports)">
  88. <delete dir="${src.generated.dir}"/>
  89. <delete dir="${build.dir}"/>
  90. <delete dir="${reports.dir}"/>
  91. </target>
  92. <target name="all" depends="clean, attribute-compiler, compile-classes, tests" description="Builds from scratch and runs tests"/>
  93. <target name="execute" description="Runs application (assumes has been built)">
  94. <java fork="true" qa-portalpathref="qa-portalpath" classname="sample.attributes.Main"/>
  95. </target>
  96. <target name="release" depends="all" description="Builds a clean release file"/>
  97. </project>