-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.xml
187 lines (163 loc) · 7.92 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
186
187
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-License-Identifier: 0BSD -->
<!-- SPDX-FileCopyrightText: The XZ for Java authors and contributors -->
<!-- SPDX-FileContributor: Lasse Collin <[email protected]> -->
<project name="XZ" default="jar"
xmlns:if="ant:if" xmlns:unless="ant:unless">
<property file="build.properties"/>
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd'T'HH:mm:ssXXX"/>
</tstamp>
<target name="clean"
description="Deletes all generated files">
<delete dir="${build_dir}"/>
</target>
<target name="dist"
description="Creates a source package (.zip) using 'git archive'">
<mkdir dir="${dist_dir}"/>
<exec output="${dist_file}" logError="true" failonerror="true"
executable="git">
<arg line="archive --format=zip -9 HEAD"/>
</exec>
</target>
<target name="doc"
description="Generates HTML documentation with javadoc">
<mkdir dir="${doc_dir}"/>
<javadoc sourcepath="${src_dir}" destdir="${doc_dir}"
failonerror="true"
packagenames="org.tukaani.xz"
windowtitle="${title}"
nodeprecatedlist="true" nohelp="true">
<arg value="-notimestamp"/>
<!-- javadoc's -locale option is buggy in OpenJDK 11/17/22.
In OpenJDK 8 it works. Overriding JVM's default locale
works with all versions, so do that instead of using
locale="en" or locale="en_US". See:
https://bugs.openjdk.org/browse/JDK-8222793 -->
<arg if:true="${javadoc_english}"
line="-J-Duser.language=en -J-Duser.country=US"/>
</javadoc>
</target>
<target name="compile" description="Compiles the classes">
<mkdir dir="${classes_dir}"/>
<javac srcdir="." sourcepath="${src_dir}" destdir="${classes_dir}"
includeAntRuntime="false" debug="${debug}"
source="${sourcever}" target="${sourcever}"
release="${sourcever}"
includesfile="fileset-src.txt"
excludes="**/package-info.java">
<compilerarg compiler="modern" line="-Xlint -Xlint:-options"/>
<compilerarg compiler="modern" line="-implicit:none"/>
</javac>
<mkdir unless:true="${java8only}" dir="${classes9_dir}"/>
<javac unless:true="${java8only}"
srcdir="." sourcepath="${src9_dir}:${src_dir}"
destdir="${classes9_dir}"
includeAntRuntime="false" debug="${debug}"
release="${sourcever9}"
includesfile="fileset-src9.txt">
<compilerarg compiler="modern" line="-Xlint"/>
<compilerarg compiler="modern" line="-implicit:none"/>
</javac>
</target>
<target name="manifest">
<mkdir dir="${manifest_dir}"/>
<manifest file="${manifest_base}">
<!-- The exact Ant version used for the build shouldn't make
any difference in the produced files, so don't let it
affect the manifest either. -->
<attribute name="Ant-Version" value="Intentionally omitted"
if:true="${manifest_cleanup}"/>
<!-- Compiler output varies between major OpenJDK releases but
it can be stable between minor releases, thus the minor
version information can be annoying for reproducible builds.
java.specification.version contains only the major version.
It's already used by Maven Archiver for Build-Jdk-Spec. -->
<attribute name="Created-By" value="${java.specification.version}"
if:true="${manifest_cleanup}"/>
<!-- Unconditionally add Build-Jdk-Spec too because its real-world
use is more clearly defined than that of Created-By. -->
<attribute name="Build-Jdk-Spec"
value="${java.specification.version}"/>
</manifest>
</target>
<target name="jar" depends="compile, manifest"
description="Creates JAR packages">
<mkdir dir="${jar_dir}"/>
<jar destfile="${jar_dir}/xz.jar" modificationtime="${timestamp}"
manifest="${manifest_base}">
<fileset dir="${classes_dir}" includes="org/tukaani/xz/**"/>
<zipfileset prefix="META-INF/versions/9/" dir="${classes9_dir}"
unless:true="${java8only}"/>
<manifest>
<attribute name="Implementation-Title" value="${title}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-URL" value="${homepage}"/>
<attribute name="Sealed" value="true"/>
<attribute name="Multi-Release" value="true"
unless:true="${java8only}"/>
<!-- Attributes for OSGi bundles: -->
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-SymbolicName" value="org.tukaani.xz"/>
<attribute name="Bundle-Version" value="${version}"/>
<attribute name="Export-Package" value="org.tukaani.xz"/>
<attribute name="Bundle-Name" value="${title}"/>
<attribute name="Bundle-DocURL" value="${doc_url}"/>
<attribute name="Bundle-Copyright"
value="The XZ for Java authors and contributors"/>
<attribute name="Bundle-License" value="0BSD"/>
</manifest>
</jar>
<macrodef name="jar.program">
<attribute name="name"/>
<sequential>
<jar destfile="${jar_dir}/@{name}.jar"
modificationtime="${timestamp}"
manifest="${manifest_base}"
basedir="${classes_dir}"
includes="@{name}.class">
<manifest>
<attribute name="Main-Class" value="@{name}"/>
<attribute name="Class-Path" value="xz.jar"/>
</manifest>
</jar>
</sequential>
</macrodef>
<jar.program name="TestAllocSpeed"/>
<jar.program name="XZEncDemo"/>
<jar.program name="XZDecDemo"/>
<jar.program name="XZSeekEncDemo"/>
<jar.program name="XZSeekDecDemo"/>
<jar.program name="LZMAEncDemo"/>
<jar.program name="LZMADecDemo"/>
</target>
<target name="pom" description="Creates xz.pom for a Maven repository">
<mkdir dir="${pom_dir}"/>
<copy file="${pom_template}" tofile="${pom_dir}/xz.pom"
overwrite="true">
<filterset>
<filter token="VERSION" value="${version}"/>
<filter token="TITLE" value="${title}"/>
<filter token="HOMEPAGE" value="${homepage}"/>
</filterset>
</copy>
</target>
<target name="maven" depends="pom, manifest, doc, jar"
description="Creates POM and JAR files for a Maven repository">
<mkdir dir="${maven_dir}"/>
<copy file="${pom_dir}/xz.pom" tofile="${maven_dir}/xz-${version}.pom"
preservelastmodified="true" overwrite="true"/>
<copy file="${jar_dir}/xz.jar" tofile="${maven_dir}/xz-${version}.jar"
preservelastmodified="true" overwrite="true"/>
<jar destfile="${maven_dir}/xz-${version}-javadoc.jar"
modificationtime="${timestamp}"
manifest="${manifest_base}"
basedir="${doc_dir}"/>
<jar destfile="${maven_dir}/xz-${version}-sources.jar"
modificationtime="${timestamp}"
manifest="${manifest_base}">
<fileset dir="${src_dir}" includes="org/tukaani/xz/**"/>
<zipfileset prefix="META-INF/versions/9/" dir="${src9_dir}"/>
</jar>
</target>
</project>