Repository navigation
Expand file tree
/
Copy pathbuild.xml
More file actions
301 lines (271 loc) · 13.1 KB
/
Copy pathbuild.xml
File metadata and controls
301 lines (271 loc) · 13.1 KB
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
<project name="Create IP Address API" default="run" basedir=".">
<description>Create IP address jar</description>
<property name="version" value="5.0.0"/>
<property name="rootOffset" value="."/>
<property name="rootdistdir" location="${rootOffset}/dist"/>
<property name="javadocdir" value="javadoc"/>
<property name="rootjavadocdir" location="${rootOffset}/${javadocdir}"/>
<property name="functional_doclet_dir" location="${rootOffset}/../../../git/Functional-Doclet-for-Javadoc/Functional Doclet for Javadoc" />
<property name="jarExtension" value=".jar"/>
<property name="module" value="/inet.ipaddr" />
<property name="src_location" value="${rootOffset}/src${module}" />
<property name="bin_location" value="${rootOffset}/bin" />
<property name="rootPackage" value="inet.ipaddr"/>
<property name="rootPackagePath" value="inet/ipaddr"/>
<property name="runScriptName" value="ip_address_test" />
<property name="runScriptPath" value="${rootdistdir}/${runScriptName}" />
<property name="jarname" value="IPAddress${jarExtension}" />
<target name="check root dist dir">
<available property="rootdistdir.exists" file="${rootdistdir}" />
</target>
<target name="generate time stamps" >
<tstamp> <!-- creates the variables DSTAMP, TSTAMP, TODAY -->
<format property="timestamp.full" pattern="yyyyMMdd-HHmmss"/>
</tstamp>
<echo message="build date: ${DSTAMP}, build time: ${TSTAMP}"/>
<property name="timestamp" value="${timestamp.full}"/>
</target>
<target name="create dist name" depends="generate time stamps" >
<property name="archivename" value="IPAddress_v${version}_${timestamp}${jarExtension}" />
</target>
<target name="create run script" depends="create dist name">
<concat destfile="${runScriptPath}.sh">#!/bin/sh
# Do not edit this file, it is generated by build.xml
java -cp ${jarname} ${rootPackage}.test.TestRunner fast performance
</concat>
<fixcrlf file="${runScriptPath}.sh" eol="lf"/>
<echo message="created ${runScriptPath}.sh"/>
</target>
<!-- as it is now, you need to run the ant compile with jqvq 9 or higher.
Turns out to do tht it must be run in the same jvm as eclipse, otherwise ant don't work -->
<!-- But javadoc can only be done with a java 8 env. For one thing, the classes were moved over in java 9,
although the old ones still there in 9, but trying to port proved troublesome and would require more debugging -->
<!-- So, to create dist jar, or maven artifacts, you need to split up javadoc task from the other stuff -->
<!-- once you've done that and created all the jars as necessary, you need to run the ant javadoc in java 1.8 execution environment -->
<!-- it strikes me that this PITA can only be fixed if you port the doclet to java 9 or 10,
and for that it seems the only way is to fork the jdk.javadoc module for your own modifications,
there seems to be no way to run with java 9 vm and access their unreachable javadoc code from my own code,
and even if you could reach that code, the code has changed enough to make porting difficult -
I managed a port of the old java 8 code still residing in java 9 jre, and somehow I ran javadoc tool with that,
but it did not work well and would have required debugging. -->
<!-- All of this would be fine with java 8 if module-info.java was not there. It would be fine java 9 if the doclet stuff worked -->
<target name="compile">
<delete verbose="false" includeemptydirs="true">
<fileset dir="${bin_location}">
<include name="**/*.class" />
</fileset>
</delete>
<!-- first compile entirely as java 9 to ensure compliance with module configuration -->
<javac srcdir="${src_location}" destdir="${bin_location}" debug="on"
source="9" target="9" failonerror="false" verbose="false" createMissingPackageInfoClass="false">
<include name="${rootPackagePath}/**/*.java"/>
</javac>
<!-- compile as java 8, excluding module-info.java, and leave the existing java 10 module-info -->
<delete verbose="false" includeemptydirs="true">
<fileset dir="${bin_location}">
<include name="**/*.class" />
<exclude name="**/module-info.class"/><!-- leave the java 10 module-info.class -->
</fileset>
</delete>
<javac srcdir="${src_location}" destdir="${bin_location}" debug="on"
source="1.8" target="1.8" failonerror="false" verbose="false" createMissingPackageInfoClass="false"
deprecation="true">
<include name="${rootPackagePath}/**/*.java"/>
<exclude name="${rootPackagePath}/module-info.java"/>
</javac>
</target>
<target name="create javadoc">
<echo>${functional_doclet_dir}</echo>
<mkdir dir="${rootjavadocdir}"/>
<delete includeemptydirs="true" verbose="true">
<fileset dir="${rootjavadocdir}" includes="**/*"/>
</delete>
<!-- these packages used internally - ${rootPackage}.format.validate -->
<javadoc sourcepath="${src_location}" destdir="${rootjavadocdir}"
packagenames="${rootPackage}, ${rootPackage}.format, ${rootPackage}.format.util,
${rootPackage}.format.standard, ${rootPackage}.format.large, ${rootPackage}.format.string,
${rootPackage}.format.util.sql, ${rootPackage}.ipv6, ${rootPackage}.ipv4, ${rootPackage}.mac"
stylesheetfile="${functional_doclet_dir}/stylesheet_custom.css"
verbose="true"
author="true"
public="true"
use="true"
Windowtitle="IPAddress javadoc by seancfoley"
doctitle="IPAddress Java library for handling IP addresses and subnets, both IPv4 and IPv6"
>
<doclet name="tools.doclets.formats.html.FunctionalDoclet"
path="${functional_doclet_dir}/dist/FunctionalDoclet.jar">
<param name="-tag" value="custom.core:a:Core" />
</doclet>
<classpath>
<pathelement location="${bin_location}"/>
</classpath>
</javadoc>
</target>
<target name="create file sets">
<fileset id="ipaddress.src" dir="${src_location}">
<include name="module-info.java" />
<include name="${rootPackagePath}/*.java" />
<include name="${rootPackagePath}/format/**/*.java" />
<include name="${rootPackagePath}/ipv4/**/*.java" />
<include name="${rootPackagePath}/ipv6/**/*.java" />
<include name="${rootPackagePath}/mac/**/*.java" />
</fileset>
<fileset id="ipaddress.src.xml" dir="${src_location}">
<include name="${rootPackagePath}/**/*.xml" />
</fileset>
<fileset id="ipaddress.src.test" dir="${src_location}">
<include name="${rootPackagePath}/test/**/*.java" />
</fileset>
<fileset id="ipaddress.src.properties" dir="${src_location}">
<include name="${rootPackagePath}/**/*.properties" />
</fileset>
<fileset id="ipaddress.jar.contents" dir="${bin_location}">
<include name="module-info.class" />
<include name="${rootPackagePath}/*.class" />
<include name="${rootPackagePath}/format/**/*.class" />
<include name="${rootPackagePath}/ipv4/*.class" />
<include name="${rootPackagePath}/ipv6/*.class" />
<include name="${rootPackagePath}/mac/*.class" />
<include name="${rootPackagePath}/**/*.properties" />
</fileset>
<fileset id="ipaddress.jar.test.contents" dir="${bin_location}">
<include name="${rootPackagePath}/test/**/*.class" />
</fileset>
<fileset id="ipaddress.javadoc.folder" dir="${rootOffset}">
<include name="${javadocdir}/**/*.*" />
</fileset>
<fileset id="ipaddress.javadoc" dir="${rootjavadocdir}" />
<fileset id="ipaddress.docs" dir="${rootOffset}">
<include name="docs.pdf" />
</fileset>
</target>
<target name="create class jar" depends="compile, create file sets, create dist name">
<property name="jarloc" location="${rootdistdir}/${jarname}" />
<jar destfile="${jarloc}" filesonly="true">
<manifest>
<attribute name="Version" value="${version}"/>
<attribute name="Timestamp" value="${timestamp}"/>
</manifest>
<fileset refid="ipaddress.jar.contents" />
</jar>
<echo message ="Class files included: ${toString:ipaddress.jar.contents}" />
</target>
<!-- target name="create dist jar" depends="compile, create file sets, create javadoc, create dist name" -->
<target name="create dist jar" depends="compile, create file sets, create dist name">
<property name="archiveloc" location="${rootdistdir}/${archivename}" />
<jar destfile="${archiveloc}" filesonly="true">
<manifest>
<attribute name="Version" value="${version}"/>
<attribute name="Timestamp" value="${timestamp}"/>
</manifest>
<fileset refid="ipaddress.src" />
<fileset refid="ipaddress.src.xml" />
<fileset refid="ipaddress.src.test" />
<fileset refid="ipaddress.jar.contents" />
<fileset refid="ipaddress.jar.test.contents" />
<fileset refid="ipaddress.javadoc.folder" />
<fileset refid="ipaddress.docs" />
</jar>
<echo message ="Source files included: ${toString:ipaddress.src}" />
</target>
<!-- define Maven coordinates -->
<property name="groupId" value="com.github.seancfoley" />
<property name="artifactId" value="ipaddress" />
<!-- define artifacts' name, which follows the convention of Maven -->
<property name="jar" value="${rootdistdir}/mavenlib/${artifactId}-${version}.jar" />
<property name="javadoc-jar" value="${rootdistdir}/mavenlib/${artifactId}-${version}-javadoc.jar" />
<property name="sources-jar" value="${rootdistdir}/mavenlib/${artifactId}-${version}-sources.jar" />
<target name="create maven artifacts" depends="create dist jar">
<mkdir dir="${rootdistdir}/mavenlib"/>
<jar destfile="${jar}" filesonly="true" >
<fileset refid="ipaddress.jar.contents" />
</jar>
<jar destfile="${javadoc-jar}" filesonly="true">
<fileset refid="ipaddress.javadoc" />
</jar>
<jar destfile="${sources-jar}" filesonly="true">
<fileset refid="ipaddress.src" />
<fileset refid="ipaddress.src.properties" />
</jar>
<copy file="pom.xml" todir="${rootdistdir}/mavenlib" />
</target>
<target name="sign maven artifacts" depends="create maven artifacts">
<echo>
Running gpg from a JVM directly causes the JVM to hang, so run these from a cmd prompt,
or run the created batch file. Before running the commands, you may need to first run sudo -i
gpg -ab ${jar}
gpg -ab ${javadoc-jar}
gpg -ab ${sources-jar}
gpg -ab ${rootdistdir}/mavenlib/pom.xml
gpg --verify ${jar}.asc
gpg --verify ${javadoc-jar}.asc
gpg --verify ${sources-jar}.asc
gpg --verify ${rootdistdir}/mavenlib/pom.xml.asc
</echo>
<property name="batch" location="${rootdistdir}/mavenlib/sign.bat" />
<concat destfile="${batch}">
:: Do not edit this file, it is generated by build.xml
:: Before running the commands, you may need to first run sudo -i
gpg -ab ${jar}
gpg -ab ${javadoc-jar}
gpg -ab ${sources-jar}
gpg -ab ${rootdistdir}/mavenlib/pom.xml
gpg --verify ${jar}.asc
gpg --verify ${javadoc-jar}.asc
gpg --verify ${sources-jar}.asc
gpg --verify ${rootdistdir}/mavenlib/pom.xml.asc
</concat>
<fixcrlf file="${batch}" eol="crlf"/>
<echo message="created ${batch}"/>
<!--
<exec executable="cmd" os="Windows 7">
<arg line="/c ${batch}"/>
</exec>
<delete file="${batch}" />
-->
</target>
<target name="create maven bundle" >
<jar destfile="${rootdistdir}/bundle.jar" filesonly="true">
<fileset dir="${rootdistdir}/mavenlib">
<include name="*" />
</fileset>
</jar>
</target>
<!--
After bundling and signing, follow instructions here for manual deployment:
http://central.sonatype.org/pages/manual-staging-bundle-creation-and-deployment.html
which requires that you go here https://oss.sonatype.org/
to upload.
Your sonatype JIRA issue is https://issues.sonatype.org/browse/OSSRH-28545
-->
<target name="deploy" depends="create class jar, create run script">
<scp file="${runScriptPath}.sh" todir="${machine_user}@${machine}:${machine_dir}" password="${machine_pw}" trust="yes" />
<scp file="${jarloc}" todir="${machine_user}@${machine}:${machine_dir}" password="${machine_pw}" trust="yes" />
<sshexec host="${machine}" username="${machine_user}" password="${machine_pw}" trust="yes"
command="chmod 777 ${machine_dir}/*.sh; cd ${machine_dir}; ./${runScriptName}.sh"/>
</target>
<target name="clean binaries">
<echo message="deleting compiled files" />
<delete verbose="false" includeemptydirs="true">
<fileset dir="${bin_location}">
<include name="**/*.class" />
</fileset>
</delete>
</target>
<!-- =====================================================
Top level
===================================================== -->
<target name="run" description="run" depends="deploy">
<echo message="created web archive ${jarloc} executed on ${gmachine}"/>
</target>
<!-- =====================================================
Clean
===================================================== -->
<target name="clean previous deployments" depends="check root dist dir" if="rootdistdir.exists" description="remove previous distributions" >
<delete verbose="true" includeemptydirs="true">
<fileset dir="${rootdistdir}" />
<fileset dir="${rootdistdir}/mavenlib" />
</delete>
</target>
</project>