Project

General

Profile

Download (13.8 KB) Statistics
| Branch: | Revision:

git_sitools_idoc / flarecast / workspace / sitools-test-izpack / build.xml @ master

1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- ===================================
3
==  Copyright 2010-2014 CNES - CENTRE NATIONAL d'ETUDES SPATIALES
4
==  
5
==  This file is part of SITools2.
6
==  
7
==  SITools2 is free software: you can redistribute it and/or modify
8
==  it under the terms of the GNU General Public License as published by
9
==  the Free Software Foundation, either version 3 of the License, or
10
==  (at your option) any later version.
11
==  
12
==  SITools2 is distributed in the hope that it will be useful,
13
==  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
==  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
==  GNU General Public License for more details.
16
==  
17
==  You should have received a copy of the GNU General Public License
18
==  along with SITools2.  If not, see <http://www.gnu.org/licenses/>.
19
==================================== -->
20
<project name="fr.cnes.sitools.test.install" basedir="."
21
        default="build">
22

    
23
        <!-- ============================================================================== 
24
                === Build file to allow ant (http://jakarta.apache.org/ant/) to be used === 
25
                to build the Sitools project. === === Author : AKKA Technologies === === 
26
                name : nom du projet === default : tache ant executee par defaut === basedir 
27
                : repertoire courant lors de l'execution des taches ant === ============================================================================== -->
28
        <!-- Chargement du build.properties pour mettre en place les variables -->
29
        <property file="build.properties" />
30
        <!-- Chargement du build-install.properties pour mettre en place les variables 
31
                relative a sitools.properties -->
32
        <property file="build-install.properties" />
33

    
34
        <import file="sitools.userlibraries.ant.xml" optional="true" />
35

    
36
        <property name="fr.cnes.sitools.core.dir"
37
                value="${ROOT_DIRECTORY_LOCAL}/workspace/fr.cnes.sitools.core" />
38
        <property name="conf.dir" value="${fr.cnes.sitools.core.dir}/conf" />
39
        <property name="conf.bin.dir" value="${conf.dir}/bin" />
40
        <property name="conf.jar.dir" value="${conf.dir}/jar" />
41
        <property name="conf.properties.dir" value="${conf.dir}/properties" />
42
        <property name="conf.reference.dir" value="${conf.dir}/reference" />
43
        <property name="conf.build.userlib.dir" value="${conf.dir}/build/userlibrairies" />
44
        <property name="cots.dir" value="${ROOT_DIRECTORY_LOCAL}/cots" />
45

    
46
        <!-- Informations pour la construction de l'installeur -->
47
        <property name="install.dir" value="${basedir}" />
48
        <property name="install.res.dir" value="${install.dir}/res" />
49
        <property name="install.res.script.dir" value="${install.res.dir}/script" />
50
        <property name="install.res.properties.dir" value="${install.res.dir}/properties" />
51
        <property name="install.lib.dir" value="${install.dir}/lib" />
52

    
53
        <property name="temp.dir" value="${install.dir}/tmp" />
54

    
55
        <!-- Targets dbunits pour exemple à reprendre -->
56

    
57
        <!-- <property name="jdbc.postgresql.driver.jar" value="../libraries/postgresql-8.3-603.jdbc3.jar" 
58
                /> <property name="jdbc.mysql.driver.jar" value="../libraries/mysql-connector-java-5.1.7-bin.jar" 
59
                /> -->
60

    
61
        <!-- Allows us to use the dbunit task -->
62
        <taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask">
63
                <classpath>
64
                        <path location="${cots.dir}/dbunit-2.4.8/dbunit-2.4.8.jar" />
65
                        <path location="${cots.dir}/slf4j-1.6.1/slf4j-api-1.6.1.jar" />
66
                        <path location="${cots.dir}/slf4j-1.6.1/slf4j-jdk14-1.6.1.jar" />
67
                </classpath>
68
        </taskdef>
69

    
70
        <!-- Allows us to use the IzPack Ant task -->
71
        <taskdef name="izpack" classpath="./install_res/libraries/standalone-compiler.jar"
72
                classname="com.izforge.izpack.ant.IzPackTask" />
73

    
74

    
75

    
76
        <!-- GENERATE The XML file for Database recovery with DBUnit for the tests 
77
                execution -->
78
        <!-- -->
79
        <target name="save-pg" description="Save the Postgresql DB as an xml file">
80
                <dbunit driver="${PG_DATABASE_DRIVER}" url="${PG_DATABASE_URL}"
81
                        userid="${PG_DATABASE_USER}" password="${PG_DATABASE_PASSWORD}"
82
                        schema="fuse" classpath="${PG_DATABASE_DRIVER_PATH}">
83
                        <dbconfig>
84
                                <property name="datatypeFactory"
85
                                        value="org.dbunit.ext.postgresql.PostgresqlDataTypeFactory" />
86
                                <feature name="batchedStatements" value="true" />
87
                        </dbconfig>
88
                        <!-- Export of PG database -->
89
                        <!-- <export dest="./res/export/postgresql/export_fuse_pg.xml"> -->
90
                        <!-- <query name="headers" sql='SELECT * FROM fuse."headers"' /> -->
91
                        <!-- <query name="iapdatasets" sql='SELECT * FROM fuse."iapdatasets"' 
92
                                /> -->
93
                        <!-- <query name="object_class" sql='SELECT * FROM fuse."object_class"' 
94
                                /> -->
95
                        <!-- <query name="fuse_prg_id" sql='SELECT * FROM fuse."fuse_prg_id"' 
96
                                /> -->
97
                        <!-- </export> -->
98
                        <export dest="./res/export/postgresql/export_sitools_pg.xml">
99
                                <query name="USERS" sql='SELECT * FROM sitools."USERS"' />
100
                                <query name="GROUPS" sql='SELECT * FROM sitools."GROUPS"' />
101
                                <query name="USER_GROUP" sql='SELECT * FROM sitools."USER_GROUP"' />
102
                                <query name="USER_PROPERTIES" sql='SELECT * FROM sitools."USER_PROPERTIES"' />
103
                        </export>
104
                        <export dest="./res/export/postgresql/export_tests_pg.xml">
105
                                <query name="table_tests" sql='SELECT * FROM test."table_tests"' />
106
                        </export>
107
                </dbunit>
108
        </target>
109

    
110
        <!-- GENERATE The XML file for Database recovery with DBUnit for the tests 
111
                execution -->
112
        <!-- -->
113
        <target name="save-mysql" description="Save the Mysql DB as an xml file">
114
<!--                <dbunit driver="${MYSQL_DATABASE_DRIVER}" url="${MYSQL_DATABASE_URL}/cnes-fuse"-->
115
<!--                        userid="${MYSQL_DATABASE_USER}" password="${MYSQL_DATABASE_PASSWORD}"-->
116
<!--                        classpath="${MYSQL_DATABASE_DRIVER_PATH}">-->
117
<!--                        <dbconfig>-->
118
<!--                                <property name="datatypeFactory" value="org.dbunit.ext.mysql.MySqlDataTypeFactory" />-->
119
<!--                                <feature name="batchedStatements" value="true" />-->
120
<!--                        </dbconfig>-->
121
<!--                         Export of FUSE schema -->
122
<!--                        <export dest="./res/export/mysql/export_fuse_mysql.xml">-->
123
<!--                                <query name="HEADERS" sql='SELECT * FROM HEADERS' />-->
124
<!--                                <query name="IAPDATASETS" sql='SELECT * FROM IAPDATASETS' />-->
125
<!--                                <query name="OBJECT_CLASS" sql='SELECT * FROM OBJECT_CLASS' />-->
126
<!--                                <query name="FUSE_PRG_ID" sql='SELECT * FROM FUSE_PRG_ID' />-->
127
<!--                        </export>                        -->
128
<!--                </dbunit>-->
129
                
130
                <dbunit driver="${MYSQL_DATABASE_DRIVER}" url="${MYSQL_DATABASE_URL}/cnes"
131
                        userid="${MYSQL_DATABASE_USER}" password="${MYSQL_DATABASE_PASSWORD}"
132
                        classpath="${MYSQL_DATABASE_DRIVER_PATH}">
133
                        <dbconfig>
134
                                <property name="datatypeFactory" value="org.dbunit.ext.mysql.MySqlDataTypeFactory" />
135
                                <feature name="batchedStatements" value="true" />
136
                        </dbconfig>
137
                        <export dest="./res/export/mysql/export_sitools_mysql.xml">
138
                                <query name="USERS" sql='SELECT * FROM USERS' />
139
                                <query name="GROUPS" sql='SELECT * FROM GROUPS' />
140
                                <query name="USER_GROUP" sql='SELECT * FROM USER_GROUP' />
141
                                <query name="USER_PROPERTIES" sql='SELECT * FROM USER_PROPERTIES' />
142
                        </export>                        
143
                </dbunit>
144
                
145
                <dbunit driver="${MYSQL_DATABASE_DRIVER}" url="${MYSQL_DATABASE_URL}/cnes-test"
146
                        userid="${MYSQL_DATABASE_USER}" password="${MYSQL_DATABASE_PASSWORD}"
147
                        classpath="${MYSQL_DATABASE_DRIVER_PATH}">
148
                        <dbconfig>
149
                                <property name="datatypeFactory" value="org.dbunit.ext.mysql.MySqlDataTypeFactory" />
150
                                <feature name="batchedStatements" value="true" />
151
                        </dbconfig>
152
                        <export dest="./res/export/mysql/export_tests_mysql.xml">
153
                                <query name="TABLE_TESTS" sql='SELECT * FROM TABLE_TESTS' />
154
                        </export>
155
                </dbunit>
156
        </target>
157

    
158
        <!-- ========================================================================================= 
159
                Restauration des données exportées ========================================================================================= -->
160
        <target name="restore-pg">
161
                <dbunit driver="${PG_DATABASE_DRIVER}" url="${PG_DATABASE_URL}"
162
                        userid="${PG_DATABASE_USER}" password="${PG_DATABASE_PASSWORD}"
163
                        classpath="${jdbc.postgresql.driver.jar}" schema="fuse">
164
                        <dbconfig>
165
                                <property name="datatypeFactory"
166
                                        value="org.dbunit.ext.postgresql.PostgresqlDataTypeFactory" />
167
                                <feature name="batchedStatements" value="true" />
168
                        </dbconfig>
169
                        <operation type="INSERT" src="./res/export/export_fuse_pg.xml" />
170
                </dbunit>
171
        </target>
172

    
173
        <!-- ========================================================================================= 
174
                Restauration des données exportées ========================================================================================= -->
175
        <target name="restore-mysql">
176
                <dbunit driver="${MYSQL_DATABASE_DRIVER}" url="${MYSQL_DATABASE_URL}/cnes-test"
177
                        userid="${MYSQL_DATABASE_USER}" password="${MYSQL_DATABASE_PASSWORD}"
178
                        classpath="${MYSQL_DATABASE_DRIVER_PATH}">
179
                        <dbconfig>
180
                                <property name="datatypeFactory" value="org.dbunit.ext.mysql.MySqlDataTypeFactory" />
181
                                <feature name="batchedStatements" value="true" />
182
                        </dbconfig>
183
                        <operation type="UPDATE" src="./res/export/export_sitools_mysql.xml" />
184
                </dbunit>
185
        </target>
186

    
187

    
188
        <target name="build"
189
                depends="build-jars, refresh-properties-for-install, build-izpack-installer" />
190

    
191

    
192
        <!-- TARGET refresh-properties-for-install -->
193
        <target name="refresh-properties-for-install"
194
                description="Mise à jour du fichier de propriétés sitools.properties pour install">
195
                <copy outputencoding="UTF-8"
196
                        tofile="${install.res.properties.dir}/sitools.properties" file="${fr.cnes.sitools.core.dir}/sitools.properties"
197
                        overwrite="true" />
198
                <propertyfile file="${install.res.properties.dir}/sitools.properties"
199
                        comment="Update test ">
200
                        <entry key="Tests.PGSQL_DATABASE_USER" value="${PGSQL_DATABASE_USER}" />
201
                        <entry key="Tests.PGSQL_DATABASE_URL" value="${PGSQL_DATABASE_URL}" />
202
                        <entry key="Tests.PGSQL_DATABASE_PASSWORD" value="${PGSQL_DATABASE_PASSWORD}" />
203

    
204
                        <entry key="Tests.MYSQL_DATABASE_USER" value="${MYSQL_DATABASE_USER}" />
205
                        <entry key="Tests.MYSQL_DATABASE_URL" value="${MYSQL_DATABASE_URL}" />
206
                        <entry key="Tests.MYSQL_DATABASE_PASSWORD" value="${MYSQL_DATABASE_PASSWORD}" />
207
                </propertyfile>
208
        </target>
209

    
210
        <!-- TARGET build-izpack-installer creates the izpack installer file -->
211

    
212
        <target name="build-izpack-installer" description="generation de l'installeur IzPack">
213
                <echo message="Build installer from file : ${install.dir}/install.xml">
214
                </echo>
215
                <property file="res/properties/sitools.properties" prefix="properties" />
216
                <!-- Run installer build -->
217
                <izpack input="${install.dir}/install.xml"
218
                        output="${install.dir}/${properties.Starter.appName}-${properties.Starter.VERSION}-DB-tests.jar"
219
                        installerType="standard" inheritAll="true" basedir="${install.dir}"
220
                        compression="deflate" compressionlevel="9" />
221
        </target>
222

    
223
        <!-- =============================================================================== 
224
                BUILD DES SOURCES ET JAR DES SOURCES =============================================================================== -->
225
        <!-- =============================================================================== 
226
                Parametres du projet =============================================================================== -->
227

    
228
        <!-- Informations generales sur le projet -->
229
        <property name="project.name" value="sitools-test-izpack" />
230
        <property name="project.fullname" value="sitools-test-izpack" />
231
        <property name="project.version" value="0.9.1M4" />
232

    
233
        <!-- Information sur les auteurs du projet -->
234
        <property name="author" value="AKKA Technologies" />
235
        <property name="year" value="2010-2013" />
236

    
237
        <!-- Paramètres de compilation -->
238
        <property name="debug" value="true" />
239
        <property name="optimize" value="off" />
240
        <property name="deprecation" value="off" />
241
        <property name="encoding" value="UTF-8" />
242

    
243

    
244
        <!-- Repertoires destination pour la construction de l'application -->
245
        <property name="out.dir" value="bin" />
246
        <!--property name="out.dir" value="web/WEB-INF/"/ -->
247
        <property name="out.classes.dir" value="${out.dir}" />
248

    
249
        <!-- Repertoires de deploiement des fichiers "externes" du jar de validator -->
250
        <property name="dist.dir.validator" value="bin/validator" />
251
        <property name="jar.name.validator" value="validator.jar" />
252

    
253

    
254
        <!-- Repertoires de deploiement des fichiers "externes" du jar de Database 
255
                panel -->
256
        <property name="dist.dir.database-panel" value="bin/panels" />
257
        <property name="jar.name.database-panel" value="DatabasePanel.jar" />
258

    
259
        <!-- Classpath pour la compilation -->
260
        <path id="compile.classpath">
261
                <pathelement location="install_res/libraries/standalone-compiler.jar" />
262
                <pathelement location="install_res/libraries/dbunit-2.4.8.jar" />
263
        </path>
264

    
265
        <!-- TARGETS -->
266
        <target name="build-jars"
267
                depends="prepare, compile,jar-validator,jar-database-panel,cleanup" />
268

    
269
        <target name="prepare">
270
                <!-- Creation des repertoires classes -->
271
                <mkdir dir="${out.classes.dir}" />
272
        </target>
273

    
274

    
275
        <target name="compile">
276
                <javac srcdir="./src" debug="${debug}" destdir="${out.classes.dir}"
277
                        deprecation="${deprecation}" optimize="${optimize}" encoding="${encoding}"
278
                        includeAntRuntime="false">
279
                        <classpath refid="compile.classpath" />
280
                </javac>
281
        </target>
282

    
283
        <target name="jar-validator">
284
                <delete file="${dist.dir.validator}/${jar.name.validator}" />
285
                <property name="version.num" value="${project.version}" />
286
                <buildnumber file="build.num" />
287
                <mkdir dir="${dist.dir.validator}"></mkdir>
288
                <jar jarfile="${dist.dir.validator}/${jar.name.validator}">
289
                        <fileset dir="${out.classes.dir}" includes="**/JDBCConnectionModelTests.class" />
290
                        <fileset dir="${out.classes.dir}" includes="**/JDBCConnectionValidator.class" />
291
                        <fileset dir="${out.classes.dir}" includes="**/SchemaExportFileModel.class" />
292
                </jar>
293

    
294
        </target>
295

    
296
        <target name="jar-database-panel">
297
                <delete file="${dist.dir.database-panel}/${jar.name.database-panel}" />
298
                <property name="version.num" value="${project.version}" />
299
                <buildnumber file="build.num" />
300
                <mkdir dir="${dist.dir.database-panel}"></mkdir>
301
                <jar jarfile="${dist.dir.database-panel}/${jar.name.database-panel}">
302
                        <fileset dir="${out.classes.dir}" includes="**/DatabasePanel.class" />
303
                </jar>
304
        </target>
305

    
306
        <target name="cleanup">
307
                <delete>
308
                        <fileset dir="." includes="**/*.class" />
309
                </delete>
310
        </target>
311

    
312
</project>