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="datesimple" value="${datesimple}" />
49 <filter token="time" value="${time}" />
50 <!-- Get properties to substitute according to the given mode -->
51 <filtersfile file="${config.src.dir}/@{mode}.properties" />
52 <!-- Substitute the complete config source directory path value in files -->
53 <filter token="config.src.dir" value="${basedir}${file.separator}${config.src.dir}${file.separator}templates" />
59 <!-- ================================================= -->
60 <!-- debug-config: Generate parametrized config files -->
61 <!-- ================================================= -->
62 <target name="debug-config" description="Generate parametrized debug config files">
63 <copy-config mode="debug" />
66 <!-- =================================================== -->
67 <!-- release-config: Generate parametrized config files -->
68 <!-- =================================================== -->
69 <target name="release-config" description="Generate parametrized release config files">
70 <copy-config mode="release" />
73 <!-- ===================================================================== -->
74 <!-- build-dist : Create the war file -->
75 <!-- ===================================================================== -->
76 <target name="build-war" depends="clean, release-config" description="Builds the WAR distribution">
77 <echo message="build ${webapp.name}.war" />
79 <mkdir dir="${siman-ws.dist.dir}" />
80 <war destfile="${siman-ws.dist.dir}/${webapp.name}.war" webxml="${basedir}/${siman-ws.content.dir}/WEB-INF/web.xml">
81 <fileset dir="${siman-ws.content.dir}" />
82 <!-- Copy all sources except those which should be generated -->
83 <classes dir="${siman-ws.bin.dir}/classes">
84 <present present="srconly" targetdir="${config.release.dir}" />
86 <!-- Copy generated sources -->
87 <zipfileset dir="${config.release.dir}" prefix="WEB-INF/classes" />
89 <attribute name="Built-By" value="${app.author}" />
90 <attribute name="Version" value="${app.version}" />
91 <attribute name="Built-Date" value="${datesimple}" />
93 <lib dir="${basedir}/../${siman-common.project.name}/${siman-common.dist.dir}" includes="**/*.jar" />
94 <lib dir="${basedir}/../${siman-common.project.name}/${siman-common.lib.dir}" includes="**/*.jar" />
95 <lib dir="${basedir}/../${splat.project.name}/${splat.dist.dir}" includes="**/*.jar" />
96 <lib dir="${basedir}/../${splat.project.name}/${splat.lib.dir}" includes="**/*.jar" />
100 <!-- ================================================= -->
101 <!-- clean: Clean the dist directory -->
102 <!-- ================================================= -->
103 <target name="clean" description="clean the build directory">
104 <echo message="deleting files in ${siman-ws.dist.dir}" />
105 <delete includeemptydirs="true" failonerror="false">
106 <fileset dir="${siman-ws.dist.dir}" includes="**/*" />
110 <!-- ================================================= -->
111 <!-- prepare-postgres: Prepare config for Postgress -->
112 <!-- ================================================= -->
113 <target name="prepare-postgres" description="prepare configuration for Postgress">
114 <echo message="Prepare configuration for Postgress..." />
115 <copy file="${config.src.dir}/debug_pg.properties" tofile="${config.src.dir}/debug.properties" overwrite="true"/>
116 <copy file="${config.src.dir}/release_pg.properties" tofile="${config.src.dir}/release.properties" overwrite="true"/>
117 <antcall target="debug-config"/>
120 <!-- ================================================= -->
121 <!-- prepare-postgres: Prepare config for MySql -->
122 <!-- ================================================= -->
123 <target name="prepare-mysql" description="prepare configuration for MySql">
124 <echo message="Prepare configuration for MySql..." />
125 <copy file="${config.src.dir}/debug_mysql.properties" tofile="${config.src.dir}/debug.properties" overwrite="true"/>
126 <copy file="${config.src.dir}/release_mysql.properties" tofile="${config.src.dir}/release.properties" overwrite="true"/>
127 <antcall target="debug-config"/>
130 <!-- ================================================= -->
131 <!-- prepare-customer: Prepare config for the given customer -->
132 <!-- ================================================= -->
133 <macrodef name="prepare-customer">
134 <!-- Parameter "customer" can be equal to "cea" or "edf" -->
135 <attribute name="customer" />
137 <echo message="Prepare config for the customer @{customer}" />
138 <echo message="@{customer}" file="${config.src.dir}/customer.txt"/>
139 <copy file="${config.src.dir}/@{customer}_som.xml" tofile="WebContent/conf/som.xml" overwrite="true"/>
140 <antcall target="debug-config"/>
144 <!-- ================================================= -->
145 <!-- prepare-cea: Prepare config for CEA -->
146 <!-- ================================================= -->
147 <target name="prepare-cea" description="prepare configuration for CEA">
148 <echo message="Prepare configuration for CEA..." />
149 <prepare-customer customer="cea" />
152 <!-- ================================================= -->
153 <!-- prepare-cea: Prepare config for EDF -->
154 <!-- ================================================= -->
155 <target name="prepare-edf" description="prepare configuration for EDF">
156 <echo message="Prepare configuration for EDF..." />
157 <prepare-customer customer="edf" />