forked from opendcs/opendcs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.xml
301 lines (256 loc) · 13.1 KB
/
common.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
<project name="common" xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="ivy.install.version" value="2.5.0"/>
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME"/>
</condition>
<property name="ivy.home" value="${user.home}/.ant"/>
<property name="ivy.jar.dir" value="${ivy.home}/lib"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<property name="ivy.pom.url" value="https://github.com/opendcs/opendcs"/>
<property name="ivy.pom.name" value="OpenDCS"/>
<property name="ivy.pom.description" value="A collection of software for aggregatting and processing environmental data such as from NOAA GOES satellites."/>
<condition property="isUnix" value="true">
<os family="unix" />
</condition>
<property environment="env"/>
<tstamp>
<format property="snapshot.time" pattern="yyyyMMdd.hhmmss-1"/>
</tstamp>
<property name="project.dir" value="${basedir}"/>
<property name="src.main.dir" value="src/main"/>
<property name="src.dir" value="src/main/java"/>
<property name="src.test.dir" value="src/test"/>
<property name="src.test-integration.main.dir" value="src/test-integration"/>
<property name="src.test-gui.main.dir" value="src/test-gui"/>
<property name="src.test-lrgs.main.dir" value="src/test-lrgs"/>
<property name="build.dir" value="build"/>
<property name="reports.dir" value="${build.dir}/reports"/>
<property name="build.lib" value="${build.dir}/lib"/>
<property name="status.dir" value="${build.dir}/.status"/>
<property name="stage.dir" value="stage"/>
<property name="dist.jar" value="${build.lib}/opendcs.jar"/>
<property name="build.release.dir" value="${build.dir}/release"/>
<property name="spotbugs.output.dir" value="${reports.dir}/spotbugs"/>
<property name="pmd.output.dir" value="${build.dir}/reports/pmd"/>
<property name="junit.html.output.dir" value="${build.dir}/reports/junit"/>
<property name="coverage.dir" value="${build.dir}/coverage/"/>
<!-- Default includes for tests, user can override -->
<property name="tests.default" value="**/*Test*"/>
<property name="tests" value="${tests.default}"/>
<condition property="user_set_tests" value="true">
<not>
<equals arg1="${tests}" arg2="${tests.default}"/>
</not>
</condition>
<!-- VERSION NUMBERS -->
<property name="MAJ_VER" value="7"/>
<property name="MIN_VER" value="0"/>
<loadfile property="RCNUM" srcFile="${project.dir}/rcnum.txt">
<filterchain><striplinebreaks/></filterchain>
</loadfile>
<echo message="RCNUM=${RCNUM}"/>
<property name="version" value="${MAJ_VER}.${MIN_VER}.${RCNUM}"/>
<echo message="VERSION=${version}"/>
<target name="download-ivy" unless="offline">
<echo message="IVY jar dir ${ivy.jar.dir}"/>
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy,-get-junitlauncher">
<!-- try to load Ivy here from Ivy home, in case the user has not already dropped
it into Ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
Ivy is in at least one of Ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="check.ivy.src">
<uptodate property="ivy.current" targetFile="${status.dir}/src.deps">
<srcfiles dir=".">
<filename name="ivy.xml"/>
<filename name="ivysettings.xml"/>
</srcfiles>
<mapper type="merge" to="${status.dir}/src.deps"/>
</uptodate>
</target>
<target name="check.ivy.build">
<uptodate property="ivy.build.current" targetFile="${status.dir}/build.deps">
<srcfiles dir=".">
<filename name="ivy.xml"/>
<filename name="ivysettings.xml"/>
</srcfiles>
<mapper type="merge" to="${status.dir}/build.deps"/>
</uptodate>
</target>
<target name="resolve.real" depends="init-ivy" unless="ivy.current">
<ivy:retrieve conf="runtime,runtime_last,test,test_platform"
sync="true"
pattern="build/ivy/[conf]/[artifact](-[classifier])-[revision].[ext]"
/>
<ivy:cachepath pathid="runtime.classpath" conf="runtime,runtime_last"/>
<ivy:cachepath pathid="test.classpath" conf="test"/>
<ivy:cachepath pathid="junit.platform.libs.classpath" conf="test_platform"/>
<pathconvert property="runtime.classpath">
<path refid="runtime.classpath"/>
</pathconvert>
<pathconvert property="test.classpath">
<path refid="test.classpath"/>
</pathconvert>
<pathconvert property="junit.platform.libs.classpath">
<path refid="junit.platform.libs.classpath"/>
</pathconvert>
<propertyfile file="${status.dir}/src.deps">
<entry key="runtime.classpath" value="${runtime.classpath}"/>
<entry key="test.classpath" value="${test.classpath}"/>
<entry key="junit.platform.libs.classpath" value="${junit.platform.libs.classpath}"/>
</propertyfile>
</target>
<target name="resolve.cached" if="ivy.current" depends="check.ivy.src">
<echo message="Loading cached deps (src)."/>
<loadproperties prefix="cached" srcFile="${status.dir}/src.deps"/>
<path id="junit.platform.libs.classpath">
<pathelement path="${cached.junit.platform.libs.classpath}"/>
</path>
<path id="test.classpath">
<pathelement path="${cached.test.classpath}"/>
</path>
<path id="runtime.classpath">
<pathelement path="${cached.runtime.classpath}"/>
</path>
</target>
<target name="resolve" description="--> retreive dependencies with ivy" depends="check.ivy.src,resolve.real,resolve.cached">
</target>
<target name="resolve.build.cached" if="ivy.build.current" depends="check.ivy.build">
<echo message="Loading cached deps (build)."/>
<loadproperties prefix="cached" srcFile="${status.dir}/build.deps"/>
<path id="build.classpath">
<pathelement path="${cached.build.classpath}"/>
</path>
<path id="izpack.classpath">
<pathelement path="${cached.izpack.classpath}"/>
</path>
<path id="groovy.classpath">
<pathelement path="${cached.groovy.classpath}"/>
</path>
<path id="spotbugs.classpath">
<pathelement path="${cached.spotbugs.classpath}"/>
</path>
<path id="pmd.classpath">
<pathelement path="${cached.pmd.classpath}"/>
</path>
</target>
<target name="resolve.build.real" depends="init-ivy,check.ivy.build" description="--> retrieve build script dependencies" unless="ivy.build.current">
<ivy:retrieve conf="build,groovy,izpack,spotbugs,pmd"
sync="true"
pattern="build/ivy-build/[conf]/[artifact](-[classifier])-[revision].[ext]"
/>
<ivy:cachepath pathid="izpack.classpath" conf="izpack"/>
<ivy:cachepath pathid="groovy.classpath" conf="groovy"/>
<ivy:cachepath pathid="build.classpath" conf="build"/>
<ivy:cachepath pathid="spotbugs.classpath" conf="spotbugs"/>
<ivy:cachepath pathid="pmd.classpath" conf="pmd"/>
<pathconvert property="izpack.classpath">
<path refid="izpack.classpath"/>
</pathconvert>
<pathconvert property="groovy.classpath">
<path refid="groovy.classpath"/>
</pathconvert>
<pathconvert property="build.classpath">
<path refid="build.classpath"/>
</pathconvert>
<pathconvert property="spotbugs.classpath">
<path refid="spotbugs.classpath"/>
</pathconvert>
<pathconvert property="pmd.classpath">
<path refid="pmd.classpath"/>
</pathconvert>
<propertyfile file="${status.dir}/build.deps">
<entry key="izpack.classpath" value="${izpack.classpath}"/>
<entry key="groovy.classpath" value="${groovy.classpath}"/>
<entry key="build.classpath" value="${build.classpath}"/>
<entry key="spotbugs.classpath" value="${spotbugs.classpath}"/>
<entry key="pmd.classpath" value="${pmd.classpath}"/>
</propertyfile>
</target>
<target name="resolve.build" description="--> retreive dependencies with ivy" depends="check.ivy.build,resolve,resolve.build.real,resolve.build.cached">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="build.classpath"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="build.classpath"/>
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
classpathref="build.classpath"/>
<taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties"
classpathref="build.classpath"/>
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask"
classpathref="pmd.classpath"/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"
classpathref="build.classpath"/>
<mkdir dir="${coverage.dir}"/>
</target>
<target name="report" depends="resolve.real,resolve.build.real" description="--> generates a report of dependencies">
<mkdir dir="${build.dir}/reports/dependencies"/>
<ivy:report todir="${build.dir}/reports/dependencies" conf="runtime,runtime_last,test,test_platform,izpack,groovy,build,spotbugs,pmd"/>
</target>
<target name="izpack.dependencies" depends="resolve">
<taskdef name="izpack" classname="com.izforge.izpack.ant.IzPackTask" classpathref="izpack.classpath"/>
</target>
<macrodef name="publish">
<sequential>
<ivy:resolve/> <!-- required as due to caching resolve may not have been called yet. -->
<ivy:deliver deliverpattern="build/ivy.xml"/>
<if>
<isset property="DEPLOY_RELEASE"/>
<then>
<property name="deploy.resolver" value="maven-releases"/>
<property name="deploy.version" value="${ivy.revision}"/>
<property name="deploy.status" value="release"/>
<property name="deploy.update" value="false"/>
</then>
<else>
<property name="deploy.resolver" value="maven-snapshots"/>
<property name="deploy.version" value="${ivy.revision}-SNAPSHOT"/>
<property name="deploy.status" value="integration"/>
<property name="deploy.update" value="true"/>
</else>
</if>
<ivy:makepom ivyfile="build/ivy.xml" pomfile="build/lib/${ivy.module}.pom" conf="default,runtime"
templateFile="config/pom.template">
<mapping conf="default" scope="compile"/>
<mapping conf="runtime" scope="runtime"/>
</ivy:makepom>
</sequential>
</macrodef>
<target name="-get-junitlauncher" unless="junitlauncherPresent">
<echo message="You're environment doesn't have the junitlauncher jar. getting it for you"/>
<antversion property="ant_version"/>
<get src="https://repo1.maven.org/maven2/org/apache/ant/ant-junitlauncher/${ant_version}/ant-junitlauncher-${ant_version}.jar"
dest="${build.dir}/ant-junitlauncher.jar" usetimestamp="true"/>
<taskdef name="junitlauncher" classname="org.apache.tools.ant.taskdefs.optional.junitlauncher.confined.JUnitLauncherTask"
classpath="${build.dir}/ant-junitlauncher.jar"/>
</target>
<macrodef name="gpgsignfile">
<attribute name="target"/>
<attribute name="workingDir" default="${build.release.dir}"/>
<sequential>
<if>
<not>
<isset property="gpg.key.id"/>
</not>
<then>
<fail message="Please set the GPG key for signing."/>
</then>
</if>
<exec executable="gpg" dir="@{workingDir}" failonerror="true">
<arg value="-ab"/>
<arg value="-u"/>
<arg value="${gpg.key.id}"/>
<arg value="--yes"/>
<arg value="@{target}"/>
</exec>
</sequential>
</macrodef>
</project>