build.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?xml version="1.0"?>
  2. <!--
  3. * Copyright 2004 Acegi Technology Pty Limited
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. *
  18. * $Id$
  19. -->
  20. <!--
  21. Build file for the "attributes" sample application.
  22. Demonstrates how to compile an application that has the security
  23. configuration defined by Commons Attributes in its Java source code.
  24. -->
  25. <project name="attributes" default="all" basedir=".">
  26. <property file="build.properties"/>
  27. <property file="project.properties"/>
  28. <path id="attribute-compiler-classpath">
  29. <fileset dir="${lib.dir}">
  30. <include name="**/commons-attributes-compiler-SNAPSHOT.jar"/>
  31. <include name="**/commons-collections.jar"/>
  32. <include name="**/xjavadoc-1.0.jar"/>
  33. </fileset>
  34. </path>
  35. <path id="qa-portalpath">
  36. <pathelement location="classes"/>
  37. <fileset dir="${dist.lib.dir}">
  38. <include name="acegi-security.jar"/>
  39. </fileset>
  40. <fileset dir="${lib.dir}">
  41. <include name="**/spring.jar"/>
  42. <include name="**/aopalliance-*.jar"/>
  43. <include name="**/commons-logging.jar"/>
  44. <include name="**/commons-attributes-api-SNAPSHOT.jar"/>
  45. <include name="**/commons-collections.jar"/>
  46. <include name="**/xml-apis.jar"/>
  47. </fileset>
  48. </path>
  49. <path id="jalopy-classpath">
  50. <fileset dir="${lib.dir}/jalopy">
  51. <include name="**/*.jar"/>
  52. </fileset>
  53. </path>
  54. <target name="attribute-compiler" description="Generate Commons Attributes sources from original sources">
  55. <taskdef name='attribute-compiler'
  56. classname="org.apache.commons.attributes.compiler.AttributeCompiler"
  57. classpathref="attribute-compiler-classpath"/>
  58. <attribute-compiler
  59. destdir="${src.generated.dir}"
  60. attributePackages="net.sf.acegisecurity">
  61. <fileset dir="${src.dir}"/>
  62. </attribute-compiler>
  63. </target>
  64. <target name="compile-classes" description="Compile generated and original sources">
  65. <mkdir dir="${build.dir}"/>
  66. <javac destdir="${build.dir}" classpathref="qa-portalpath">
  67. <src path="${src.dir}"/>
  68. <src path="${src.generated.dir}"/>
  69. </javac>
  70. <copy todir="${build.dir}">
  71. <fileset dir="${src.dir}">
  72. <include name="*.xml"/>
  73. </fileset>
  74. </copy>
  75. </target>
  76. <target name="format" description="Formats all project source code">
  77. <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
  78. <classpath refid="jalopy-classpath"/>
  79. </taskdef>
  80. <jalopy fileformat="unix"
  81. convention="${jalopy.xml}"
  82. history="file"
  83. historymethod="adler32"
  84. loglevel="error"
  85. threads="2"
  86. classpathref="qa-portalpath">
  87. <fileset dir="${src.dir}">
  88. <include name="**/*.java"/>
  89. </fileset>
  90. </jalopy>
  91. </target>
  92. <target name="tests" depends="compile-classes" description="Run tests">
  93. <delete dir="${reports.dir}"/>
  94. <mkdir dir="${reports.dir}"/>
  95. <junit printsummary="yes" haltonfailure="yes">
  96. <classpath location="${build.dir}"/>
  97. <classpath refid="qa-portalpath"/>
  98. <formatter type="plain"/>
  99. <batchtest fork="yes" todir="${reports.dir}">
  100. <fileset dir="${build.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
  101. </batchtest>
  102. </junit>
  103. </target>
  104. <target name="clean" description="Clean output dirs (generated, classes, reports)">
  105. <delete dir="${src.generated.dir}"/>
  106. <delete dir="${build.dir}"/>
  107. <delete dir="${reports.dir}"/>
  108. </target>
  109. <target name="all" depends="clean, attribute-compiler, compile-classes, tests" description="Builds from scratch and runs tests"/>
  110. <target name="execute" description="Runs application (assumes has been built)">
  111. <java fork="true" classpathref="qa-portalpath" classname="sample.attributes.Main"/>
  112. </target>
  113. <target name="release" depends="all" description="Builds a clean release file"/>
  114. </project>