1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <project name="SIMAN Web Services Server web applcation" default="build-war" >
4 <property environment="env" />
6 <property file="build.properties" description="set the build parameters" />
8 <property file="../${siman-common.project.name}/build.properties" description="set the build parameters" />
9 <property file="../${splat.project.name}/build.properties" description="set the build parameters" />
11 <property name="time.simple.pattern" value="dd/MM/yyyy" />
13 <format property="datesimple" pattern="${time.simple.pattern}" />
16 <property name="time.pattern" value="hh:mm:ss" />
18 <format property="time" pattern="${time.pattern}" />
22 <!-- ================================================= -->
23 <!-- siman-common: Build Siman-Common project -->
24 <!-- ================================================= -->
26 <target name="siman-common" description="Builds Siman-Common project">
27 <ant dir="../${siman-common.project.name}" />
30 <!-- ================================================= -->
31 <!-- copy-config: Copy parametrized config files -->
32 <!-- ================================================= -->
33 <macrodef name="copy-config">
34 <!-- Parameter "mode" can be equal to "debug" or "release" -->
35 <attribute name="mode" />
37 <echo message="Generating configuration in @{mode} mode" />
38 <!-- Copy files from config source directory according to the given mode -->
39 <loadfile property="customer" srcfile="${config.src.dir}/customer.txt"/>
40 <loadfile property="som" srcfile="${config.src.dir}/${customer}_som.properties"/>
41 <echo message="som: ${som}"/>
42 <loadfile property="som.en" srcfile="${config.src.dir}/${customer}_som_en.properties"/>
43 <copy todir="${basedir}/${config.@{mode}.dir}" overwrite="true">
44 <fileset dir="${config.src.dir}/templates">
46 <!-- Transform the files from templates substituting properties values -->
48 <filter token="som" value="${som}" />
49 <filter token="som.en" value="${som.en}" />
50 <filter token="datesimple" value="${datesimple}" />
51 <filter token="time" value="${time}" />
52 <!-- Get properties to substitute according to the given mode -->
53 <filtersfile file="${config.src.dir}/@{mode}.properties" />
54 <!-- Substitute the complete config source directory path value in files -->
55 <filter token="config.src.dir" value="${basedir}${file.separator}${config.src.dir}${file.separator}templates" />
61 <!-- ================================================= -->
62 <!-- debug-config: Generate parametrized config files -->
63 <!-- ================================================= -->
64 <target name="debug-config" description="Generate parametrized debug config files">
65 <copy-config mode="debug" />
68 <!-- =================================================== -->
69 <!-- release-config: Generate parametrized config files -->
70 <!-- =================================================== -->
71 <target name="release-config" description="Generate parametrized release config files">
72 <copy-config mode="release" />
75 <!-- ===================================================================== -->
76 <!-- build-dist : Create the war file -->
77 <!-- ===================================================================== -->
78 <target name="build-war" depends="clean, release-config" description="Builds the WAR distribution">
79 <echo message="build ${webapp.name}.war" />
81 <mkdir dir="${siman-ws.dist.dir}" />
82 <war destfile="${siman-ws.dist.dir}/${webapp.name}.war" webxml="${basedir}/${siman-ws.content.dir}/WEB-INF/web.xml">
83 <fileset dir="${siman-ws.content.dir}" />
84 <!-- Copy all sources except those which should be generated -->
85 <classes dir="${siman-ws.bin.dir}/classes">
86 <present present="srconly" targetdir="${config.release.dir}" />
88 <!-- Copy generated sources -->
89 <zipfileset dir="${config.release.dir}" prefix="WEB-INF/classes" />
91 <attribute name="Built-By" value="${app.author}" />
92 <attribute name="Version" value="${app.version}" />
93 <attribute name="Built-Date" value="${datesimple}" />
95 <lib dir="${basedir}/../${siman-common.project.name}/${siman-common.dist.dir}" includes="**/*.jar" />
96 <lib dir="${basedir}/../${siman-common.project.name}/${siman-common.lib.dir}" includes="**/*.jar" />
97 <lib dir="${basedir}/../${splat.project.name}/${splat.dist.dir}" includes="**/*.jar" />
98 <lib dir="${basedir}/../${splat.project.name}/${splat.lib.dir}" includes="**/*.jar" />
102 <!-- ================================================= -->
103 <!-- clean: Clean the dist directory -->
104 <!-- ================================================= -->
105 <target name="clean" description="clean the build directory">
106 <echo message="deleting files in ${siman-ws.dist.dir}" />
107 <delete includeemptydirs="true" failonerror="false">
108 <fileset dir="${siman-ws.dist.dir}" includes="**/*" />
112 <!-- ================================================= -->
113 <!-- prepare-postgres: Prepare config for Postgress -->
114 <!-- ================================================= -->
115 <target name="prepare-postgres" description="prepare configuration for Postgress">
116 <echo message="Prepare configuration for Postgress..." />
117 <copy file="${config.src.dir}/debug_pg.properties" tofile="${config.src.dir}/debug.properties" overwrite="true"/>
118 <copy file="${config.src.dir}/release_pg.properties" tofile="${config.src.dir}/release.properties" overwrite="true"/>
119 <antcall target="debug-config"/>
122 <!-- ================================================= -->
123 <!-- prepare-postgres: Prepare config for MySql -->
124 <!-- ================================================= -->
125 <target name="prepare-mysql" description="prepare configuration for MySql">
126 <echo message="Prepare configuration for MySql..." />
127 <copy file="${config.src.dir}/debug_mysql.properties" tofile="${config.src.dir}/debug.properties" overwrite="true"/>
128 <copy file="${config.src.dir}/release_mysql.properties" tofile="${config.src.dir}/release.properties" overwrite="true"/>
129 <antcall target="debug-config"/>
132 <!-- ================================================= -->
133 <!-- prepare-customer: Prepare config for the given customer -->
134 <!-- ================================================= -->
135 <macrodef name="prepare-customer">
136 <!-- Parameter "customer" can be equal to "cea" or "edf" -->
137 <attribute name="customer" />
139 <echo message="Prepare config for the customer @{customer}" />
140 <echo message="@{customer}" file="${config.src.dir}/customer.txt"/>
141 <copy file="${config.src.dir}/@{customer}_som.xml" tofile="WebContent/conf/som.xml" overwrite="true"/>
142 <antcall target="debug-config"/>
146 <!-- ================================================= -->
147 <!-- prepare-cea: Prepare config for CEA -->
148 <!-- ================================================= -->
149 <target name="prepare-cea" description="prepare configuration for CEA">
150 <echo message="Prepare configuration for CEA..." />
151 <prepare-customer customer="cea" />
154 <!-- ================================================= -->
155 <!-- prepare-cea: Prepare config for EDF -->
156 <!-- ================================================= -->
157 <target name="prepare-edf" description="prepare configuration for EDF">
158 <echo message="Prepare configuration for EDF..." />
159 <prepare-customer customer="edf" />