File: build.xml

package info (click to toggle)
libstax-java 1.2.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,676 kB
  • sloc: java: 21,270; xml: 263; makefile: 34; sh: 16
file content (306 lines) | stat: -rw-r--r-- 11,134 bytes parent folder | download
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
<!-- The ANT build script for StAX reference implementation
   -
  -->
<project name="stax" default="run">

  <!-- for details see src/build.xml -->

  <!-- Ref. impl properties -->
  <property name="version" value="1.2.0"/>
  <property name="build_dir" value="build"/>
  <property name="class_dir" value="${build_dir}/classes"/>
  <property name="javadoc_dir" value="${build_dir}/javadoc"/>
  <property name="jar_ri" value="${build_dir}/stax-${version}-dev.jar"/>
  <property name="jar_src" value="${build_dir}/stax-src-${version}-dev.zip"/>  
  <property name="src" value="src"/>
  <property name="topdirs" value="com/bea/xml/stream/*.java,
                                       com/wutka/dtd/*.java,
                                       com/bea/xml/stream/samples/*.java,
                                       com/bea/xml/stream/util/*.java,
                                       com/bea/xml/stream/filters/*.java,
                                       com/bea/xml/stream/reader/*.java,
                                       com/bea/xml/stream/events/*.java"
  />

  <!-- API properties -->
  <property name="api_version" value="1.0.1"/>
  <property name="api_src_dir" value="${build_dir}/api_src"/>
  <property name="api_dir" value="api"/>
  <property name="jar_api" value="${build_dir}/stax-api-${api_version}.jar"/>
  <property name="src_api" value="src"/>
  <property name="api_dirs" value="javax/xml/*.java,
                    javax/xml/namespace/*.java,
  					javax/xml/stream/**/*.java"/>

  <!-- Unit test (StaxTest) package properties -->
  <property name="test_version" value="1.0"/>
  <property name="test_class_dir" value="${build_dir}/test-classes"/>
  <property name="test_results_dir" value="${build_dir}/test-results"/>
  <property name="test_jar" value="staxtest_${test_version}.jar"/>
  <property name="test_src_zip" value="staxtest_src_${test_version}.zip"/>

  <property name="lib" value="lib"/>

  <path id="junit_libraries">
        <fileset dir="${lib}">
            <include name="junit/junit*.jar" />
        </fileset>
  </path>

  <path id="test_classpath">
        <path refid="junit_libraries" />
        <pathelement path="${test_class_dir}" />
        <!-- This is enough to get both API and RI classes: -->
        <pathelement path="${class_dir}" />
  </path>

  <target name="all" depends="clean,build,ri_bin_dist,run"/>
  <target name="clean">
    <delete dir="${build_dir}"/>
  </target>

  <!-- Common initializations -->
  <target name="init">
    <mkdir dir="${build_dir}"/>
    <mkdir dir="${class_dir}"/>
    <mkdir dir="${javadoc_dir}"/>
  </target>

  <!-- Target for building API classes from sources -->
  <target name="api" depends="init">
    <!--mkdir dir="${api_src_dir}"/-->
    <!--unjar src="${jar_api}" dest="${class_dir}"/-->
    <javac srcdir="${src_api}"
      source="1.4" target="1.4"
      includes="${api_dirs}"
      destdir="${class_dir}"
      encoding="iso-8859-1"
      debug="true">
      <classpath>
        <pathelement path="${java.class.path}"/>
        <pathelement path="${class_dir}"/>
      </classpath>
    </javac>
    

    <jar jarfile="${jar_api}">
      <!-- Let's add bit more information into jar... like version -->
      <manifest>
            <attribute name="Built-By" value="${user.name}"/>
            <attribute name="Specification-Title"   value="StAX"/>
            <attribute name="Specification-Version" value="${api_version}"/>
            <attribute name="Specification-Vendor"  value="JCP-173"/>
            <attribute name="Implementation-Title"   value="StAX 1.0 API"/>
            <attribute name="Implementation-Version" value="${api_version}"/>
            <attribute name="Implementation-Vendor"  value="JCP"/>
      </manifest>
      <fileset dir="${class_dir}"
        includes=
        "javax/xml/
        "/>
    </jar>

  </target>

  <!-- Main Ref. Impl. compilation: -->
  <target name="compile" depends="init,api">
    <!--javac srcdir="${src}:${api_src_dir}"-->
    <javac srcdir="${src}"
      source="1.4" target="1.4"
      includes="${topdirs}"
      destdir="${class_dir}"
      encoding="iso-8859-1"
      debug="true">
      <classpath>
        <pathelement path="${java.class.path}"/>
        <pathelement path="${class_dir}"/>
      </classpath>
    </javac>
  </target>

  <target name="samples" depends="compile">
    <!--javac srcdir="${src}:${api_src_dir}"-->
    <javac srcdir="${src}" source="1.4" target="1.4"
      destdir="${class_dir}" encoding="iso-8859-1" debug="true">
      <include name="samples/*.java" />
      <classpath>
        <pathelement path="${java.class.path}"/>
        <pathelement path="${class_dir}"/>
      </classpath>
    </javac>
  </target>

  <!-- Targets for compiling StaxTest classes
    -->
  <target name="test_init">
    <mkdir dir="${test_class_dir}"/>
    <mkdir dir="${test_results_dir}"/>
    <mkdir dir="${test_results_dir}/xml"/>
  </target>
  <target name="test_compile" depends="api, test_init">
    <javac srcdir="${src}" includes="org/codehaus/stax/test/**/*.java"
      source="1.4" target="1.4"
      destdir="${test_class_dir}"
      encoding="iso-8859-1"
      debug="true">
      <classpath>
        <pathelement path="${class_dir}" />
        <path refid="junit_libraries"/>
      </classpath>
    </javac>
  </target>

  <!-- Targets for building distributable files (API, ref. impl.,
     - javadocs, test suite)
    -->

  <target name="dist" depends="compile,ri_src_dist,ri_bin_dist" />

  <!-- Ref. Impl. "binary" -->
  <target name="ri_bin_dist" depends="compile">
    <jar jarfile="${jar_ri}">
      <!-- Let's add bit more information into jar... like version -->
      <manifest>
            <attribute name="Built-By" value="${user.name}"/>
            <attribute name="Specification-Title"   value="StAX"/>
            <attribute name="Specification-Version" value="${api_version}"/>
            <attribute name="Specification-Vendor"  value="JCP-173"/>
            <attribute name="Implementation-Title"   value="StAX reference implementation"/>
            <attribute name="Implementation-Version" value="${version}"/>
            <attribute name="Implementation-Vendor"  value="BEA"/>
      </manifest>
      <fileset dir="${class_dir}"
        includes=
        "com/wutka/dtd/,
         com/bea/xml/stream/,
         com/bea/xml/stream/samples/,
         com/bea/xml/stream/util/,
         com/bea/xml/stream/filters/,
         com/bea/xml/stream/reader/,
         com/bea/xml/stream/events/"/>
    </jar>
  </target>

  <!-- Package the source code of the ref. impl -->
  <target name="ri_src_dist" depends="compile">
    <jar jarfile="${jar_src}">
      <fileset dir="."
        includes=
        "${src}/com/wutka/dtd/,
         ${src}/com/bea/xml/stream/,
         ${src}/com/bea/xml/stream/samples/,
         ${src}/com/bea/xml/stream/util/,
         ${src}/com/bea/xml/stream/filters/,
         ${src}/com/bea/xml/stream/reader/,
         ${src}/com/bea/xml/stream/events/,
         ${src}/org/codehaus/stax/test/**,
         ${src}/javax/**,
         ${src}/samples/**,
         ${src}/test/**"/>
      <fileset dir="."
        includes=
        "build.xml,
         ASF2.0.txt"/>
    </jar>
  </target>

  <!-- Javadocs for the ref. impl. -->
  <target name="javadoc" depends="init">
    <!-- Build a dirpath that contains just the "source" tree -->
    <javadoc windowtitle="${ProjectName}"
         destdir="${javadoc_dir}" author="true"  version="true">
      <packageset dir="${src}" defaultexcludes="yes">
        <include name="com/bea/**" />
      </packageset>
    </javadoc>
  </target> 

  <!-- Package the test suite jar, usable by other implementations -->
  <target name="test_jar" depends="test_compile">
    <jar jarfile="${test_jar}">
      <manifest>
            <attribute name="Built-By" value="${user.name}"/>
            <attribute name="Specification-Title"   value="StAX"/>
            <attribute name="Specification-Version" value="${api_version}"/>
            <attribute name="Specification-Vendor"  value="JCP-173"/>
            <attribute name="Implementation-Title"   value="StaxTest test suite" />
            <attribute name="Implementation-Version" value="${test_version}"/>
            <attribute name="Implementation-Vendor"  value="Codehaus"/>
      </manifest>
      <fileset dir="${test_class_dir}" includes="org/codehaus/stax/test/" />
    </jar>
  </target>

  <!-- And test suite sources -->
  <target name="test_src_zip">
    <zip destfile="${test_src_zip}">
      <fileset dir="${src}" includes="org/codehaus/stax/test/" />
    </zip>
  </target>

  <!-- Targets that run things like unit tests
    -->

  <target name="build" depends="compile"/>
  <target name="run" depends="build">
    <java classname="com.bea.xml.stream.samples.EventParse" fork="true">
      <arg line="src/test/files/test.xml"/>
      <classpath>
        <pathelement path="${class_dir}"/>
        <pathelement path="${java.class.path}"/>
      </classpath>
    </java>
  </target>

  <!-- By default, let's only run "non-validating" test case, since
     - RI doesn't implement validation, and it's easier to control it
     - here than having all validation unit tests check for support
    -->

  <target name="test" depends="test_core" />

  <target name="test_all" depends="test_core, test_validation" />

  <!-- Core includes tests for other StAX 1.0 features except for DTD
     - validation (which is optional)
    -->
  <target name="test_core" depends="compile, test_compile">
    <junit fork="no" printsummary="yes" haltonfailure="no" showoutput="yes">
            <batchtest fork="no" todir="${test_results_dir}/xml">
                <fileset dir="${test_class_dir}">
                    <!-- Need to exclude inner classes... -->
                    <exclude name="**/*$*.class"/>
                    <exclude name="org/codehaus/stax/test/vstream/*.class"/>
                    <include name="org/codehaus/stax/test/**/Test*.class"/>
                </fileset>
            </batchtest>
            <formatter type="xml" />
            <classpath refid="test_classpath" />
     </junit>
     <junitreport todir="${test_results_dir}">
            <fileset dir="${test_results_dir}/xml">
                <include name="TEST-*.xml" />
            </fileset>
            <report todir="${test_results_dir}" />
     </junitreport>
  </target>

  <target name="test_validation" depends="compile, test_compile">
    <junit fork="no" printsummary="yes" haltonfailure="no" showoutput="yes">
            <batchtest fork="no" todir="${test_results_dir}/xml">
                <fileset dir="${test_class_dir}">
                    <include name="org/codehaus/stax/test/vstream/Test*.class"/>
                </fileset>
            </batchtest>
            <formatter type="xml" />
            <classpath refid="test_classpath" />
     </junit>
     <junitreport todir="${test_results_dir}">
            <fileset dir="${test_results_dir}/xml">
                <include name="TEST-*.xml" />
            </fileset>
            <report todir="${test_results_dir}" />
     </junitreport>
  </target>

</project>