-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
287 lines (243 loc) · 10.4 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
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
<!--
* LODeXporter - http://www.semanticsoftware.info/lodexporter
*
* This file is part of the LODeXporter component.
*
* Copyright (c) 2015, 2016, 2017 Semantic Software Lab, http://www.semanticsoftware.info
* René Witte
* Bahar Sateli
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
-->
<project name="LODeXporter" basedir="." default="all"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:jacoco="antlib:org.jacoco.ant"
xmlns:cs="antlib:com.puppycrawl.tools.checkstyle"
xmlns:fb="antlib:edu.umd.cs.findbugs">
<!-- Prevent Ant from warning about includeantruntime not being set -->
<property name="build.sysclasspath" value="ignore" />
<property file="build.properties" />
<!--=======================================================
Property settings. You should not need to edit these
directly, if you need to set a different value for any
property you should edit build.properties and override
them there.
=======================================================-->
<!-- Name of our plugin -->
<property name="plugin.name" value="LODeXporter"/>
<!-- location for the generated JAR file -->
<property name="jar.location" location="${plugin.name}.jar" />
<!-- Make environment variables available -->
<property environment="env" />
<!-- Source directory - contains the Java source files for this plugin -->
<property name="src.dir" location="src" />
<!-- directory to contain the compiled classes -->
<property name="classes.dir" location="classes" />
<!-- documentation directory -->
<property name="doc.dir" location="doc" />
<!-- JavaDoc documentation directory -->
<property name="javadoc.dir" location="${doc.dir}/javadoc" />
<!-- lib directory containing the required libraries -->
<property name="lib.dir" location="lib" />
<!-- resolve libraries through ivy -->
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"/>
<!-- jacoco test coverage tool -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="/usr/local/durmtools/jacoco/lib/jacocoant.jar" />
</taskdef>
<!-- For JUnit test task -->
<property name="test.dir" location="test" />
<property name="test.reports.dir" location="${test.dir}/reports" />
<property name="test.src.dir" location="${test.dir}/src" />
<property name="test.classes.dir" location="${test.dir}/classes" />
<property name="test.resources.dir" location="${test.dir}/resources" />
<property name="result.exec.file" location="${test.reports.dir}/jacoco.exec" />
<!-- Classpath to compile - include ivy resolved JAR files. -->
<path id="compile.classpath">
<fileset dir="${lib.dir}" includes="**/*.jar" />
</path>
<!-- Directory for code analysis configuration and reports -->
<property name="analysisDir" location="analysis" />
<!-- software revision number -->
<property name="release.version" value="1.0"/>
<property file="version.properties"/>
<!--====================== Targets ============================-->
<!-- create build directory structure -->
<target name="prepare">
<mkdir dir="${classes.dir}" />
<ivy:retrieve sync="true" type="jar,bundle" pattern="${lib.dir}/[artifact]-[revision].[ext]" />
<ivy:report todir="${lib.dir}" graph="false" />
</target>
<!-- Build everything - the code and JavaDoc -->
<target name="all" depends="prepare,jar,javadoc" />
<!-- Run code analysis tools -->
<target name="analysis" depends="checkstyle,pmd,cpd,findbugs" />
<!-- record information about a build -->
<target name="buildprops">
<tstamp>
<format property="builtat" pattern="yyyy-MM-dd-HH-mm-ss" timezone="America/New_York"/>
</tstamp>
<exec executable="whoami" outputproperty="whoami"/>
<propertyfile file="version.properties"
comment="This file is automatically generated - DO NOT EDIT">
<entry key="buildtime" value="${builtat}"/>
<entry key="buildrepo" value="{git}"/>
<entry key="builder" value="${user.name}"/>
<entry key="version" value="${release.version}-${buildrepo}-${builtat}"/>
</propertyfile>
</target>
<!-- compile the source -->
<target name="compile" depends="prepare">
<javac classpathref="compile.classpath"
srcdir="${src.dir}"
destdir="${classes.dir}"
debug="true"
debuglevel="lines,source"
encoding="UTF-8"
source="1.8"
target="1.8">
<compilerarg value="-Xmaxwarns" />
<compilerarg value="-Xlint:all" />
</javac>
</target>
<!-- copy resources (anything non-.java) from src to classes -->
<target name="copy.resources" depends="prepare">
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" excludes="**/*.java" />
</copy>
</target>
<!-- create the JAR file -->
<target name="jar" depends="compile, copy.resources" >
<jar destfile="${jar.location}"
update="false"
basedir="${classes.dir}" />
</target>
<!-- remove the generated .class files -->
<target name="clean.classes" >
<delete dir="${classes.dir}" />
</target>
<!-- clean resources generated by tests -->
<target name="clean.tests">
<delete>
<fileset dir="." includes="TEST*.xml" />
</delete>
<delete dir="${test.classes.dir}" />
</target>
<!-- Clean up - remove .class and .jar files -->
<target name="clean" depends="clean.classes, clean.tests" >
<delete file="${jar.location}" />
</target>
<!-- Clean up everything, including Javadoc -->
<target name="docclean" depends="clean, clean.javadoc" >
</target>
<!-- Build JavaDoc documentation -->
<target name="doc.prepare">
<mkdir dir="${javadoc.dir}" />
</target>
<!-- Clean JavaDoc documentation -->
<target name="clean.javadoc">
<delete dir="${javadoc.dir}" />
</target>
<target name="javadoc" depends="doc.prepare">
<javadoc destdir="${javadoc.dir}" packagenames="*" classpathref="compile.classpath" encoding="UTF-8" windowtitle="${plugin.name} JavaDoc" source="8">
<sourcepath>
<pathelement location="${src.dir}" />
</sourcepath>
<link href="http://docs.oracle.com/javase/8/docs/api/" />
</javadoc>
</target>
<!-- Other targets:
build: build the plugin - just calls "jar" target
distro.prepare: remove intermediate files that shouldn't be in the
distribution -->
<target name="build" depends="jar" />
<target name="distro.prepare" depends="clean.classes, clean.tests" />
<!-- JUnit tests -->
<path id="test.classpath">
<path refid="compile.classpath" />
<pathelement location="${jar.location}" />
</path>
<target name="test.prepare">
<mkdir dir="${test.classes.dir}" />
<mkdir dir="${test.reports.dir}" />
</target>
<target name="test.compile" depends="test.prepare,build">
<javac classpathref="test.classpath" srcdir="${test.src.dir}" destdir="${test.classes.dir}" debug="true" debuglevel="lines,source" source="1.8" />
</target>
<target name="test" depends="compile,test.compile">
<jacoco:coverage destfile="${result.exec.file}">
<junit fork="yes" haltonfailure="no" showoutput="yes" printsummary="on">
<test name="info.semanticsoftware.lodexporter.LODeXporterTest" toDir="${test.reports.dir}" />
<sysproperty key="lodexporter.plugin.dir" file="${basedir}" />
<formatter type="xml" />
<classpath>
<path refid="test.classpath" />
<pathelement path="${test.classes.dir}" />
<pathelement path="${test.resources.dir}" />
<pathelement location="x/y/z"/>
</classpath>
</junit>
</jacoco:coverage>
</target>
<!-- Code analysis targets -->
<!-- Checkstyle analysis -->
<target name="checkstyle" description="Source code analysis using checkstyle" depends="prepare">
<property name="checkstyle.home" value="${analysisDir}" />
<property name="checkstyle.config" value="${checkstyle.home}/ssl_checkstyle.xml" />
<property name="checkstyle.report" value="${checkstyle.home}/checkstyle-result.xml" />
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" uri="antlib:com.puppycrawl.tools.checkstyle">
<classpath refid="compile.classpath" />
</taskdef>
<cs:checkstyle config="${checkstyle.config}" failOnViolation="false">
<formatter type="xml" tofile="${checkstyle.report}" />
<fileset dir="." includes="**/*.java" excludes="Applications/*/package/**/*.java" />
</cs:checkstyle>
</target>
<!-- Findbugs analysis -->
<property name="findbugs.home" value="/usr/local/durmtools/findbugs" />
<target name="findbugs" depends="compile">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" uri="antlib:edu.umd.cs.findbugs">
<classpath refid="compile.classpath" />
</taskdef>
<fb:findbugs home="${findbugs.home}" output="xml:withMessages" outputFile="${analysisDir}/findbugsXml.xml">
<auxClasspath refid="compile.classpath" />
<sourcePath path="." />
<fileset dir="." includes="**/*.jar" excludes="lib/*.jar,Applications/*/package/**/*.jar" />
</fb:findbugs>
</target>
<!-- PMD analysis -->
<target name="pmd" depends="prepare">
<taskdef name="pmd"
classname="net.sourceforge.pmd.ant.PMDTask"
classpathref="compile.classpath"/>
<pmd shortFilenames="true">
<sourceLanguage name="java" version="1.8"/>
<ruleset>${analysisDir}/ssl_pmd_java_ruleset.xml</ruleset>
<formatter type="xml" toFile="${analysisDir}/pmd-result.xml">
<param name="linkPrefix" value="http://pmd.sourceforge.net/xref/"/>
</formatter>
<fileset dir="." includes="**/*.java" excludes="Applications/*/package/**/*.java"/>
</pmd>
</target>
<!-- CPD analysis -->
<target name="cpd" depends="prepare">
<taskdef name="cpd"
classname="net.sourceforge.pmd.cpd.CPDTask"
classpathref="compile.classpath"/>
<cpd minimumTokenCount="100" encoding="utf-8" format="xml" outputFile="${analysisDir}/cpd-result.xml">
<fileset dir="." includes="**/*.java" excludes="Applications/*/package/**/*.java"/>
</cpd>
</target>
</project>