File: build.xml

package info (click to toggle)
liblogkit-java 1.2.2-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,044 kB
  • ctags: 1,178
  • sloc: java: 6,183; xml: 1,613; sql: 31; makefile: 21
file content (248 lines) | stat: -rw-r--r-- 8,807 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<?xml version="1.0"?>
<!--
=============================================================================

This is a simplified build file which contains only the needed targets
to build the debian package.

==============================================================================

 LogKit build file

Authors:
 Peter Donald <peter at apache.org>

Legal:
  Copyright (c) 2001-2002 The Apache Software Foundation. All Rights Reserved.

==============================================================================
-->

<project name="Avalon Logkit" default="jar" basedir="..">

  <!--
    Give user a chance to override without editing this file
    (and without typing -D each time he compiles it)
  -->
  <property file="ant.properties"/>
  <property file="${user.home}/.ant.properties"/>

  <property name="name" value="logkit"/>
  <property name="Name" value="LogKit"/>
  <property name="version" value="1.2.2"/>
  <property name="year" value="1999-2003"/>
  <property name="status" value="beta"/>
  <property name="release" value="1st"/>
  <property name="short.version" value="1.2.2"/>
  <property name="compress.jars" value="true"/>

  <property name="debug" value="on"/>
  <property name="optimize" value="off"/>
  <property name="deprecation" value="off"/>

  <!-- Set the properties for intermediate directory -->
  <property name="build.dir" value="build"/>
  <property name="build.lib" value="${build.dir}/lib"/>
  <property name="build.src" value="${build.dir}/src"/>
  <property name="build.classes" value="${build.dir}/classes"/>
  <property name="build.javadocs" value="${build.dir}/javadocs"/>
  <property name="build.docs" value="${build.dir}/docs"/>
  <property name="build.testdocs" value="${build.docs}/test"/>
  <property name="build.reports" value="${build.dir}/reports"/>
  <property name="build.context" value="${build.dir}/documentation"/>
  <property name="build.xdocs" value="${build.context}/xdocs"/>

  <!-- Set the properties for source directories -->
  <property name="src.dir" value="src"/>
  <property name="lib.dir" value="lib"/>
  <property name="java.dir" value="${src.dir}/java"/>
  <property name="compat.dir" value="${src.dir}/compat"/>
  <property name="test.dir" value="${src.dir}/test"/>
  <property name="tools.dir" value="../avalon/tools"/>
  <property name="docs.dir" value="${build.dir}/docs"/>
  <property name="www.dir" value="../avalon-site/docs/${name}"/>
  <property name="xdocs.dir" value="${src.dir}/xdocs"/>
  <property name="context.dir" value="../avalon/src/documentation"/>
  <property name="javadocs.dir" value="${docs.dir}/api"/>
  <property name="dist.dir" value="dist"/>
  <property name="src.dist.dir" value="src-dist"/>

  <property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
  <property name="j2ee.jar" value="${cjan.dir}/j2ee.jar"/>

  <property name="dist.name" value="${Name}-${version}"/>
  <property name="dist.base" value="distributions"/>

  <property name="servletapi.jar" value=""/>
  <property name="mail.jar" value=""/>
  <property name="jms.jar" value=""/>
  <property name="junit.jar" value=""/>
  <property name="jdbc.jar" value=""/>
  <property name="log4j.jar" value=""/>

  <property name="avalon-site.dir" value="../avalon-site"/>

  <path id="project.class.path">
    <pathelement path="${java.class.path}" />
    <pathelement path="${servletapi.jar}" />
    <pathelement path="${mail.jar}"/>
    <pathelement path="${j2ee.jar}" />
    <pathelement path="${jdbc.jar}" />
    <pathelement path="${jms.jar}" />
    <pathelement path="${log4j.jar}" />
    <pathelement path="${avalon-framework.jar}"/>
    <fileset dir="${lib.dir}">
      <include name="*.jar" />
    </fileset>
    <pathelement path="${build.classes}" />
  </path>

  <path id="test.class.path">    
    <path refid="project.class.path"/>
  </path>

   <!-- Prepares the build directory -->
  <target name="prepare">
    <tstamp/>
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.classes}"/>
  </target>

  <!-- Prepares the build directory -->
  <target name="compile"
          depends="prepare"
          description="Compile project">


    <javac srcdir="${java.dir}"
           destdir="${build.classes}"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="${deprecation}"
           target="1.3" source="1.3">
      <classpath>
        <path refid="project.class.path" />
      </classpath>
      <src path="${test.dir}"/>
      <exclude name="org/apache/log/output/ServletOutputLogTarget.java"
               unless="javax.servlet.present"/>
      <exclude name="org/apache/log/output/net/SMTPOutputLogTarget.java"
               unless="javax.mail.present"/>
      <exclude name="**/util/*AvalonLogger*" unless="framework.present"/>
      <exclude name="org/apache/log/output/db/**"
               unless="javax.sql.present"/>
      <exclude name="org/apache/log/output/jms/**"
               unless="javax.jms.present"/>
      <exclude name="org/apache/log/output/test/DBTargetTestCase.java"
               unless="javax.sql.present"/>
      <exclude name="org/apache/log/output/lf5/**"
               unless="log4j.present"/>

      <!-- leave out test cases if junit not installed -->
      <exclude name="org/apache/log/util/test/**"
               unless="junit.present"/>
      <exclude name="org/apache/log/test/**"
               unless="junit.present"/>
      <exclude name="org/apache/log/output/test/**"
               unless="junit.present"/>
      <exclude name="org/apache/log/format/test/**"
               unless="junit.present"/>
    </javac>

    <copy todir="${build.classes}">
      <fileset dir="${java.dir}">
        <include name="**/*.properties"/>
      </fileset>
    </copy>

  </target>

  <target name="test" depends="compile" description="Run tests">
    <mkdir dir="${build.reports}"/>

    <echo message="Performing Unit Tests" />
    <junit fork="true" printsummary="yes" dir="${build.reports}">
      <formatter type="plain"/>
      <classpath>
        <path refid="test.class.path"/>
        <pathelement location="${build.classes}"/>
      </classpath>
      <batchtest todir="${build.reports}">
        <fileset dir="${build.classes}">
          <exclude name="**/test/Abstract*TestCase.class"/>
          <include name="**/test/*TestCase.class"/>
        </fileset>
      </batchtest>
    </junit>

  </target>

  <!-- Creates all the .jar file -->
  <target name="jar" depends="compile" description="Build jar file">

    <mkdir dir="${build.lib}"/>

    <jar jarfile="${build.lib}/${name}.jar" basedir="${build.classes}" compress="${compress.jars}">
      <include name="org/apache/log/**" />
      <exclude name="**/test/*" />
      <manifest>
        <attribute name="Extension-Name" value="avalon-logkit"/>
        <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
        <attribute name="Specification-Version" value="1.0"/>
        <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
        <attribute name="Implementation-Vendor-Id" value="ASF"/>
        <attribute name="Implementation-Version" value="${version}"/>
      </manifest>
    </jar>

  </target>

 
  <!-- Create the API documentation -->
  <target name="javadocs" description="Build javadocs">

    <!-- Hack to exclude javax.sql and javax.jms dependent classes -->
    <delete dir="${build.src}"/>
    <mkdir dir="${build.src}"/>
    <copy todir="${build.src}">
      <fileset dir="${java.dir}">
        <exclude name="org/apache/log/output/ServletOutputLogTarget.java"
                 unless="servlet.present"/>
        <exclude name="org/apache/log/output/net/SMTPOutputLogTarget.java"
                 unless="javax.mail.present"/>
        <exclude name="org/apache/log/output/db/**"
                 unless="javax.sql.present"/>
        <exclude name="org/apache/log/output/jms/**"
                 unless="javax.jms.present"/>
        <exclude name="org/apache/log/output/test/DBTargetTestCase.java"
                 unless="javax.sql.present"/>
      </fileset>
      <fileset dir="${compat.dir}">
        <include name="**/*.java"/>
      </fileset>
    </copy>

    <delete dir="${build.javadocs}"/>
    <mkdir dir="${build.javadocs}"/>

    <javadoc packagenames="org.apache.*"
             sourcepath="${build.src}"
             destdir="${build.javadocs}">
      <classpath refid="project.class.path" />     
    </javadoc>

  </target>

  <!-- Cleans up build and distribution directories -->
  <target name="clean" description="Clean build dirs">
    <delete dir="${build.dir}" />
    <delete dir="test" /> <!-- cleanup unit test directory -->
    <delete>
      <fileset dir="." includes="velocity.log*"/>
      <fileset dir="." includes="**/*~" defaultexcludes="no"/>
    </delete>
  </target>

</project>