-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
301 lines (267 loc) · 10.5 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
288
289
290
291
292
293
294
295
296
297
298
299
300
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyrigh 2014 Gastón I. Silva E.
* This program is distributed under the terms of the GNU General Public License
*
* This file is part of ConkyGUI.
*
* ConkyGUI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ConkyGUI 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 Conky GUI. If not, see <http://www.gnu.org/licenses/>.
-->
<project name="conkygui" default="default" basedir=".">
<description>Compile, test, package and run Conky GUI</description>
<!-- Set environment variables -->
<property environment="env" />
<!-- SCALA_HOME -->
<condition property="scala.home" value="${env.SCALA_HOME}">
<isset property="env.SCALA_HOME" />
</condition>
<condition property="scala.home" value="/usr/share/java">
<not>
<isset property="env.SCALA_HOME" />
</not>
</condition>
<!-- JUNIT_HOME -->
<condition property="junit.home" value="${env.JUNIT_HOME}">
<isset property="env.JUNIT_HOME" />
</condition>
<condition property="junit.home" value="/usr/share/java">
<not>
<isset property="env.JUNIT_HOME" />
</not>
</condition>
<!-- List and display current environment variables -->
<echo message="java.home = ${java.home}" />
<echo message="SCALA_HOME = ${scala.home}" />
<echo message="JUNIT_HOME = ${junit.home}" />
<!-- Add properties -->
<property file="src/controllers/resources/ConkyGUI.properties"/>
<property file="nbproject/project.properties"/>
<!-- Import Netbeans project build file -->
<import file="nbproject/build-impl.xml"/>
<!-- paths -->
<path id="scalac.classpath">
<pathelement location="${file.reference.scala-compiler.jar}" />
<pathelement location="${file.reference.scala-library.jar}" />
<pathelement location="${file.reference.scala-reflect.jar}" />
<pathelement location="${file.reference.scala-parser.jar}" />
<pathelement location="${file.reference.scala-xml.jar}" />
</path>
<path id="project.classpath">
<path refid="scalac.classpath"/>
<pathelement location="${junit.lib}" />
<pathelement location="${scala.build.dir}" />
<pathelement location="${scala.test.build.dir}" />
<pathelement location="${file.reference.junit4.jar}" />
<pathelement location="${file.reference.hamcrest.jar}" />
<pathelement location="${file.reference.vldocking}" />
<pathelement location="${file.reference.appframework}" />
</path>
<!--
Creates the ant task 'scalac' that is used during compilation.
Extracts the task from the compiler JAR, full path:
$SCALA_HOME/scala-compiler.jar/scala/tools/ant/antlib.xml
-->
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<path refid="scalac.classpath"/>
</classpath>
</taskdef>
<!-- Debug project classpath -->
<target name="dbg-classpath">
<pathconvert
pathsep="${line.separator} "
property="echo.classpath.pretty"
refid="project.classpath">
</pathconvert>
<echo message="CLASSPATH = ${echo.classpath.pretty}" />
<echo message="javac.target = ${javac.target}" />
<echo message="javac.classpath = ${javac.classpath}" />
</target>
<!--
===================
COMPILATION SECTION
===================
-->
<!-- Compile the Scala source files first -->
<target name="-pre-compile">
<mkdir dir="${scala.build.dir}" />
<scalac srcdir="${scala.source.dir}" destdir="${scala.build.dir}"
classpathref="project.classpath" unchecked="on" deprecation="on"/>
</target>
<!--
====================
JAR BUILDING SECTION
====================
-->
<target
depends="init,compile,-pre-pre-jar,-pre-jar"
if="manifest.available+main.class+mkdist.available"
name="-do-jar-with-libraries">
<echo>ERROR: </echo>
<echo>You are using Netbeans and the following property is set:</echo>
<echo> libs.CopyLibs.classpath</echo>
<echo>In one of the following files:</echo>
<echo> nbproject/project.properties</echo>
<echo> ~/.netbeans/6.7/build.properties</echo>
<echo>Delete or comment it</echo>
<fail message="Conky GUI does not support -do-jar-with-libraries"/>
</target>
<target name="-pre-jar">
<mkdir dir="${dist.dir}" />
</target>
<!--
====================
PACKAGE BUILDING SECTION
====================
-->
<target depends="clean,test,tar,deb" name="package">
<!--
This task will stay empty as it will only,
group the different methods of packaging.
See the "depends" argument.
-->
</target>
<target depends="-do-clean,jar" name="tar">
<property name="username" value="${env.USERNAME}" />
<!-- build dir -->
<mkdir dir="${tar.package.dir}" />
<!-- copy files -->
<copy todir="${tar.package.dir}">
<fileset dir="${package.src.dir}" excludes="**/*.svn **/DEBIAN/**"/>
</copy>
<!-- compress man page -->
<exec executable='gzip'>
<arg value='-9'/>
<arg value='${tar.package.tarbz2.dir}/${tar.conkygui.1.file}'/>
</exec>
<echo><!-- line break --></echo>
<echo>Build tar.bz2 package </echo>
<tar destfile="${tar.package.file}" compression="bzip2" excludes="**/*.svn">
<!-- executables (bash scripts) -->
<tarfileset dir="${tar.package.tarbz2.dir}" filemode="755" username="${username}" group="${username}">
<include name="${tar.install.script}"/>
<include name="${tar.remove.script}"/>
<include name="${tar.conkygui.script}"/>
</tarfileset>
<!-- copy everything else -->
<tarfileset dir="${tar.package.tarbz2.dir}" username="${username}" group="${username}">
<!-- exclude bash scripts -->
<exclude name="${tar.install.script}"/>
<exclude name="${tar.remove.script}"/>
<exclude name="${tar.conkygui.script}"/>
</tarfileset>
</tar>
</target>
<target depends="-do-clean,jar" name="deb">
<!-- copy control files -->
<copy file='${package.src.DEBIAN.dir}/control' todir='${deb.DEBIAN.dir}'/>
<!--chmod file="${deb.DEBIAN.dir}/postinst" perm="0755"/-->
<!--chmod file="${deb.DEBIAN.dir}/prerm" perm="0755"/-->
<!-- copying libs -->
<copy todir="${deb.lib.dir}">
<fileset dir="${package.src.lib.dir}" excludes='**/*.svn'/>
</copy>
<!-- copying docs -->
<copy todir="${deb.doc.dir}">
<fileset dir="${package.src.doc.dir}" excludes='**/*.svn'/>
</copy>
<!-- changelog -->
<exec executable='gzip'>
<arg value='-9'/>
<arg value='${deb.doc.dir}/changelog'/>
</exec>
<!-- copying single files -->
<!-- man page -->
<copy file='${package.src.man.file}' tofile='${deb.man.file}'/>
<exec executable='gzip'>
<arg value='-9'/>
<arg value='${deb.man.file}'/>
</exec>
<!-- conkygui.desktop -->
<copy file='${package.src.dir}/conkygui.desktop' todir='${deb.share.dir}/applications'/>
<!-- conkygui.jar -->
<copy file="${package.src.dir}/conkygui.jar" todir="${deb.share.dir}/conkygui"/>
<!-- icon -->
<copy file="${package.src.dir}/conkygui.png" todir="${deb.pixmaps.dir}"/>
<!-- conky gui exe -->
<copy file="${package.src.dir}/conkygui" todir="${deb.bin.dir}/"/>
<chmod file="${deb.bin.dir}/conkygui" perm="0755"/>
<!-- build deb for REVU upload -->
<!-- exec executable="dpkg-buildpackage" dir="${dist}">
<arg value="-S"/>
<arg value="-sa"/>
<arg value="-rfakeroot"/>
</exec-->
<echo><!-- line break --></echo>
<echo>Build deb package</echo>
<exec executable="fakeroot">
<arg value="dpkg"/>
<arg value="--build"/>
<arg value="${deb.dir}"/>
<arg value="${deb.package.file}"/>
</exec>
<echo><!-- line break --></echo>
<echo>Checking deb package with lintian:</echo>
<exec executable="lintian">
<arg value="${deb.package.file}"/>
</exec>
</target>
<!--
=========================
JUNIT COMPILATION SECTION
=========================
-->
<target name="-pre-compile-test">
<mkdir dir="${scala.test.build.dir}" />
<scalac srcdir="${scala.test.source.dir}" destdir="${scala.test.build.dir}" classpathref="project.classpath" />
</target>
<!--
=======================
JUNIT EXECUTION SECTION
=======================
-->
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<junit haltonfailure="yes">
<classpath>
<path refid="project.classpath"/>
</classpath>
<formatter type="plain" usefile="no" />
<batchtest fork="yes">
<fileset dir="${scala.test.build.dir}">
<include name="**/*Test*.class" />
</fileset>
</batchtest>
</junit>
</target>
<!--
===============
CLEANUP SECTION
===============
-->
<target depends='init' name='-do-clean'>
<!-- classes -->
<delete dir='${build.dir}'/>
<!-- jar -->
<delete file='${dist.jar}'/>
<!-- javadoc -->
<delete dir='${dist.javadoc.dir}'/>
<!-- debian -->
<delete dir='${deb.dir}'/>
<!-- tar -->
<delete dir='${tar.package.tarbz2.dir}'/>
<!-- packages -->
<delete file='${tar.package.file}'/>
<delete file='${deb.package.file}'/>
</target>
</project>