forked from sul-dlss/CJKFilterUtils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
185 lines (155 loc) · 6.7 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="CJKFoldingFilter" default="dist" basedir="." >
<property file="build.properties" />
<!-- Continuous Integration properties -->
<property name="cobertura.jar.dir" location="${test.lib.dir}/cobertura-1.9.4.1" />
<property name="cobertura.data.file" value="${instr.dir}/cobertura.ser" />
<target name="clean" description="remove the build directories">
<delete dir="${build.dir}" />
</target>
<target name="init" description="create (empty) generated directories">
<mkdir dir="${build.dir}" />
</target>
<path id="classpath" description="classes and jars needed to build code)">
<fileset dir="${test.lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="compile" depends="init" description="Compile source code into the build directory">
<javac destdir="${build.dir}" srcdir="${src.dir}"
target="${java.compat.version}"
source="${java.compat.version}"
debug="true" debuglevel="lines,vars,source"
encoding="utf-8" includeAntRuntime="false">
<include name="**/*.java" />
<classpath refid="classpath" />
</javac>
<copy file="${src.dir}/edu/stanford/lucene/analysis/variantmap.xml" tofile="${build.dir}/edu/stanford/lucene/analysis/variantmap.xml" overwrite="true" />
</target>
<target name="jar" depends="compile" description="Build custom jar file" >
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/CJKFoldingFilter.jar">
<fileset dir="${build.dir}" includes="**/*.class"/>
<fileset dir="${src.dir}" includes="**/*.java"/>
<fileset dir="${src.dir}" includes="**/*.xml"/>
</jar>
</target>
<!-- ************ test targets ********** -->
<target name="test_clean" description="remove the directories generated for testing">
<delete dir="${test.build.dir}" />
<delete dir="${instr.dir}" />
<delete file="${cobertura.data.file}" />
<delete dir="${coverage.dir}" />
</target>
<target name="test_init" description="create (empty) generated directories for TEST code">
<mkdir dir="${test.build.dir}" />
</target>
<path id="test.build.classpath" description="classes and jars needed to build TEST code">
<fileset dir="${test.lib.dir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${build.dir}"/>
<path refid="classpath" />
</path>
<target name="test_compile" depends="compile,test_init" description="Compile TEST source code into the test build directory">
<javac destdir="${test.build.dir}" srcdir="${test.src.dir}"
target="${java.compat.version}"
source="${java.compat.version}"
debug="true" debuglevel="lines,vars,source"
encoding="utf-8" includeAntRuntime="false">
<include name="**/*.java" />
<classpath refid="test.build.classpath" />
</javac>
</target>
<path id="test.framework.jar">
<fileset dir="${test.lib.dir}">
<include name="lucene-test-framework*.jar" />
</fileset>
</path>
<path id="test.run.classpath" description="classes and jars needed to run TEST code">
<path refid="test.framework.jar"/>
<pathelement location="${test.build.dir}"/>
<fileset dir="${test.lib.dir}">
<exclude name="lucene-test-framework*.jar" />
<include name="*.jar" />
</fileset>
<path refid="test.build.classpath" />
</path>
<target name="test" depends="test_clean,test_compile" description="run tests">
<junit showoutput="yes" printsummary="yes" fork="yes" forkmode="once" haltonfailure="on">
<jvmarg value="-ea" />
<classpath refid="test.run.classpath" />
<formatter type="plain" usefile="false" />
<batchtest>
<fileset dir="${test.build.dir}" includes="**/Test*.class" excludes="**/*$*.class"/>
</batchtest>
</junit>
</target>
<!-- ************ continuous integration targets ********** -->
<path id="cobertura.classpath">
<fileset dir="${cobertura.jar.dir}">
<include name="cobertura.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<!-- Load cobertura custom ant tasks -->
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<!-- NOTE: this should be used only after a fresh compile -->
<target name="instrument">
<delete dir="${instr.dir}" />
<delete file="${cobertura.data.file}" />
<mkdir dir="${instr.dir}" />
<cobertura-instrument todir="${instr.dir}" datafile="${cobertura.data.file}">
<fileset dir="${build.dir}">
<include name="**/*.class" />
<exclude name="**/test/**" />
<exclude name="**/*Test*" />
</fileset>
</cobertura-instrument>
</target>
<target name="test_coverage" depends="test_clean,test_compile,instrument"
description="run tests and capture code coverage" >
<delete dir="${coverage.dir}" />
<mkdir dir="${coverage.dir}"/>
<path id="instrumented.classpath">
<path refid="test.run.classpath" />
<pathelement location="${instr.dir}" />
<path refid="cobertura.classpath" />
</path>
<junit showoutput="yes" printsummary="yes" fork="yes" forkmode="once" haltonfailure="on">
<formatter type="plain" usefile="false" />
<classpath refid="instrumented.classpath" />
<jvmarg value="-ea" />
<!-- name of the coverage data file to use. It must be the same
as the coverage data file generated during instrumentation. -->
<sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.data.file}" />
<batchtest>
<fileset dir="${test.build.dir}" includes="**/Test*.class" excludes="**/*$*.class"/>
</batchtest>
</junit>
<!-- hudson cobertura plugin uses xml report and html reports are handy -->
<cobertura-report format="xml" destdir="${coverage.dir}" srcdir="${src.dir}" datafile="${cobertura.data.file}"/>
<cobertura-report format="html" destdir="${coverage.dir}" srcdir="${src.dir}" datafile="${cobertura.data.file}"/>
</target>
<target name="javadoc" description="generate javadoc">
<path id="docs.srcpath">
<pathelement location="${src.dir}"/>
<pathelement location="${test.src.dir}"/>
</path>
<javadoc destdir="${javadoc.dir}"
sourcepathref="docs.srcpath"
classpathref="test.build.classpath"
author="true"
version="true"
use="true"
windowtitle="CJKFoldingFilter for Lucene/Solr">
<doctitle><![CDATA[<h1>CJKFoldingFilter for Lucene/Solr API</h1>]]></doctitle>
<group title="Packages" packages="edu.stanford.lucene.analysis"/>
<group title="Test Classes" packages="edu.stanford.lucene.analysis.*Test*"/>
<package name="edu.stanford.*" />
<link href="http://docs.oracle.com/javase/6/docs/api/" />
</javadoc>
</target>
<target name="clean_all" depends="test_clean,clean" />
<target name="ci" depends="clean_all,test_coverage,javadoc" description="Continuous Integration: javadoc and tests with coverage" />
</project>