forked from Eliosoft/elios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
191 lines (163 loc) · 6.69 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
<!--
This file is part of Elios.
Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON
Elios 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.
Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>.
-->
<project name="elios" default="dist" basedir=".">
<description>
The Elios build file.
See README.txt for more details about the project
</description>
<!-- set global properties for this build -->
<property name="src" location="src" />
<property name="build" location="classes" />
<property name="dist" location="dist" />
<property name="doc" location="doc"/>
<property name="doc.res" location="doc/pictures"/>
<property name="doc.generator" location="doc/pandoc_wrapper.sh"/>
<property name="dist.javadoc" location="dist/javadoc"/>
<property name="dist.doc.html" location="dist/doc/html"/>
<property name="dist.doc.html.res" location="dist/doc/html/resources"/>
<property name="dist.jar.tmp" location="dist/tmp/jar" />
<property name="dist.setup" location="dist/setup" />
<property name="dist.setup.tmp" location="dist/tmp/setup" />
<property name="dist.setup.launcher.conf" value="launcher.ini" />
<property name="lib" location="lib" />
<property name="installer" location="installer" />
<property name="res" location="resources" />
<property name="main-class" value="net.eliosoft.elios.main.Elios" />
<property name="version" value="0.2" />
<path>
<!-- Define classpath -->
<fileset dir="${lib}" includes="*.jar" />
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
</target>
<target name="compile" depends="init" description="compile the source ">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}">
<classpath>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<!-- Copy the resources -->
<copy todir="${build}">
<fileset dir="${res}" />
</copy>
</target>
<target name="javadoc" depends="init" description="generate the javadoc">
<!-- Classpath is set to fix warnings during the generation -->
<javadoc sourcepath="${src}" destdir="${dist.javadoc}" classpath="${lib}/artnet4j.jar;${lib}/gson-1.6.jar" />
</target>
<target name="dist_userguide-html" depends="init, create_dist-dir" description="generate the documentation in HTML format">
<copy todir="${dist.doc.html.res}">
<fileset dir="${doc.res}" />
</copy>
<exec executable="${doc.generator}">
<arg value="${doc}/*.txt" />
<arg value="-o"/>
<arg value="${dist.doc.html}/UserGuide.html" />
<arg value="-s"/>
</exec>
</target>
<target name="create_dist-dir">
<!-- Create the distribution directory -->
<mkdir dir="${dist.doc.html}" />
</target>
<target name="dist" depends="compile, valorize_properties, create_dist-dir" description="generate the distribution">
<!-- Put everything in ${build} into the artnet-${version}.jar file -->
<jar jarfile="${dist}/elios-${version}.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
</manifest>
</jar>
</target>
<target name="dist_all-in-one" depends="compile, valorize_properties, create_dist-dir" description="generate the all-in-one distribution">
<mkdir dir="${dist.jar.tmp}" />
<!-- Extract jar lib to a temporary dir -->
<unzip dest="${dist.jar.tmp}">
<fileset dir="${lib}">
<include name="*.jar" />
</fileset>
<patternset>
<exclude name="META-INF" />
<exclude name="*.mf" />
<exclude name="*.MF" />
</patternset>
</unzip>
<!-- Create the jar -->
<jar jarfile="${dist}/elios-all.jar">
<fileset dir="${build}" />
<fileset dir="${dist.jar.tmp}" />
<manifest>
<attribute name="Main-Class" value="${main-class}" />
</manifest>
</jar>
<delete dir="${dist.jar.tmp}"/>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}" />
<delete dir="${dist}" />
<delete dir="${doc.pdf}" />
<delete dir="${dist.doc.html}" />
</target>
<target name="dist_installer" depends="dist_all-in-one, javadoc, dist_userguide-html, valorize_documentation" description="build installer">
<!-- required IzPack standalone-compiler -->
<taskdef name="IzPack" classpath="${installer}/standalone-compiler.jar"
classname="com.izforge.izpack.ant.IzPackTask"/>
<mkdir dir="${dist.setup.tmp}" />
<copy todir="${dist.setup.tmp}">
<fileset file="install.xml" />
</copy>
<replace dir="${dist.setup.tmp}" token="@ver@" value="${version}">
<include name="install.xml"/>
</replace>
<mkdir dir="${dist.setup}" />
<IzPack input="${dist.setup.tmp}/install.xml" output="${dist.setup}/elios-installer-${version}.jar" basedir="."/>
<delete dir="${dist.setup.tmp}" />
</target>
<target name="dist_win_installer" depends="dist_installer" description="build windows installer">
<!-- required Launch4j Cross-platform Java executable wrapper -->
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${installer}/launch4j.jar:${installer}/xstream.jar" />
<mkdir dir="${dist.setup.tmp}" />
<copy todir="${dist.setup.tmp}">
<fileset file="launch.xml" />
</copy>
<replace dir="${dist.setup.tmp}" token="@ver@" value="${version}">
<include name="launch.xml"/>
</replace>
<replace dir="${dist.setup.tmp}" token="@dist.setup@" value="${dist.setup}">
<include name="launch.xml"/>
</replace>
<launch4j configFile="${dist.setup.tmp}/launch.xml" outfile="${dist.setup}/elios-installer-${version}.exe"/>
<delete dir="${dist.setup.tmp}" />
</target>
<target name="valorize_properties" depends="compile" description="valorize token in properties files">
<replace dir="${build}" token="@ver@" value="${version}">
<include name="**/*.properties"/>
</replace>
</target>
<target name="valorize_documentation" depends="dist_userguide-html" description="valorize token in user guides files">
<replace dir="${dist.doc.html}" token="@ver@" value="${version}">
<include name="**/*.html"/>
</replace>
</target>
</project>