File: build.xml

package info (click to toggle)
png-sixlegs 2.0-3
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 3,504 kB
  • sloc: java: 6,933; xml: 276; makefile: 6
file content (310 lines) | stat: -rw-r--r-- 12,783 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
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
<?xml version='1.0' encoding='UTF-8'?>
<project name="Sixlegs PNG" default="jar-all">
    <property file="${user.home}/build.properties" />
    <property file="build.properties" />

    <property name="javadoc.access" value="protected"/>

    <property name="compile.bootclasspath.12" value="${java.home}/lib/rt.jar"/>
    <property name="compile.bootclasspath.14" value="${java.home}/lib/rt.jar"/>
    <property name="compile.bootclasspath.15" value="${java.home}/lib/rt.jar"/>
    <property name="compile.extdirs" value=""/>

    <property name="compile.debug" value="true"/>
    <property name="compile.deprecation" value="false"/>
    <property name="compile.optimize" value="false"/>

    <property name="product" value="javapng"/>
    <property name="version" value="2.0"/>
    <property name="version.tools" value="0.5"/>
    <property name="prefix" value="${product}-${version}"/>
    <property name="viewer.file" value="src/test/images/misc/cc1.png"/>
    <property name="suite.file" value="suite.png"/>
    <property name="benchmark.file" value="benchmark.txt"/>
    <property name="benchmark.loop" value="1"/>

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

    <target name="init" unless="path.lib">
        <tstamp/>
        <path id="path.lib">
            <fileset dir="lib" includes="**/*.jar"/>
        </path>
        <path id="path.libdev">
            <fileset dir="libdev" includes="**/*.jar"/>
        </path>
        <path id="path.main">
            <path refid="path.lib"/>
            <pathelement path="build/main"/>
        </path>
        <path id="path.apng">
            <path refid="path.main"/>
            <pathelement path="build/apng"/>
        </path>
        <path id="path.viewer">
            <path refid="path.apng"/>
            <pathelement path="build/viewer"/>
        </path>
        <path id="path.iio">
            <path refid="path.apng"/>
            <pathelement path="build/iio"/>
        </path>
        <path id="path.examples">
            <path refid="path.iio"/>
            <path refid="path.libdev"/>
            <pathelement path="build/examples"/>
        </path>
        <path id="path.test">
            <path refid="path.iio"/>
            <path refid="path.libdev"/>
            <pathelement path="build/test"/>
        </path>
        <path id="path.coverage">
            <path refid="path.lib"/>
            <path refid="path.libdev"/>
            <pathelement path="build/test"/>
            <pathelement path="build/coverage"/>
        </path>
    </target>

    <target name="compile" depends="init" description="Compile">
        <compile module="main" refid="path.lib" source="1.2" target="1.2" bootclasspath="${compile.bootclasspath.12}"/>
        <compile module="apng" refid="path.main" source="1.2" target="1.2" bootclasspath="${compile.bootclasspath.12}"/>
    </target>

    <target name="compile-viewer" depends="compile" description="Compile viewer">
        <compile module="viewer" refid="path.apng"/>
    </target>

    <target name="compile-iio" depends="compile" description="Compile ImageIO plugin">
        <compile module="iio" refid="path.main" source="1.4" target="1.4" bootclasspath="${compile.bootclasspath.14}"/>
    </target>

    <target name="compile-examples" depends="compile-iio" description="Compile examples">
        <compile module="examples" refid="path.iio"/>
    </target>

    <target name="compile-test" depends="compile-examples" description="Compile tests">
        <compile module="test" refid="path.examples"/>
    </target>

    <target name="compile-all" depends="compile-test,compile-viewer" description="Compile all classes"/>

    <macrodef name="compile">
        <attribute name="module"/>
        <attribute name="refid"/>
        <attribute name="bootclasspath" default=""/>
        <attribute name="source" default="1.5"/>
        <attribute name="target" default="1.5"/>
        <sequential>
            <mkdir dir="build/@{module}"/>
            <copy todir="build/@{module}">
                <fileset dir="src/@{module}" excludes="**/*.java"/>
            </copy>
            <javac srcdir="src/@{module}" destdir="build/@{module}"
              source="@{source}"
              target="@{target}" bootclasspath="@{bootclasspath}" extdirs="${compile.extdirs}"
              debug="${compile.debug}" optimize="${compile.optimize}" deprecation="${compile.deprecation}">
                 <classpath refid="@{refid}"/>
            </javac>
        </sequential>
    </macrodef>

    <macrodef name="mytest">
        <attribute name="includes" default="**/Test*.java"/>
        <attribute name="refid"/>
        <attribute name="fork" default="false"/>
        <attribute name="usefile" default="false"/>
        <sequential>
            <junit fork="@{fork}">
                <sysproperty key="testmethods" value="${testmethods}"/>
                <formatter type="brief" usefile="@{usefile}"/>
                <classpath refid="@{refid}"/>
                <test name="${testcase}" if="testcase"/>
                <batchtest unless="testcase">
                    <fileset dir="src/test" includes="@{includes}"/>
                </batchtest>
            </junit>
        </sequential>
    </macrodef>

    <!-- TODO: stylesheetfile -->
    <macrodef name="myjavadoc">
        <attribute name="destdir"/>
        <sequential>
            <mkdir dir="@{destdir}"/>
            <javadoc 
              sourcepath="src/main"
              destdir="@{destdir}"
              access="${javadoc.access}"
              failonerror="true"
              packagenames="com.sixlegs.png.*"
              classpathref="path.main"
              Author="true"
              Version="true"
              Use="true"
            >
                <link href="http://java.sun.com/javase/6/docs/api/"/>
            </javadoc>
        </sequential>
    </macrodef>

    <target name="javadoc" depends="compile" description="Generate the javadoc">
        <myjavadoc destdir="javadoc"/>
        <replaceregexp match="Generated by javadoc ([^-]|(-[^-]))+--"
            replace="Generated by javadoc --" byline="true">
            <fileset dir="javadoc" includes="**/*.html"/>
        </replaceregexp>
    </target>

    <target name="test" depends="compile-test" description="Run JUnit tests">
        <mytest refid="path.test" includes="com/sixlegs/png/Test*.java"/>
        <mytest refid="path.test" includes="com/sixlegs/png/iio/Test*.java" usefile="true"/>
    </target>

    <target name="todo" depends="compile-test" description="Known JUnit failures">
        <mytest refid="path.test" includes="**/*Todo.java"/>
    </target>

    <target name="coverage" depends="compile-test" description="Generate code coverage report">
        <taskdef resource="tasks.properties" classpathref="path.libdev"/>
        <delete file="cobertura.ser"/>
        <mkdir dir="build/coverage"/>
        <copy todir="build/coverage" overwrite="true">
            <fileset dir="build/main"/>
        </copy>
        <cobertura-instrument>
            <fileset dir="build/coverage" includes="**/*.class"/>
        </cobertura-instrument>
        <mytest refid="path.coverage" includes="com/sixlegs/png/Test*.java" fork="true"/>
        <mkdir dir="reports"/>
        <cobertura-report destdir="reports/coverage">
            <fileset dir="src/main"/>
        </cobertura-report>
    </target>

    <macrodef name="viewerImpl">
        <attribute name="file"/>
        <sequential>
            <java classname="com.sixlegs.png.viewer.Viewer" classpathref="path.viewer" fork="true">
                <arg value="@{file}"/>
            </java>
        </sequential>
    </macrodef>

    <target name="viewer" depends="compile-viewer" description="Run PNG Viewer application">
        <viewerImpl file="${viewer.file}"/>
    </target>

    <target name="suite" depends="compile-test,compile-viewer" description="Decode and display PngSuite">
        <delete file="${suite.file}"/>
        <java classname="com.sixlegs.png.SuiteViewer" classpathref="path.test">
            <arg value="${suite.file}"/>
        </java>
        <viewerImpl file="${suite.file}"/>
    </target>

    <target name="benchmark" depends="compile-test" description="Run simple benchmark">
        <java classname="com.sixlegs.png.Benchmark" classpathref="path.test" input="${benchmark.file}">
            <arg value="${benchmark.loop}"/>
        </java>
    </target>

    <target name="broken" depends="compile-test" description="Regenerate broken images">
        <java classname="BrokenGenerator" classpathref="path.test" fork="true" dir="src/test/images"/>
    </target>

    <target name="clean" description="Clean">
        <delete dir="build"/>
        <delete dir="dist"/>
        <delete dir="reports"/>
        <delete file="cobertura.ser"/>
        <delete file="${suite.file}"/>
        <delete>
            <fileset dir="." includes="TEST*"/>
        </delete>
        <delete>
            <fileset dir="javadoc" includes="**/*"/>
        </delete>
    </target>

    <target name="jar-gif2apng" depends="compile-all" description="Create gif2apng jar">
        <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpathref="path.libdev"/>
        <mkdir dir="dist"/>
        <jarjar jarfile="dist/gif2apng-${version.tools}.jar">
            <fileset dir="build/examples"/>
            <keep pattern="com.sixlegs.png.examples.AnimatedGif2Png"/>
            <manifest>
                <attribute name="Main-Class" value="com.sixlegs.png.examples.AnimatedGif2Png"/>
                <attribute name="Implementation-Version" value="${version.tools}"/>
            </manifest>
        </jarjar>
    </target>

    <target name="jar-viewer" depends="compile-all" description="Create viewer jar">
        <mkdir dir="dist"/>
        <jar jarfile="dist/pngviewer-${version.tools}.jar">
            <fileset dir="build/main"/>
            <fileset dir="build/apng"/>
            <fileset dir="build/viewer"/>
            <manifest>
                <attribute name="Main-Class" value="com.sixlegs.png.viewer.Viewer"/>
                <attribute name="Implementation-Version" value="${version.tools}"/>
            </manifest>
        </jar>
    </target>

    <target name="jar" depends="compile-all" description="Create jar">
        <mkdir dir="dist"/>
        <jar jarfile="dist/${prefix}.jar">
            <fileset dir="build/main"/>
            <manifest>
                <attribute name="Implementation-Version" value="${version}"/>
            </manifest>
        </jar>
    </target>

    <target name="jar-all" depends="jar, jar-iio, jar-gif2apng, jar-viewer" description="Create all jar files"/>

    <target name="jar-iio" depends="compile-iio, jar" description="Create ImageIO plugin jar">
        <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpathref="path.libdev"/>
        <mkdir dir="build/services"/>
        <echo file="build/services/javax.imageio.spi.ImageReaderSpi">com.sixlegs.png.iio.PngImageReaderSpi</echo>
        <jarjar jarfile="dist/${prefix}-iio.jar">
            <zipfileset src="dist/${prefix}.jar" excludes="*,META-INF/*"/>
            <rule pattern="com.sixlegs.png.*" result="com.sixlegs.png.iio.impl.@1"/>
            <fileset dir="build/iio"/>
            <manifest>
                <attribute name="Implementation-Version" value="${version}"/>
            </manifest>
            <metainf dir="build" includes="services/**"/>
        </jarjar>
    </target>

    <target name="dist-broken" depends="broken" description="Create broken suite distribution">
        <tstamp/>
        <mkdir dir="dist"/>
        <zip zipfile="dist/brokensuite-${DSTAMP}.zip">
            <fileset dir="src/test/images/broken" includes="*.png"/>
        </zip>
    </target>

    <target name="dist" depends="clean,test,jar,javadoc" description="Create source distribution">
        <mkdir dir="dist"/>
        <jar jarfile="dist/${prefix}-src.jar" filesonly="true">
            <zipfileset dir="src" prefix="${prefix}/src">
                <exclude name="**/*.java~"/>
                <exclude name="**/*.save"/>
                <exclude name="test/images/nodist/*.png"/>
            </zipfileset>
            <zipfileset dir="lib" prefix="${prefix}/lib"/>
            <zipfileset dir="libdev" prefix="${prefix}/libdev">
                <include name="jarjar.jar"/>
                <include name="xml-writer.jar"/>
                <include name="bzip2.jar"/>
            </zipfileset>
            <zipfileset dir="." prefix="${prefix}" includes="build.xml,COPYING,LICENSE,README,benchmark.txt,javadoc/**"/>
            <zipfileset dir="dist" prefix="${prefix}/dist" includes="${prefix}.jar,${prefix}-iio.jar,javadoc/**"/>
        </jar>
    </target>
</project>