Salome HOME
Comment were added
[tools/siman.git] / Workspace / Siman / build.xml
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <project name="Siman-War" default="build-war">
3
4         <property environment="env" />
5
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" />
9
10         <property name="time.simple.pattern" value="dd/MM/yyyy" />
11         <tstamp>
12                 <format property="datesimple" pattern="${time.simple.pattern}" />
13         </tstamp>
14
15         <property name="time.pattern" value="hh:mm:ss" />
16         <tstamp>
17                 <format property="time" pattern="${time.pattern}" />
18         </tstamp>
19
20         <!-- ================================================= -->
21         <!--    siman-common: Build Siman-Common project           -->
22         <!-- ================================================= -->
23         <target name="siman-common" description="Builds Siman-Common project">
24                 <ant dir="../${siman-common.project.name}" />
25         </target>
26
27         <!-- ================================================= -->
28         <!--    copy-config: Copy parametrized config files        -->
29         <!-- ================================================= -->
30         <macrodef name="copy-config">
31                 <!-- Parameter "mode" can be equal to "debug" or "release" -->
32                 <attribute name="mode" />
33                 <sequential>
34                         <echo message="Generating configuration in @{mode} mode" />
35                         <!-- Copy files from config source directory according to the given mode -->
36                         <copy todir="${basedir}/${config.@{mode}.dir}" overwrite="true">
37                                 <fileset dir="${config.src.dir}/templates">
38                                 </fileset>
39                                 <!-- Transform the files from templates substituting properties values -->
40                                 <filterset>
41                                         <filter token="datesimple" value="${datesimple}" />
42                                         <filter token="time" value="${time}" />
43                                         <!-- Get properties to substitute according to the given mode -->
44                                         <filtersfile file="${config.src.dir}/@{mode}.properties" />
45                                         <!-- Substitute the complete config source directory path value in files -->
46                                         <filter token="config.src.dir" value="${basedir}${file.separator}${config.src.dir}${file.separator}templates" />
47                                 </filterset>
48                         </copy>
49                 </sequential>
50         </macrodef>
51
52         <!-- ================================================= -->
53         <!--  debug-config: Generate parametrized config files -->
54         <!-- ================================================= -->
55         <target name="debug-config" description="Generate parametrized debug config files">
56                 <copy-config mode="debug" />
57         </target>
58
59         <!-- =================================================== -->
60         <!--  release-config: Generate parametrized config files -->
61         <!-- =================================================== -->
62         <target name="release-config" description="Generate parametrized release config files">
63                 <copy-config mode="release" />
64         </target>
65
66     <!-- ===================================================================== -->
67     <!-- compile-java : compile the java classes                               -->
68     <!-- ===================================================================== -->
69     <target name="compile-java" depends="siman-common" description="Builds the java classes">
70         <echo message="Compile Siman java classes" />
71         <mkdir dir="${siman.bin.dir}/temp"/>
72         <javac target="1.6" srcdir="${siman.src.dir}"  destdir="${siman.bin.dir}/temp" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memoryMaximumSize="${compiler.max.memory}" fork="true" optimize="${compiler.optimize}" deprecation="${compiler.deprecation}">
73             <classpath>
74                 <fileset dir="../${siman-common.project.name}/${siman-common.ext.dir}" includes="**/*" />
75                 <fileset dir="../${splat.project.name}/${splat.dist.dir}" includes="**/*" />
76                 <fileset dir="../${splat.project.name}/${splat.lib.dir}" includes="**/*" />
77                 <fileset dir="../${siman-common.project.name}/${siman-common.dist.dir}" includes="**/*" />
78                 <fileset dir="../${siman-common.project.name}/${siman-common.lib.dir}" includes="**/*" />
79                 <fileset dir="${siman.content.dir}/WEB-INF/lib" includes="**/*" />
80              </classpath>
81             <exclude name="test/**" />
82         </javac>
83     </target>
84
85         <!-- ===================================================================== -->
86         <!-- build-dist : Create the war file                                                      -->
87         <!-- ===================================================================== -->
88         <target name="build-war" depends="clean, siman-common, compile-java, release-config" description="Builds the WAR distribution">
89                 <echo message="build ${webapp.name}.war" />
90
91                 <mkdir dir="${siman.dist.dir}" />
92                 <war destfile="${siman.dist.dir}/${webapp.name}.war" webxml="${basedir}/${siman.content.dir}/WEB-INF/web.xml">
93                         <fileset dir="${siman.content.dir}" />
94                         <!-- Copy all sources except those which should be generated -->
95                         <classes dir="${siman.bin.dir}/classes">
96                                 <present present="srconly" targetdir="${config.release.dir}" />
97                         </classes>
98                         <!-- Copy generated sources -->
99                         <zipfileset dir="${config.release.dir}" prefix="WEB-INF/classes" />
100                         <manifest>
101                                 <attribute name="Built-By" value="${app.author}" />
102                                 <attribute name="Version" value="${app.version}" />
103                                 <attribute name="Built-Date" value="${datesimple}" />
104                         </manifest>
105                         <lib dir="${basedir}/../${siman-common.project.name}/${siman-common.dist.dir}" includes="**/*.jar" />
106                         <lib dir="${basedir}/../${siman-common.project.name}/${siman-common.lib.dir}" includes="**/*.jar" />
107                         <lib dir="${basedir}/../${splat.project.name}/${splat.dist.dir}" includes="**/*.jar" />
108                         <lib dir="${basedir}/../${splat.project.name}/${splat.lib.dir}" includes="**/*.jar" />
109                 </war>
110         </target>
111
112         <!-- ================================================= -->
113         <!--    clean: Clean the dist directory                            -->
114         <!-- ================================================= -->
115         <target name="clean" description="clean the build directory">
116                 <echo message="deleting files in ${siman.dist.dir}" />
117                 <delete includeemptydirs="true" failonerror="false">
118                         <fileset dir="${siman.dist.dir}" includes="**/*" />
119                 </delete>
120         </target>
121 </project>