Salome HOME
som.xmls are updated for xao geometry
[tools/siman.git] / Workspace / Siman-WS / build.xml
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <project name="SIMAN Web Services Server web applcation"  default="build-war" >
3
4         <property environment="env" />
5
6         <property file="build.properties" description="set the build parameters" />
7
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" />
10
11         <property name="time.simple.pattern" value="dd/MM/yyyy" />
12         <tstamp>
13                 <format property="datesimple" pattern="${time.simple.pattern}" />
14         </tstamp>
15
16         <property name="time.pattern" value="hh:mm:ss" />
17         <tstamp>
18                 <format property="time" pattern="${time.pattern}" />
19         </tstamp>
20
21
22         <!-- ================================================= -->
23         <!--    siman-common: Build Siman-Common project           -->
24         <!-- ================================================= -->
25         <!--
26         <target name="siman-common" description="Builds Siman-Common project">
27                 <ant dir="../${siman-common.project.name}" />
28         </target>
29 -->
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" />
36                 <sequential>
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">
45                                 </fileset>
46                                 <!-- Transform the files from templates substituting properties values -->
47                                 <filterset>
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" />
56                                 </filterset>
57                         </copy>
58                 </sequential>
59         </macrodef>
60
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" />
66         </target>
67
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" />
73         </target>
74
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" />
80
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}" />
87                         </classes>
88                         <!-- Copy generated sources -->
89                         <zipfileset dir="${config.release.dir}" prefix="WEB-INF/classes" />
90                         <manifest>
91                                 <attribute name="Built-By" value="${app.author}" />
92                                 <attribute name="Version" value="${app.version}" />
93                                 <attribute name="Built-Date" value="${datesimple}" />
94                         </manifest>
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" />
99                 </war>
100         </target>
101
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="**/*" />
109                 </delete>
110         </target>
111
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"/>
120         </target>
121
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"/>
130         </target>
131
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" />
138         <sequential>
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"/>
143         </sequential>
144     </macrodef>
145     
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" />
152     </target>
153
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" />
160     </target>
161 </project>