Repository navigation
Expand file tree
/
Copy pathbuild.xml
More file actions
263 lines (232 loc) · 10.3 KB
/
Copy pathbuild.xml
File metadata and controls
263 lines (232 loc) · 10.3 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
<project name="Create IP Address API" default="run" basedir=".">
<description>Create IP address jar</description>
<property name="version" value="4.3.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}/../../Functional-Doclet-for-Javadoc/Functional Doclet for Javadoc" />
<property name="jarExtension" value=".jar"/>
<property name="src_location" value="${rootOffset}/src" />
<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>
<target name="compile">
<!-- rely on Eclipse compiler
<property name="java_level" value="1.8"/>
<javac srcdir="${src_location}" destdir="${bin_location}" debug="on"
source="${java_level}" target="${java_level}" failonerror="false" >
<include name="${rootPackagePath}/**/*.java"/>
</javac>
-->
</target>
<target name="create javadoc">
<echo>Looking for doclet in ${functional_doclet_dir}/dist/FunctionalDoclet.jar</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.util.sql,${rootPackage}.ipv6,${rootPackage}.ipv4,${rootPackage}.mac"
stylesheetfile="${functional_doclet_dir}/stylesheet_custom.css"
verbose="true"
author="true"
public="true"
use="true">
<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="${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="${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="${rootOffset}/javadoc" />
<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 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.
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
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>