1 <project name="Giyusit" basedir="." default="run">
3 Build file for Giyusit recruitment software
6 <property name="app.version" value="0.7" />
7 <property name="main-class" value="negev.giyusit.GiyusitApplication" />
9 <!-- Input directories -->
10 <property name="src.dir" value="src" />
11 <property name="lib.dir" value="lib" />
12 <property name="resource.dir" value="resources" />
13 <property name="dist.dir" value="dist" />
15 <!-- Output directories -->
16 <property name="build.dir" value="build" />
17 <property name="jar.dir" value="${build.dir}/jar" />
18 <property name="classes.dir" value="${build.dir}/classes" />
19 <property name="out.dir" value="${dist.dir}/out" />
20 <property name="jnlp.dir" value="${dist.dir}/jnlp" />
22 <property name="version-file" value="${resource.dir}/giyusit.properties" />
25 The build file expects to find a file called build.properties in the
26 project's root directory. This file defines workstation specific
29 The possible properties are:
30 launch4j.dir The path where launch4j is installed
31 nsisant.jar The path to the NSIS Ant task JAR file
33 jnlp.codebase The URL where the Java Web Start mirror will be deployed
34 jnlp.keystore The key store used for signing JARs for Web Start
35 jnlp.alias The name of the key used for signing JARs for Web Start
36 jnlp.storepass The password for the key store used for signing JARs for Web Start
38 <property file="build.properties" />
41 <fileset dir="${lib.dir}" includes="**/*.jar" />
47 <condition property="version-file-available">
48 <available file="${version-file}" />
50 <target name="-generate-version-file" unless="version-file-available">
51 <echo message="version = ${app.version}" file="${version-file}" />
52 <echo message="Writing version file" />
58 <target name="clean" description="Deletes all intermediate generated artifacts">
59 <delete dir="${build.dir}" />
62 <target name="distclean" depends="clean" description="Deletes all generated artifacts">
63 <delete dir="${out.dir}" />
64 <delete dir="${jnlp.dir}" />
67 <target name="compile" description="Compiles source code">
68 <mkdir dir="${classes.dir}" />
70 <javac srcdir="${src.dir}"
71 destdir="${classes.dir}"
72 classpathref="classpath"
74 debuglevel="lines,vars,source" />
76 <copy todir="${classes.dir}">
77 <fileset dir="${src.dir}" excludes="**/*.java" />
81 <target name="jar" depends="compile" description="Creates the application code jar">
82 <mkdir dir="${jar.dir}" />
83 <jar destfile="${jar.dir}/giyusit.jar" basedir="${classes.dir}">
85 <attribute name="Main-Class" value="${main-class}" />
90 <target name="resources"
91 depends="-generate-version-file"
92 description="Creates the application resources jar">
94 <mkdir dir="${jar.dir}" />
95 <jar destfile="${jar.dir}/resources.jar" basedir="${resource.dir}" excludes="**/*.ts" />
101 <target name="run" depends="compile,resources" description="Runs the application inside Ant">
102 <java fork="true" classname="${main-class}">
104 <path refid="classpath" />
105 <path location="${classes.dir}" />
106 <path location="${jar.dir}/resources.jar" />
112 Targets for deploying as a stand-alone EXE file
114 <target name="-uber-jar" depends="jar,resources">
115 <!-- Merge the application, resource and library jars into a single one -->
116 <jar destfile="${jar.dir}/giyusit-uber.jar">
117 <zipfileset src="${jar.dir}/giyusit.jar" />
118 <zipfileset src="${jar.dir}/resources.jar" />
119 <zipgroupfileset dir="${lib.dir}" includes="*.jar" />
122 <attribute name="Main-Class" value="${main-class}" />
127 <target name="exe" depends="-uber-jar" description="Generates a Windows executable">
128 <taskdef name="launch4j"
129 classname="net.sf.launch4j.ant.Launch4jTask"
130 classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
132 <mkdir dir="${out.dir}" />
134 <launch4j configFile="${dist.dir}/launch4j.xml"
135 jar="${jar.dir}/giyusit-uber.jar"
136 outfile="${out.dir}/Giyusit.exe" />
139 <target name="installer" depends="exe" description="Generates a Windows installer">
141 classname="net.sf.nsisant.Task"
142 classpath="${nsisant.jar}"/>
144 <nsis script="${dist.dir}/installer.nsi">
145 <define name="VERSION" value="${app.version}" />
150 Targets for deploying using Java Web Start
152 <target name="-lib-jar">
153 <!-- Merges library jars into a single one -->
154 <jar destfile="${jar.dir}/giyusit-libs.jar">
155 <zipgroupfileset dir="${lib.dir}" includes="*.jar" />
159 <target name="jnlp" depends="jar,resources,-lib-jar" description="Generate Java Web Start site mirror">
160 <mkdir dir="${jnlp.dir}" />
162 <!-- Prepare JNLP file -->
163 <property name="jnlp.file" value="${jnlp.dir}/Giyusit.jnlp" />
165 <copy file="${dist.dir}/Giyusit.jnlp.in" tofile="${jnlp.file}" />
166 <replace file="${jnlp.file}" token="@codebase@" value="${jnlp.codebase}" />
167 <replace file="${jnlp.file}" token="@version@" value="${app.version}" />
168 <replace file="${jnlp.file}" token="@main-class@" value="${main-class}" />
170 <!-- Copy and sign application JARs -->
171 <signjar destDir="${jnlp.dir}"
172 keystore="${jnlp.keystore}"
173 alias="${jnlp.alias}"
174 storepass="${jnlp.storepass}">
176 <fileset file="${jar.dir}/giyusit.jar" />
177 <fileset file="${jar.dir}/resources.jar" />
178 <fileset file="${jar.dir}/giyusit-libs.jar" />
182 <!-- Copy helper files -->
183 <copy file="${dist.dir}/index.html" todir="${jnlp.dir}" />
185 <echo message="Java Web Start mirror ready in: ${basedir}/${jnlp.dir}" />