-
Notifications
You must be signed in to change notification settings - Fork 3
/
build-obsolete.xml
302 lines (268 loc) · 11.5 KB
/
build-obsolete.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
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
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="giscore" default="compile">
<property file="local.properties"/>
<!-- Remove and reinstate ivy:buildnumber should that ever start working again -->
<property name="previous.revision" value="1.8.4" />
<property name="ivy.new.revision" value="2.0.0.snapshot-1" />
<!-- Create a local.properties to override defaults below -->
<property file="${basedir}/src/local.properties" />
<property name="basedir" value="."/>
<property name="src" value="${basedir}/src" />
<property name="test" value="${basedir}/test" />
<property name="lib" value="${basedir}/lib" />
<property name="rel" value="${basedir}/rel" />
<property name="classes" value="${rel}/classes" />
<property name="test.classes" value="${rel}/test" />
<property name="testoutput" value="${basedir}/testOutput" />
<property name="test.excludes" value="**/TestGISBase.java **/TestShapefileBase.java"/>
<property name="build.previous" value="${rel}/previous_build" />
<path id="project.classpath">
<fileset dir="lib">
<include name="**/*.jar" />
<exclude name="**/*-sources.jar" />
<exclude name="**/*-javadoc.jar" />
</fileset>
</path>
<target name="init" unless="ivy.default.ivy.user.dir">
<mkdir dir="${rel}" />
<mkdir dir="${classes}" />
<mkdir dir="${rel}/jars" />
<dependset>
<srcfilelist dir="${basedir}" files="ivy.xml,ivy.settings" />
<targetfileset dir="${lib}" />
</dependset>
<mkdir dir="${lib}" />
<property name="ivy.default.ivy.user.dir" value="${user.home}/.ivy2" />
<ivy:configure file="${basedir}/ivysettings.xml" />
<ivy:resolve file="${basedir}/ivy.xml" />
</target>
<target name="init.proxy">
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"
proxyuser="${proxy.user}" proxypassword="${proxy.pass}"
nonproxyhosts="${proxy.nonProxyHosts}" />
</target>
<target name="clean">
<delete dir="${lib}" />
<delete includeEmptyDirs="true">
<fileset dir="${rel}" includes="**/*" />
</delete>
</target>
<!-- =================================
target: clean-cache
================================= -->
<target name="clean-cache" description="--> clean the ivy cache">
<ivy:cleancache />
</target>
<target name="resolve" depends="init,init.proxy" description="retrieve dependencies with ivy">
<mkdir dir="${lib}" />
<property name="ivy.retrieve.pattern" value="lib(/[organization])(/[module])/[artifact]-[revision](-[type]).[ext]" />
<ivy:retrieve />
</target>
<target name="generate-eclipse-classpath.real" depends="resolve">
<property name="eclipse.gen.prefix" value=' <classpathentry kind="lib" path="' />
<property name="eclipse.gen.suffix" value='"/>' />
<pathconvert pathsep="${eclipse.gen.suffix}${line.separator}${eclipse.gen.prefix}" property="eclipse-classpath" refid="project.classpath" />
<dependset>
<srcfilelist dir="${basedir}" files="build.xml .classpath.src" />
<srcfileset dir="${basedir}">
<include name="ivy*.xml" />
</srcfileset>
<targetfilelist dir="${basedir}" files=".classpath" />
</dependset>
<copy file=".classpath.src" tofile=".classpath" overwrite="false">
<filterchain>
<replacetokens>
<token key="ANT_CLASSPATH" value="${eclipse.gen.prefix}${eclipse-classpath}${eclipse.gen.suffix}" />
</replacetokens>
<tokenfilter>
<replacestring from="${basedir}" to="" />
<replacestring from="\" to="/" />
<replacestring from="/lib" to="lib" />
</tokenfilter>
</filterchain>
</copy>
</target>
<target name="generate-jni" depends="compile">
<mkdir dir="${rel}/jni"/>
<javah destdir="${rel}/jni">
<classpath>
<path refid="project.classpath" />
<pathelement location="${classes}"/>
</classpath>
<class name="org.opensextant.giscore.filegdb.Geodatabase" />
<class name="org.opensextant.giscore.filegdb.Table" />
<class name="org.opensextant.giscore.filegdb.Row" />
<class name="org.opensextant.giscore.filegdb.EnumRows" />
</javah>
</target>
<target name="generate-eclipse-classpath.clean">
<delete file=".classpath" quiet="true" />
</target>
<target name="generate-eclipse-classpath" depends="generate-eclipse-classpath.clean, generate-eclipse-classpath.real" description="Generate the Eclipse classpath." />
<target name="generate-netbeans-classpath" depends="resolve" description="Generate the NetBeans classpath.">
<fail message="Could not find NetBeans project file.">
<condition>
<not>
<available file="nbproject/project.xml"/>
</not>
</condition>
</fail>
<mkdir dir="${basedir}/nbproject/private"/>
<pathconvert dirsep="/" pathsep=";" property="netbeans-classpath.src" refid="project.classpath" />
<pathconvert dirsep="/" pathsep=";" property="netbeans-classpath.test" refid="project.classpath" />
<!-- The goofy indentation is intentional because this being output to a file. -->
<echo file="${basedir}/nbproject/private/classpath.properties" append="false">src.classpath=${netbeans-classpath.src}
test.classpath=${classes};${netbeans-classpath.test}
</echo>
<touch file="nbproject/project.xml" />
</target>
<target name="compile" depends="resolve">
<javac source="1.6" target="1.6" classpathref="project.classpath" srcdir="${src}"
destdir="${classes}"
includeantruntime="false"
debug="true"/>
</target>
<target name="compileTests" depends="compile">
<mkdir dir="${test.classes}" />
<javac source="1.6" target="1.6" srcdir="${basedir}/test"
debug="true"
includeantruntime="false"
destdir="${test.classes}"
encoding="ISO-8859-1">
<classpath>
<pathelement path="${classes}" />
<path refid="project.classpath" />
</classpath>
</javac>
</target>
<!-- This had been an OSGI jar, but for now we're back to building just a regular jar -->
<target name="jar" depends="compile, package-filegdb">
<!-- <ivy:buildnumber revision="0.4" organisation="org.mitre.itf" module="giscore" resolver="maven-proxy-local" /> -->
<jar destfile="${rel}/jars/giscore.jar" basedir="${classes}" />
</target>
<macrodef name="package-library">
<attribute name="lib" />
<attribute name="os" />
<attribute name="ext" />
<attribute name="package" />
<attribute name="pre" default="" />
<sequential>
<mkdir dir="${classes}/@{package}/@{os}"/>
<propertyfile file="${classes}/@{package}/@{os}/filegdb.properties">
<entry key="modified" value="now" type="date" pattern="yyyy/MM/dd" />
<entry key="filename" value="@{pre}filegdb.@{ext}"/>
</propertyfile>
<copy file="@{lib}" todir="${classes}/@{package}/@{os}" />
</sequential>
</macrodef>
<target name="package-filegdb">
<package-library lib="${basedir}/filegdb/win64/filegdb/x64/Release/filegdb.dll"
package="org/opensextant/giscore/filegdb" os="win64" ext="dll" />
<package-library
lib="${basedir}/filegdb/linux/filegdb/dist/Release/GNU-Linux-x86/libfilegdb.so"
package="org/opensextant/giscore/filegdb" os="linux64" ext="so" pre="lib" />
</target>
<target name="test" depends="compileTests" description="Run JUnit tests">
<mkdir dir="${testoutput}" />
<junit printsummary="yes" haltonfailure="no" maxmemory="1024m" fork="yes">
<assertions>
<enable package="org.opensextant.giscore"/>
</assertions>
<jvmarg value="-DkeepTempFiles=false" />
<classpath>
<pathelement path="${classes}" />
<pathelement path="${test.classes}" />
<path refid="project.classpath" />
</classpath>
<formatter type="plain" />
<formatter type="xml" />
<batchtest fork="yes" todir="${testoutput}">
<fileset dir="${test}"
excludes="${test.excludes}"
/>
</batchtest>
</junit>
</target>
<target name="pom" depends="jar">
<ivy:resolve revision="${ivy.new.revision}" file="${basedir}/ivy.xml"
resolveid="ivyres" />
<ivy:deliver revision="${ivy.new.revision}" resolveid="ivyres"
deliverpattern="${rel}/ivy.xml" />
<ivy:makepom ivyfile="${basedir}/rel/ivy.xml" pomfile="${rel}/giscore.pom"
settingsref="ivy.instance">
<mapping conf="compile" scope="compile" />
<mapping conf="runtime" scope="runtime" />
<mapping conf="test" scope="test" />
</ivy:makepom>
</target>
<target name="publish-local" depends="pom, javadoc, sourcejar"
description="Copy the Jar and Ivy file to the local cache.">
<!-- A better default? <ivy:deliver deliverpattern="${dist}/[type]s/[artifact]-[revision](-[classifier]).[ext]"/> -->
<echo>Publishing revision ${ivy.new.revision}</echo>
<ivy:publish resolver="libraries" update="true" revision="${ivy.new.revision}" overwrite="true">
<artifacts pattern="rel/[artifact].[ext]" />
<artifacts pattern="rel/jars/[artifact].[ext]" />
</ivy:publish>
</target>
<target name="publish" depends="pom, javadoc, sourcejar"
description="Publish directly to a repository">
<echo>Publishing revision ${ivy.new.revision}</echo>
<ivy:publish resolver="maven-proxy-local" revision="${ivy.new.revision}"
warnonmissing="true" conf="compile" overwrite="false">
<artifacts pattern="rel/[artifact].[ext]" />
<artifacts pattern="rel/jars/[artifact].[ext]" />
</ivy:publish>
<ivy:publish resolver="maven-proxy-local-extra" revision="${ivy.new.revision}"
warnonmissing="true" conf="pubextra" publishivy="false" overwrite="false">
<artifacts pattern="rel/[artifact]-[type].[ext]" />
</ivy:publish>
</target>
<target name="sourcejar">
<jar destfile="${rel}/giscore-sources.jar">
<fileset dir="${src}" />
</jar>
</target>
<target name="javadoc" depends="resolve">
<mkdir dir="${rel}/docs" />
<javadoc packagenames='org.opensextant.giscore.*'
additionalparam="-breakiterator"
sourcepath="${src}" destdir='${rel}/docs'
overview="${src}/javadocOverview.html"
author='false'
public='true'
classpathref="project.classpath"
windowtitle='GIScore Package' doctitle='GIScore'
locale='en_US'>
<bottom><![CDATA[<i>Copyright © 2009 MITRE Corp. All Rights Reserved.</i>]]></bottom>
</javadoc>
<jar destfile="${rel}/giscore-javadoc.jar">
<fileset dir="${rel}/docs" />
</jar>
</target>
<target name="api-compatibility" depends="jar" description="Compare the latest build to the previous version to detect API changes.">
<ivy:cachepath pathid="clirr.path" organisation="net.sf.clirr" module="clirr-core" revision="0.6-mitre" conf="default" inline="true"/>
<taskdef resource="clirrtask.properties" classpathref="clirr.path" />
<fail unless="previous.revision" message="The previous.revision property was not set, could not load the last release for API comparison."/>
<ivy:retrieve inline="true" conf="default" organisation="org.opensextant" module="giscore" revision="${previous.revision}" sync="true" pattern="${build.previous}/[organization].[artifact]-[revision].[ext]" />
<property name="previous.jar" value="org.opensextant.giscore-${previous.revision}.jar"/>
<fail message="Could not find previous revision at ${build.previous}/${previous.jar}">
<condition>
<not>
<available file="${build.previous}/${previous.jar}"/>
</not>
</condition>
</fail>
<delete file="${build}/clirr.xml"/>
<clirr failOnBinError="false" failOnSrcError="false">
<origclasspath>
<fileset dir="${build.previous}">
<exclude name="${previous.jar}"/>
</fileset>
</origclasspath>
<newclasspath refid="project.classpath"/>
<origFiles dir="${build.previous}" includes="${previous.jar}"/>
<newFiles dir="${rel}/jars/" includes="giscore.jar"/>
<formatter type="xml" outfile="${build}/clirr.xml"/>
</clirr>
</target>
</project>