-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
263 lines (230 loc) · 10.2 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, see <http://www.gnu.org/licenses/>
-->
<project name="Pacemaker" default="all" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
<property name="mainJar" value="Pacemaker.jar" />
<property name="SimulatorJar" value="PacemakerTest.jar" />
<property name="cfgJar" value="ConfigurationCreator.jar" />
<property name="destDir" value="bin" />
<property name="javadoc" value="doc/javadoc" />
<property name="srcDir" value="src" />
<property name="testResDir" value="results" />
<property name="testsDir" value="tests/src" />
<path id="project.class.path">
<pathelement location="lib/slf4j-1.7.5/slf4j-api-1.7.5.jar"/>
<pathelement path="lib/logback-1.0.13/logback-core-1.0.13.jar"/>
<pathelement path="lib/logback-1.0.13/logback-classic-1.0.13.jar"/>
<pathelement path="lib/jna-4.1.0.jar"/>
<pathelement path="lib/purejavacomm.jar"/>
<pathelement path="lib/jcommon-1.0.23.jar"/>
<pathelement path="lib/jfreechart-1.0.19.jar"/>
</path>
<path id="junit.class.path">
<pathelement location="lib/slf4j-1.7.5/slf4j-api-1.7.5.jar"/>
<pathelement path="lib/logback-1.0.13/logback-core-1.0.13.jar"/>
<pathelement path="lib/logback-1.0.13/logback-classic-1.0.13.jar"/>
<pathelement path="lib/jna-4.1.0.jar"/>
<pathelement path="lib/purejavacomm.jar"/>
<pathelement path="lib/jcommon-1.0.23.jar"/>
<pathelement path="lib/jfreechart-1.0.19.jar"/>
<!-- for JUnit : -->
<pathelement path="lib/junit4-4.12.jar"/>
<pathelement path="lib/hamcrest-core-1.3.jar"/>
<pathelement path="${destDir}"/>
</path>
<path id="simulator.class.path">
<pathelement location="lib/slf4j-1.7.5/slf4j-api-1.7.5.jar"/>
<pathelement path="lib/logback-1.0.13/logback-core-1.0.13.jar"/>
<pathelement path="lib/logback-1.0.13/logback-classic-1.0.13.jar"/>
</path>
<!--
<path id="compile.class.pathtest">
<pathelement location="${checkstyle.dir}/checkstyle-5.5-all.jar"/>
<pathelement location="${checkstyle.dir}/checkstyle-5.5.jar"/>
<pathelement location="${checkstyle.dir}/pmd-3.9.jar"/>
<pathelement location="${checkstyle.dir}/asm-3.0.jar"/>
<pathelement location="${checkstyle.dir}/backport-util-concurrent-2.1.jar"/>
<pathelement location="${checkstyle.dir}/jaxen-1.1-beta-10.jar"/>
<pathelement location="${checkstyle.dir}/saxpath-1.0-FCS.jar"/>
</path>
-->
<manifestclasspath property="pm.cp" jarfile="${mainJar}">
<classpath refid="project.class.path" />
</manifestclasspath>
<manifestclasspath property="sim.cp" jarfile="${SimulatorJar}">
<classpath refid="simulator.class.path" />
</manifestclasspath>
<target name="clean" description="delete everything that might have previously been created" >
<delete dir="${destDir}"/>
<delete file="${mainJar}"></delete>
<delete file="${SimulatorJar}"></delete>
<delete file="${cfgJar}"></delete>
<delete dir="${javadoc}"/>
<delete dir="build"/>
<delete dir="testResDir"/>
</target>
<target name="prepare" depends="clean" description="Prepare for building" >
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<mkdir dir="${destDir}"/>
<!-- Gets the Head commit id-->
<exec executable = "git" output="${destDir}/commit-id" failifexecutionfails="no">
<arg value = "rev-parse" />
<arg value = "HEAD" />
</exec>
<!-- checks if changes to Head have been made in the working copy -->
<exec executable = "git" output="${destDir}/commit-id" append="true" failifexecutionfails="no">
<arg value = "diff" />
<arg value = "--shortstat" />
</exec>
<path id="fxant">
<filelist>
<file name="${java.home}/../lib/ant-javafx.jar"/>
<file name="${java.home}/lib/jfxrt.jar"/>
</filelist>
</path>
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpathref="fxant"/>
</target>
<target name="compile" depends="prepare" description="compile *.java to *.class">
<javac srcdir="${srcDir}" destdir="${destDir}" includeantruntime="false"
source="1.8" target="1.8" debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path"/>
</javac>
</target>
<target name="jar" depends="compile" description="create the Jar File">
<jar destfile="${mainJar}" update="false">
<fileset dir="${destDir}">
<include name="**/*.class" />
<include name="commit-id" />
</fileset>
<manifest>
<attribute name="Implementation-Vendor" value="nomagic.de"/>
<attribute name="Implementation-Title" value="Pacemaker"/>
<attribute name="Implementation-Version" value="0.1"/>
<attribute name="Main-Class" value="de.nomagic.printerController.ControllerMain" />
<attribute name="Class-Path" value=". ${pm.cp}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Built-Date" value="${TODAY}"/>
</manifest>
</jar>
<jar destfile="${SimulatorJar}" update="false">
<fileset dir="${destDir}">
<include name="**/*.class" />
</fileset>
<manifest>
<attribute name="Implementation-Vendor" value="nomagic.de"/>
<attribute name="Implementation-Title" value="Pacemaker Client Simulation"/>
<attribute name="Implementation-Version" value="0.1"/>
<attribute name="Main-Class" value="de.nomagic.test.pacemaker.ClientMain" />
<attribute name="Class-Path" value=". ${sim.cp}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Built-Date" value="${TODAY}"/>
</manifest>
</jar>
<fx:jar id="cfgfxjar" destfile="${cfgJar}">
<fx:platform basedir="${java.home}"/>
<fx:application id="fxApplication"
name="Pacemaker Client Configuration creator"
mainClass="de.nomagic.printerController.createConfigFx.Main"
toolkit="fx"
/>
<fx:resources>
<fx:fileset dir="lib" includes="lib/jna-4.1.0.jar" type="jar"/>
</fx:resources>
<fileset dir="${destDir}">
<include name="**/*.class" />
<include name="commit-id" />
</fileset>
<manifest>
<attribute name="Implementation-Vendor" value="nomagic.de"/>
<attribute name="Implementation-Title" value="Pacemaker Client Configuration creator"/>
<attribute name="Implementation-Version" value="0.1"/>
<attribute name="JavaFX-Feature-Proxy" value="None"/>
<attribute name="Class-Path" value="lib/jna-4.1.0.jar"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Built-Date" value="${TODAY}"/>
</manifest>
</fx:jar>
</target>
<target name="javadoc" description="create Documentation" >
<javadoc packagenames="de.nomagic.*"
sourcepath="${srcDir}"
destdir="${javadoc}"
Version="yes"
Use="yes"
Author="yes"
serialwarn="yes"
Encoding="UTF-8">
<classpath refid="project.class.path"/>
</javadoc>
</target>
<target name="do-deploy" depends="jar">
<mkdir dir="build/build/classes/META-INF" />
<mkdir dir="deploy" />
<!-- Need to use ${basedir} because somehow the ant task is calculating the directory differently -->
<fx:deploy
embedJNLP="false"
extension="false"
includeDT="false"
offlineAllowed="true"
outdir="${basedir}/build/deploy"
outfile="ConfigurationCreator" nativeBundles="all"
updatemode="background" >
<fx:platform basedir="${java.home}"/>
<fx:info title="ConfigurationCreator" vendor="nomagic.de"/>
<fx:application refId="fxApplication"/>
<fx:resources>
<fx:fileset dir="lib" includes="lib/**" type="jar"/>
</fx:resources>
</fx:deploy>
</target>
<target name="unittest" depends="prepare" >
<delete dir="${testResDir}"/>
<mkdir dir="${testResDir}"/>
<javac srcdir="${srcDir}" destdir="${destDir}" includeantruntime="false"
source="1.8" target="1.8" debug="true" debuglevel="lines,vars,source" >
<classpath refid="project.class.path"/>
</javac>
<javac srcdir="${testsDir}" destdir="${destDir}" includeantruntime="false"
source="1.8" target="1.8" debug="true" debuglevel="lines,vars,source" >
<classpath refid="junit.class.path"/>
</javac>
<junit printsummary="yes" haltonfailure="no">
<classpath refid="junit.class.path"/>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${testResDir}">
<fileset dir="${testsDir}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="stylecheck">
<taskdef resource="checkstyletask.properties">
<classpath refid="project.class.path"/>
</taskdef>
<cs:checkstyle config="doc/rules.xml" failOnViolation="false">
<classpath refid="project.class.path"/>
<fileset dir="${srcDir}">
<include name="**/*.java"/>
</fileset>
<formatter type="plain"/>
<formatter type="xml" toFile="checkstyle-result.xml"/>
</cs:checkstyle>
</target>
<target name="all" depends="jar, do-deploy">
</target>
</project>