-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
171 lines (152 loc) · 6.95 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
<project name="JavaDeb Task" basedir="." default="dist">
<path id="classpath">
<pathelement location="build/classes"/>
<fileset dir="lib" includes="*.jar"/>
</path>
<target name="compile" description="Compile Java source code">
<mkdir dir="build/classes"/>
<javac
srcdir="src"
destdir="build/classes"
classpathref="classpath"
target="1.4"
source="1.4"
debug="yes"
/>
<copy todir="build/classes">
<fileset dir="src" includes="**/*.properties"/>
<fileset dir="src" includes="**/*.xml"/>
</copy>
</target>
<target name="antDoc" depends="compile" description="Generate Ant documentation">
<taskdef name="antTasksDocHtml" classname="net.sf.fikin.ant.AntTasksDocHtmlDocletTask" classpath="lib/fikin-ant-1.7.3.jar"/>
<taskdef name="antTasksDocText" classname="net.sf.fikin.ant.AntTasksDocTextDocletTask" classpath="lib/fikin-ant-1.7.3.jar"/>
<tstamp />
<mkdir dir="build/doc"/>
<antTasksDocHtml file="build/doc/ant-deb-tasks.html" classpathref="classpath" failonerror="yes">
<packageset dir="src" defaultexcludes="yes"/>
<param name="-J-DDSTAMP=${DSTAMP}" />
<param name="-J-DTSTAMP=${TSTAMP}" />
<param name="-J-Dheader=Ant Deb Tasks"/>
</antTasksDocHtml>
<antTasksDocText file="build/doc/ant-deb-tasks.txt" classpathref="classpath" failonerror="yes">
<packageset dir="src" defaultexcludes="yes"/>
<param name="-J-DDSTAMP=${DSTAMP}" />
<param name="-J-DTSTAMP=${TSTAMP}" />
<param name="-J-Dheader=Ant Deb Tasks"/>
</antTasksDocText>
</target>
<!-- - - - - - - - - - - - - - - - - -
private target: jar
- - - - - - - - - - - - - - - - - -->
<property name="antdeb.name" value="ant-deb"/>
<target name="jar" depends="compile">
<description>Package compiled classes into a jar</description>
<jar
basedir="build/classes"
destfile="build/${antdeb.name}.jar"/>
</target>
<!-- - - - - - - - - - - - - - - - - -
private target: examples
- - - - - - - - - - - - - - - - - -->
<property name="examples.name" value="examples"/>
<property name="targz" value="tar.gz"/>
<target name="examples">
<description>create a zip with the examples</description>
<mkdir dir="build"/>
<tar destfile="build/${examples.name}.${targz}" compression="gzip">
<tarfileset dir="samples">
<exclude name="**/build"/>
<exclude name="**/build/**"/>
<exclude name="**/dist"/>
<exclude name="**/dist/**"/>
<exclude name="**/download/*"/>
<exclude name="**/.ant-targets-build.xml"/>
</tarfileset>
</tar>
</target>
<!-- =================================
public target: release-dist
================================= -->
<target name="release-dist" depends="dist" description="Release all distribution files">
<input addproperty="dist.version.number" message="Please enter a version number for your distribution" defaultvalue="0.0.1" />
<move file="dist/${examples.name}.${targz}" tofile="dist/${examples.name}-${dist.version.number}.${targz}" />
<move file="dist/${antdeb.name}.jar" tofile="dist/${antdeb.name}-${dist.version.number}.jar"/>
<antcall target="createdeb" />
</target>
<!-- =================================
public target: dist
================================= -->
<target name="dist" depends="clean, jar, examples" description="Generate and package all distributables">
<mkdir dir="dist"/>
<copy file="build/${antdeb.name}.jar" todir="dist"/>
<copy file="build/${examples.name}.${targz}" todir="dist"/>
</target>
<!-- - - - - - - - - - - - - - - - - -
private target: createdeb
- - - - - - - - - - - - - - - - - -->
<target name="createdeb" depends="define_tasks">
<description>create a debian package of the ant deb task</description>
<property name="package.name" value="ant-deb-task"/>
<deb
todir="dist"
package="${package.name}"
version="${dist.version.number}"
section="devel"
depends="sun-java5-jre | sun-java6-jre, ant">
<version upstream="${dist.version.number}"/>
<maintainer name="Darko Palic" email="darko.palic@googlemail.com"/>
<description synopsis="Optional Ant task for creating deb-packages">
This optional ant task provides traget to create desktop entries and debian packages (.deb files) of a java project.
</description>
<tarfileset dir="${basedir}/doc" prefix="usr/share/doc/${package.name}">
<include name="**"/>
</tarfileset>
<tarfileset dir="${basedir}" prefix="usr/share/doc/${package.name}">
<include name="LICENSE"/>
</tarfileset>
<tarfileset dir="${basedir}/dist" prefix="usr/share/${package.name}">
<include name="*.jar"/>
</tarfileset>
</deb>
</target>
<target name="define_tasks" depends="compile">
<taskdef name="desktopEntry" classname="com.googlecode.ant_deb_task.DesktopEntry" classpathref="classpath"/>
<taskdef name="deb" classname="com.googlecode.ant_deb_task.Deb" classpathref="classpath"/>
</target>
<target name="testDesktopEntry" depends="define_tasks" description="Test the DesktopEntry task">
<mkdir dir="build/test"/>
<desktopEntry
toFile="build/test/Test.desktop"
name="Some Name"
exec="/usr/bin/test"
categories="Office;Database"
onlyshowin="GNOME;KDE"
>
<name lang="ro" value="Un nume"/>
<name lang="hu" country="hu" value="Edgy nev"/>
<genericname value="The Generic Name"/>
</desktopEntry>
</target>
<target name="testDeb" depends="define_tasks" description="Test the Deb task">
<mkdir dir="build/test"/>
<deb
todir="build/test"
package="test"
version="1.1"
section="devel"
depends="sun-java5-jre | sun-java6-jre">
<version epoch="2" upstream="1.1" debian="test1"/>
<maintainer name="John Tester" email="jtester@example.com"/>
<description synopsis="Short Description">
Long description
on multiple lines
</description>
<tarfileset dir="." includes="src/**, lib/**"/>
</deb>
</target>
<target name="clean" description="Clean work folders">
<delete dir="build" verbose="true"/>
<delete dir="dist" verbose="true"/>
</target>
</project>