1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <project name="Siman-War" default="build-war">
4 <property environment="env" />
6 <property file="build.properties" description="set the build parameters" />
7 <property file="../${siman-common.project.name}/build.properties" description="set the build parameters" />
8 <property file="../${splat.project.name}/build.properties" description="set the build parameters" />
10 <property name="time.simple.pattern" value="dd/MM/yyyy" />
12 <format property="datesimple" pattern="${time.simple.pattern}" />
15 <property name="time.pattern" value="hh:mm:ss" />
17 <format property="time" pattern="${time.pattern}" />
20 <!-- ================================================= -->
21 <!-- launcher: Build launcher jar -->
22 <!-- ================================================= -->
23 <target name="launcher" depends="compile-java" description="Builds launcher jar">
24 <delete file="${siman.content.dir}/jap/splat-launcher.jar" />
25 <jar destfile="${siman.content.dir}/jap/splat-launcher.jar">
26 <zipfileset dir="${siman.bin.dir}/classes">
27 <include name="org/splat/launcher/**" />
30 <attribute name="Built-By" value="${app.author}" />
31 <attribute name="Version" value="${app.version}" />
32 <attribute name="Built-Date" value="${datesimple}" />
37 <!-- ================================================= -->
38 <!-- launcher: Sign launcher jar -->
39 <!-- ================================================= -->
40 <target name="sign-launcher" depends="launcher" description="Signs launcher jar">
41 <!-- jarsigner -verbose -keystore launcherkeystore -signedjar splat-signedlauncher.jar splat-launcher.jar launcheralias-->
42 <delete file="${siman.content.dir}/jap/splat-signedlauncher.jar" />
43 <signjar verbose="on" keystore="${siman.content.dir}/jap/launcherkeystore" signedjar="${siman.content.dir}/jap/splat-signedlauncher.jar" jar="${siman.content.dir}/jap/splat-launcher.jar" alias="launcheralias" storepass="launcher" />
46 <!-- ================================================= -->
47 <!-- siman-common: Build Siman-Common project -->
48 <!-- ================================================= -->
49 <target name="siman-common" description="Builds Siman-Common project">
50 <ant dir="../${siman-common.project.name}" />
53 <!-- ================================================= -->
54 <!-- copy-config: Copy parametrized config files -->
55 <!-- ================================================= -->
56 <macrodef name="copy-config">
57 <!-- Parameter "mode" can be equal to "debug" or "release" -->
58 <attribute name="mode" />
60 <echo message="Generating configuration in @{mode} mode" />
61 <!-- Copy files from config source directory according to the given mode -->
62 <copy todir="${basedir}/${config.@{mode}.dir}" overwrite="true">
63 <fileset dir="${config.src.dir}/templates">
65 <!-- Transform the files from templates substituting properties values -->
67 <filter token="datesimple" value="${datesimple}" />
68 <filter token="time" value="${time}" />
69 <!-- Get properties to substitute according to the given mode -->
70 <filtersfile file="${config.src.dir}/@{mode}.properties" />
71 <!-- Substitute the complete config source directory path value in files -->
72 <filter token="config.src.dir" value="${basedir}${file.separator}${config.src.dir}${file.separator}templates" />
78 <!-- ================================================= -->
79 <!-- debug-config: Generate parametrized config files -->
80 <!-- ================================================= -->
81 <target name="debug-config" description="Generate parametrized debug config files">
82 <copy-config mode="debug" />
85 <!-- =================================================== -->
86 <!-- release-config: Generate parametrized config files -->
87 <!-- =================================================== -->
88 <target name="release-config" description="Generate parametrized release config files">
89 <copy-config mode="release" />
92 <!-- ===================================================================== -->
93 <!-- compile-java : compile the java classes -->
94 <!-- ===================================================================== -->
95 <target name="compile-java" depends="clean, siman-common" description="Builds the java classes">
96 <echo message="Compile Siman java classes" />
97 <!-- <delete dir="${siman.bin.dir}/temp" quiet="true"/>-->
99 <javac target="1.6" srcdir="${siman.src.dir}" destdir="temp" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memoryMaximumSize="${compiler.max.memory}" optimize="${compiler.optimize}" deprecation="${compiler.deprecation}">
101 <fileset dir="${basedir}/../${siman-common.project.name}/${siman-common.ext.dir}" includes="**/*" />
102 <fileset dir="${basedir}/../${splat.project.name}/${splat.dist.dir}" includes="**/*" />
103 <fileset dir="${basedir}/../${splat.project.name}/${splat.lib.dir}" includes="**/*" />
104 <fileset dir="${basedir}/../${siman-common.project.name}/${siman-common.dist.dir}" includes="**/*" />
105 <fileset dir="${basedir}/../${siman-common.project.name}/${siman-common.lib.dir}" includes="**/*" />
106 <fileset dir="${siman.content.dir}/WEB-INF/lib" includes="**/*" />
108 <exclude name="test/**" />
112 <!-- ===================================================================== -->
113 <!-- build-dist : Create the war file -->
114 <!-- ===================================================================== -->
115 <target name="build-war" depends="clean, sign-launcher, launcher, siman-common, compile-java, release-config" description="Builds the WAR distribution">
116 <echo message="build ${webapp.name}.war" />
118 <mkdir dir="${siman.dist.dir}" />
119 <war destfile="${siman.dist.dir}/${webapp.name}.war" webxml="${basedir}/${siman.content.dir}/WEB-INF/web.xml">
120 <fileset dir="${siman.content.dir}" />
121 <!-- Copy all sources except those which should be generated -->
122 <classes dir="${siman.bin.dir}/classes">
123 <present present="srconly" targetdir="${config.release.dir}" />
125 <!-- Copy generated sources -->
126 <zipfileset dir="${config.release.dir}" prefix="WEB-INF/classes" />
128 <attribute name="Built-By" value="${app.author}" />
129 <attribute name="Version" value="${app.version}" />
130 <attribute name="Built-Date" value="${datesimple}" />
132 <lib dir="${basedir}/../${siman-common.project.name}/${siman-common.dist.dir}" includes="**/*.jar" />
133 <lib dir="${basedir}/../${siman-common.project.name}/${siman-common.lib.dir}" includes="**/*.jar" />
134 <lib dir="${basedir}/../${splat.project.name}/${splat.dist.dir}" includes="**/*.jar" />
135 <lib dir="${basedir}/../${splat.project.name}/${splat.lib.dir}" includes="**/*.jar" />
139 <!-- ================================================= -->
140 <!-- clean: Clean the dist directory -->
141 <!-- ================================================= -->
142 <target name="clean" description="clean the build directory">
143 <echo message="deleting files in ${siman.dist.dir}" />
144 <delete includeemptydirs="true" failonerror="false">
145 <fileset dir="${siman.dist.dir}" includes="**/*" />
149 <!-- ================================================= -->
150 <!-- prepare-postgres: Prepare config for Postgress -->
151 <!-- ================================================= -->
152 <target name="prepare-postgres" description="prepare configuration for Postgress">
153 <echo message="Prepare configuration for Postgress..." />
154 <copy file="conf/debug_pg.properties" tofile="conf/debug.properties" overwrite="true"/>
155 <copy file="conf/release_pg.properties" tofile="conf/release.properties" overwrite="true"/>
156 <antcall target="debug-config"/>
159 <!-- ================================================= -->
160 <!-- prepare-postgres: Prepare config for MySql -->
161 <!-- ================================================= -->
162 <target name="prepare-mysql" description="prepare configuration for MySql">
163 <echo message="Prepare configuration for MySql..." />
164 <copy file="conf/debug_mysql.properties" tofile="conf/debug.properties" overwrite="true"/>
165 <copy file="conf/release_mysql.properties" tofile="conf/release.properties" overwrite="true"/>
166 <antcall target="debug-config"/>