Codebase list libproxool-java / f7d73eae-4a66-43e9-96b1-593919701dee/main build.xml
f7d73eae-4a66-43e9-96b1-593919701dee/main

Tree @f7d73eae-4a66-43e9-96b1-593919701dee/main (Download .tar.gz)

build.xml @f7d73eae-4a66-43e9-96b1-593919701dee/mainraw · history · blame

  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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
<?xml version="1.0"?>
<!--
    $Revision: 1.80 $
    $Date: 2008/08/23 10:08:08 $
    $Author: billhorsman $

    http://proxool.sourceforge.net

-->
<project name="Proxool" default="build-jar" basedir=".">

    <!-- Use this to avoid having to pass properties in the command line -->
    <property file="proxool-ant.properties"/>

    <!-- Whether to include the test classes -->
    <property name="test" value="false"/>

    <!-- Whether to include the sandbox classes -->
    <property name="sandbox" value="false"/>

    <!-- Where to build everything. You might want to override
    this so that it isn't within your cvs tree. -->
    <property name="build-dir" value="build"/>

    <!-- Whether we include debug information in JAR file -->
    <property name="debug" value="true"/>

    <!-- Currect release, e.g. 0.6 -->
    <property name="release" value="0.9.1"/>

    <!-- Currect release, e.g. 0.6 -->
    <property name="junit-report-description" value="Unit Test Report for CVS Snapshot"/>

    <!-- Currect release, e.g. 0.6 -->
    <property name="junit-report-name" value="junit-cvs.html"/>

    <!-- Log4J configuration to use for testing. See proxool-ant.properties
    file for more infomation. -->
    <property name="log4jPath" value="src/java-test/org/logicalcobwebs/proxool/log4j-test.xml"/>

    <!-- Passed to JVM when running tests -->
    <property name="jvmargs" value=""/>

    <!-- What test suite to run when calling the "test" target -->
    <property name="test-suite" value="org.logicalcobwebs.proxool.GlobalTest"/>

    <!-- Classpath -->
    <path id="source" path="${build-dir}/classes">
        <fileset dir="lib">
            <include name="**/*.jar"/>
    	    <include name="**/*.zip"/>
        </fileset>
        <path path="build/lib/proxool-cglib.jar"/>
    </path>
    <path id="binary">
        <fileset dir="lib">
            <include name="**/*.jar"/>
	    <include name="**/*.zip"/>
        </fileset>
        <fileset dir="jar">
            <include name="**/*.jar"/>
        </fileset>
    </path>

    <taskdef name="checkstyle" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
        <classpath refid="source"/>
    </taskdef>

    <!--
        Build necessary directories
       -->
    <target
        name="init"
        >
        <tstamp>
            <format property="TODAY_FULL" pattern="dd-MMM-yyyy HH:mm zzz"/>
        </tstamp>
        <mkdir dir="${build-dir}/src/java" description="make source directory"/>
        <mkdir dir="${build-dir}/etc"/>
        <mkdir dir="${build-dir}/deploy"/>
        <mkdir dir="${build-dir}/classes"/>
        <mkdir dir="${build-dir}/api"/>
        <mkdir dir="${build-dir}/api-dev"/>
        <mkdir dir="${build-dir}/reports"/>
        <available classname="junit.ui.TestRunner" property="junit.present"/>
    </target>

    <target
        name="evaluate-properties"
        description="Works out what elements we should include in the build" 
        >

        <!--
            Evaluate whether we should build the source code
            with test classes
           -->
        <condition property="build-test">
            <equals arg1="${test}" arg2="true"/>
        </condition>

        <!--
            Evaluate whether we should build the source code
            using the experimental stuff in the sandbox
           -->
        <condition property="build-sandbox">
            <equals arg1="${sandbox}" arg2="true"/>
        </condition>


    </target>

    <target
        name="clean"
        description="Cleans build directory"
        >
        <delete dir="${build-dir}"/>
    </target>

    <target
        name="deleteTestDb"
        description="Cleans build directory"
        >
        <delete dir="db"/>
    </target>

    <target
        name="checkstyle"
        description="Checks Java code for style"
        >
        <checkstyle>

            <fileset dir="src/java" includes="**/*.java" excludes="**/concurrent/*,**/asm/**,**/cglib/**"/>
            <fileset dir="src/java-examples" includes="**/*.java"/>
            <fileset dir="src/java-sandbox" includes="**/*.java"/>
            <fileset dir="src/java-test" includes="**/*.java"/>

            <property key="checkstyle.require.version" value="true"/>
            <property key="checkstyle.javadoc.scope" value="nothing"/>
            <property key="checkstyle.maxlinelen" value="200"/>
            <property key="checkstyle.tab.width" value="4"/>

        </checkstyle>
    </target>

    <target
        name="strict-checkstyle"
        description="Checks Java code for style (we don't enforce this strictness, yet)"
        >
        <checkstyle>

            <fileset dir="src/java" includes="**/*.java"/>
            <fileset dir="src/java-examples" includes="**/*.java"/>
            <fileset dir="src/java-sandbox" includes="**/*.java"/>
            <fileset dir="src/java-test" includes="**/*.java"/>

            <property key="checkstyle.require.version" value="true"/>
            <property key="checkstyle.javadoc.scope" value="protected"/>
            <property key="checkstyle.maxlinelen" value="200"/>
            <property key="checkstyle.tab.width" value="4"/>

        </checkstyle>
    </target>

    <target
        name="build-src"
        description="Gathers the source code together ready for compiling"
        depends="clean,init,evaluate-properties"
        >
        <antcall target="build-src-core"/>
        <antcall target="build-src-test"/>
        <antcall target="build-src-sandbox"/>
        <antcall target="version-stamp"/>

    </target>

    <target
        name="version-stamp"
        description="Adds the version and build date to the Version class"
        if="version"
    >
        <replace
            file="${build-dir}/src/java/org/logicalcobwebs/proxool/Version.java"
            token="VERSION = null"
            value='VERSION = "${release}"'
            />

        <replace
            file="${build-dir}/src/java/org/logicalcobwebs/proxool/Version.java"
            token="BUILD_DATE = null"
            value='BUILD_DATE = "${TODAY}"'
            />

    </target>

    <target
        name="compile"
        description="Compiles the code"
        depends="init,build-src,repackage-dependencies"
        >
        <javac srcdir="${build-dir}/src/java" target="1.2" source="1.2" destdir="${build-dir}/classes" debug="${debug}">
            <classpath refid="source"/>
            <classpath path="build/proxool-cglib.jar"/>
        </javac>
        <!-- Copy dtd's and properties into the compiled classes directory. -->
        <copy todir="${build-dir}/classes">
            <fileset dir="src/java" includes="**/*.dtd"/>
            <fileset dir="src/java" includes="**/*.properties"/>
        </copy>
    </target>

    <target
        name="build-jar"
        description="Compiles and builds the JAR file"
        depends="init,build-src,compile"
        >
        <manifest file="${build-dir}/etc/MANIFEST.MF">
            <attribute name="Proxool-Version" value="${release}"/>
            <attribute name="Date" value="${TODAY}"/>
        </manifest>
        <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="jarjar/jarjar-0.6.jar"/>
        <jarjar
                verbose="true"
                jarfile="${build-dir}/proxool-${release}.jar"
                basedir="${build-dir}/classes"
                manifest="${build-dir}/etc/MANIFEST.MF">
            <zipfileset src="jarjar/cglib-nodep-2.1_3.jar"/>
            <rule pattern="net.sf.cglib.**" result="org.logicalcobwebs.cglib.@1"/>
            <zap pattern="net.sf.cglib.transform.**"/>
            <zap pattern="net.sf.cglib.beans.**"/>
            <zap pattern="net.sf.cglib.util.**"/>
        </jarjar>
    </target>

    <target
        name="build-src-core"
        depends="init"
        description="Build the core source (all that is required to run Proxool)"
        >
        <echo level="info" message="Using ${java.vm.vendor} ${java.vm.name} ${java.vm.version} in ${java.home}"/>
        <copy todir="${build-dir}/src/java" preservelastmodified="yes">
            <fileset dir="src/java" includes="**/*.java"/>
            <fileset dir="src/java" includes="**/*.dtd"/>
        </copy>
    </target>

    <target
        name="build-src-sandbox"
        depends="init"
        description="Build the source for the experimental sandbox tree"
        if="build-sandbox"
        >
        <echo level="info" message="Using Sandbox"/>
        <copy todir="${build-dir}/src/java" preservelastmodified="yes">
            <fileset dir="src/java-sandbox" includes="**/*.java"/>
        </copy>
    </target>

    <target
        name="build-src-test"
        depends="init"
        description="Build the source for testing"
        if="build-test"
        >
        <echo level="verbose" message="Collecting test classes"/>
        <copy todir="${build-dir}/src/java">
            <fileset dir="src/java-test" includes="**/*.java"/>
        </copy>
    </target>

    <target
        name="build-test"
        depends="init"
        >
        <property name="build-test" value="true"/>
        <antcall target="build-src"/>
        <antcall target="repackage-dependencies"/>
        <antcall target="compile"/>

        <copy todir="${build-dir}/classes">
            <fileset dir="src/java-test" includes="**/*.properties,**/*.xml"/>
        </copy>
    </target>

    <target
        name="test"
        description="Runs the JUnit tests"
        depends="clean,init,build-test,deleteTestDb"
        >
        <java fork="yes" classpathref="source" classname="junit.textui.TestRunner" >
            <sysproperty key="log4jPath" value="${log4jPath}"/>
            <arg value="${test-suite}"/>
            <jvmarg line="${jvmargs}"/>
        </java>
        <echo message="Note! These unit tests have probably produced some worrying exceptions. As long as the tests passed then you can ignore these exceptions. They are part of the tests."/> 
    </target>

    <target name="repackage-dependencies" description="Repackage the Cglib project into Proxool">
        <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="jarjar/jarjar-0.6.jar"/>
        <mkdir dir="build/lib"/>
        <jarjar verbose="false" jarfile="build/lib/proxool-cglib.jar">
            <zipfileset src="jarjar/cglib-nodep-2.1_3.jar"/>
            <rule pattern="net.sf.cglib.**" result="org.logicalcobwebs.cglib.@1"/>
        </jarjar>
    </target>

    <target
        name="produce-test-report"
        description="Produce a report of the tests"
        depends="clean,init,build-test,deleteTestDb"
        >

        <junit fork="true" printsummary="yes">
            <classpath refid="source"/>
            <sysproperty key="log4jPath" value="${log4jPath}"/>
            <batchtest todir="${build-dir}/reports">
                <fileset dir="src/java-test"
                    includes="**/*Test.java"
                    excludes="**/GlobalTest.java,**/Abstract*,**/PerformanceTest.java"
                    />
            </batchtest>
            <formatter type="xml"/>
        </junit>

        <junitreport>
            <fileset dir="${build-dir}/reports">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="noframes" todir="${build-dir}/reports"/>
        </junitreport>

        <move
            file="${build-dir}/reports/junit-noframes.html"
            tofile="${build-dir}/reports/${junit-report-name}"/>

        <replace
            file="${build-dir}/reports/${junit-report-name}"
            token="&lt;h1&gt;Unit Test Results&lt;/h1&gt;"
            value=""
            />

        <replace
            file="${build-dir}/reports/${junit-report-name}"
            token="68%"
            value="100%"
            />

        <replace
            file="${build-dir}/reports/${junit-report-name}"
            token='Designed for use with &lt;a href="http://www.junit.org">JUnit&lt;/a&gt; and &lt;a href="http://jakarta.apache.org/ant"&gt;Ant&lt;/a&gt;.'
            value='${TODAY_FULL}'
            />

    </target>

    <target
        name="javadoc"
        description="Produce Javadoc API for users"
        depends="init">

        <javadoc
            sourcepath="src/java"
            destdir="${build-dir}/api"
            packagenames="org.logicalcobwebs.proxool,org.logicalcobwebs.proxool.configuration"
            doctitle="Proxool API}"
            windowtitle="Proxool API}"
            public="true"
            />

        <!-- Copy dtd's over to the doc. -->
        <copy todir="${build-dir}/api">
            <fileset dir="src/java" includes="**/*.dtd"/>
        </copy>

    </target>

    <target
        name="javadoc-dev"
        description="Produce Javadoc API for developers"
        depends="init">

        <javadoc
            destdir="${build-dir}/api-dev"
            packagenames="org.logicalcobwebs.*"
            doctitle="Proxool Developer's API}"
            windowtitle="Proxool Developer's API}"
            private="true"
            >
            <sourcepath path="src/java"/>
            <sourcepath path="src/java-test"/>
            <sourcepath path="src/java-sandbox"/>
        </javadoc>

        <!-- Copy dtd's over to the doc. -->
        <copy todir="${build-dir}/api-dev">
            <fileset dir="src/java" includes="**/*.dtd"/>
        </copy>

    </target>

    <target
        name="source-version"
        description="Outputs the source version"
        depends="init,compile"
        >
        <java classpathref="source" classname="org.logicalcobwebs.proxool.Version"/>
    </target>

    <target
        name="binary-version"
        description="Outputs the source version"
        depends="init"
        >
        <java classpathref="binary" classname="org.logicalcobwebs.proxool.Version"/>
    </target>

</project>