Project

General

Profile

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

git_sitools_idoc / flarecast / workspace / fr.cnes.sitools.core / build.xml @ master

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

    
15
        <!-- ============================================================================== 
16
                === Build file to allow ant (http://jakarta.apache.org/ant/) to be used === 
17
                to build the Sitools project. === === Author : AKKA Technologies === === 
18
                name : nom du projet === default : tache ant executee par defaut === basedir 
19
                : repertoire courant lors de l'execution des taches ant === ============================================================================== -->
20

    
21
        <!-- ATTENTION PENSER à positionner la propriété HOST dans le build.properties 
22
                Si une nouvelle librairie est utilisée dans le projet PENSER à la rajouter 
23
                à l'une OU l'autre des définitions de classpath dans le build.xml : - compile.classpath 
24
                - test.classpath PENSER que le fichier reference pour l'ajout de propriétés 
25
                est /conf/properties/sitools-reference.properties Il est utilisé pour générer 
26
                le fichier sitools.properties correspondant à la plateforme et utilisé par 
27
                l'application. -->
28

    
29
        <property file="build.properties" />
30

    
31
        <property file="conf/build/properties/build-test.properties" />
32

    
33
        <property file="conf/build/properties/build-${HOST}.properties" />
34

    
35
        <property file="build-default.properties" />
36

    
37
        <import file="sitools.userlibraries.ant.xml" optional="true" />
38

    
39
        <property name="cots.dir" value="${ROOT_DIRECTORY}/cots" />
40

    
41
        <property name="build.extensions.dir" value="../fr.cnes.sitools.ext.test/" />
42
        <property name="conf.dir" value="conf" />
43
        <property name="conf.reference.dir" value="${conf.dir}/reference" />
44
        <property name="conf.bin.dir" value="${conf.dir}/bin" />
45
        <property name="conf.jar.dir" value="${conf.dir}/jar" />
46
        <property name="conf.build.dir" value="${conf.dir}/build" />
47
        <property name="conf.build.properties.dir" value="${conf.dir}/build/properties" />
48
        <property name="conf.build.userlib.dir" value="${conf.dir}/build/userlibrairies" />
49
        <property name="conf.properties.dir" value="${conf.dir}/properties" />
50
        <property file="${conf.reference.dir}/sitools-reference.properties" prefix="properties" />
51

    
52

    
53
        <!-- TARGET par defaut : mise à jour du classpath, generation shell et build 
54
                du projet. -->
55
        <target name="build" depends="refresh-properties, refresh-userlibraries, build-shell, build-project, build-tests, copy-log4j-properties" />
56

    
57

    
58

    
59
        <!-- TARGET refresh-properties -->
60
        <target name="refresh-properties" description="Mise à jour du fichier de propriétés sitools.properties">
61

    
62
                <copy outputencoding="UTF-8" tofile="${conf.properties.dir}/sitools.properties" file="${conf.reference.dir}/sitools-reference.properties" overwrite="true" />
63

    
64
                <propertyfile file="${conf.properties.dir}/sitools.properties" comment="Update root property">
65
                        <entry key="Starter.ROOT_DIRECTORY" value="${ROOT_DIRECTORY}" />
66
                        <entry key="Starter.HOST_DOMAIN" value="${HOST_DOMAIN}" />
67
                        <entry key="Starter.DATABASE_URL" value="${DATABASE_URL}" />
68
                        <entry key="Starter.DATABASE_USER" value="${DATABASE_USER}" />
69
                        <entry key="Starter.DATABASE_PASSWORD" value="${DATABASE_PASSWORD}" />
70
                        <entry key="Starter.DATABASE_SCHEMA" value="${DATABASE_SCHEMA}" />
71
                        <entry key="Starter.DATABASE_DRIVER" value="${DATABASE_DRIVER}" />
72
                        <entry key="Starter.PUBLIC_HOST_DOMAIN" value="${PUBLIC_HOST_DOMAIN}" />
73
                        <entry key="Starter.HOST_PORT" value="${HOST_PORT}" />
74
                        <entry key="Security.Intranet.net" value="${SECURITY_INTRANET_NET}" />
75
                        <entry key="Security.Intranet.mask" value="${SECURITY_INTRANET_MASK}" />
76
                </propertyfile>
77

    
78
                <condition property="itnetIsSet">
79
                        <isset property="Security.Intranet.ADMIN" />
80
                </condition>
81
                <antcall target="refresh-itnet" />
82
                <copy outputencoding="UTF-8" tofile="sitools.properties" file="${conf.properties.dir}/sitools.properties" overwrite="true" />
83

    
84

    
85
        </target>
86

    
87

    
88
        <macrodef name="updatePropertyKey">
89
                <attribute name="propertyName" default="Security.Intranet.xxx" />
90
                <attribute name="propertyValue" default="false" />
91
                <attribute name="propertyFile" default="${conf.properties.dir}/sitools.properties" />
92
                <sequential>
93
                        <propertyfile file="@{propertyFile}">
94
                                <entry key="@{propertyName}" value="@{propertyValue}" operation="=" default="false" />
95
                        </propertyfile>
96
                </sequential>
97
        </macrodef>
98

    
99
        <!-- TARGET for sitools.akka.eu -->
100
        <target name="refresh-itnet" if="itnetIsSet">
101
                <updatePropertyKey propertyName="Security.Intranet.ADMIN" propertyValue="${Security.Intranet.ADMIN}" />
102
                <updatePropertyKey propertyName="Security.Intranet.USER" propertyValue="${Security.Intranet.USER}" />
103
                <updatePropertyKey propertyName="Security.Intranet.SYSTEM" propertyValue="${Security.Intranet.SYSTEM}" />
104
                <updatePropertyKey propertyName="Security.Intranet.ADMIN_DYNAMIC" propertyValue="${Security.Intranet.ADMIN_DYNAMIC}" />
105
                <updatePropertyKey propertyName="Security.Intranet.USER_DYNAMIC" propertyValue="${Security.Intranet.USER_DYNAMIC}" />
106
                <updatePropertyKey propertyName="Security.Intranet.SYSTEM_DYNAMIC" propertyValue="${Security.Intranet.SYSTEM_DYNAMIC}" />
107
        </target>
108

    
109
        <!-- TARGET refresh-properties -->
110
        <target name="refresh-build-date" description="Mise à jour du fichier de propriétés sitools.properties pour positionner la buid-date">
111

    
112
                <tstamp>
113
                        <format property="NOW" pattern="yyyy-MM-dd HH:mm:ss" locale="fr,FR" />
114
                </tstamp>
115

    
116
                <updatePropertyKey propertyName="Starter.BUILD_DATE" propertyValue="${NOW}" />
117
                <updatePropertyKey propertyName="Starter.BUILD_DATE" propertyValue="${NOW}" propertyFile="sitools.properties" />
118

    
119
        </target>
120

    
121

    
122
        <!-- TARGET execute-tests les tests doivent être executés après le build-project 
123
                ensuite on pourra aussi les executer avec le jar sitools généré dans dist 
124
                au lieu des classes, pour être plus sûr du bon fonctionnement. -->
125
        <target name="execute-tests" description="invoke sitools/prototype/execute-tests">
126
                <subant target="execute-tests">
127
                        <fileset dir="${conf.build.dir}" includes="build.xml" />
128
                </subant>
129
        </target>
130

    
131
        <target name="javadoc" description="Generate project javadoc">
132
                <subant target="javadoc-projet">
133
                        <fileset dir="${conf.build.dir}" includes="build.xml" />
134
                </subant>
135
        </target>
136

    
137

    
138

    
139
        <!-- TARGET cobertura les tests doivent être executés en mode instrumente -->
140
        <target name="coverage" description="invoke sitools/prototype/coverage">
141
                <subant target="coverage">
142
                        <fileset dir="${conf.build.dir}" includes="build.xml" />
143
                </subant>
144
        </target>
145

    
146
        <!-- TARGET audit les tests doivent être executés en mode instrumente -->
147
        <target name="audit" description="Generates a report of code convention violations">
148
                <subant target="audit">
149
                        <fileset dir="${conf.build.dir}" includes="build.xml" />
150
                </subant>
151
        </target>
152

    
153
        <!-- TARGET build-project -->
154
        <target name="build-project" description="invoke sitools/prototype/deploy-jar-projet" />
155

    
156
        <!-- TARGET build-project -->
157
        <target name="build-tests" description="invoke sitools/prototype/deploy-jar-test-projet">
158
                <subant target="deploy-jar-test-projet">
159
                        <fileset dir="${conf.build.dir}" includes="build.xml" />
160
                </subant>
161
                <antcall target="refresh-build-date" />
162
        </target>
163

    
164

    
165
        <!-- TARGET refresh-userlibraries -->
166
        <target name="refresh-userlibraries" description="Mise à jour des userlibrairies pour eclipse et pour Ant">
167
                <echo message="COTS dir : ${cots.dir}" />
168
                <xslt in="${conf.build.userlib.dir}/sitools.userlibraries" out="${conf.build.userlib.dir}/sitools.userlibraries.eclipse.xml" style="${conf.build.userlib.dir}/sitools.userlibraries.xsl" force="true" processor="SaxonLiaison">
169
                        <param name="output" expression="eclipse" />
170
                        <param name="ROOT_DIRECTORY" expression="${ROOT_DIRECTORY}" />
171
                        <outputproperty name="method" value="xml" />
172
                        <outputproperty name="standalone" value="no" />
173
                        <outputproperty name="encoding" value="UTF-8" />
174
                        <outputproperty name="indent" value="yes" />
175
                        <classpath location="${cots.dir}/saxon/saxon9he.jar" />
176
                        <classpath location="${cots.dir}/saxon/SaxonLiaison.jar" />
177
                </xslt>
178
                <xslt in="${conf.build.userlib.dir}/sitools.userlibraries" out="${conf.build.userlib.dir}/sitools.userlibraries.ant.xml" style="${conf.build.userlib.dir}/sitools.userlibraries.xsl" force="true" processor="SaxonLiaison">
179
                        <param name="output" expression="ant" />
180
                        <param name="ROOT_DIRECTORY" expression="${ROOT_DIRECTORY}" />
181
                        <outputproperty name="method" value="xml" />
182
                        <outputproperty name="standalone" value="yes" />
183
                        <outputproperty name="encoding" value="UTF-8" />
184
                        <outputproperty name="indent" value="yes" />
185
                        <classpath location="${cots.dir}/saxon/saxon9he.jar" />
186
                        <classpath location="${cots.dir}/saxon/SaxonLiaison.jar" />
187
                </xslt>
188
        </target>
189

    
190

    
191
        <!-- TARGET xslt-build-shell -->
192
        <target name="build-shell" description="Mise à jour du shell de lancement">
193
                <!-- build script sitools -->
194
                <copy file="${conf.reference.dir}/sitools-reference" tofile="${conf.bin.dir}/sitools" outputencoding="UTF-8" overwrite="true">
195
                        <filterchain>
196
                                <replacetokens>
197
                                        <token key="ROOT_DIRECTORY" value="${ROOT_DIRECTORY}" />
198
                                        <token key="VERSION" value="${properties.Starter.VERSION}" />
199
                                        <token key="PORT" value="${HOST_PORT}" />
200
                                        <token key="COPYRIGHT" value="${properties.Starter.COPYRIGHT}" />
201
                                </replacetokens>
202
                        </filterchain>
203
                </copy>
204
                <copy outputencoding="UTF-8" tofile="sitools" file="${conf.bin.dir}/sitools" overwrite="true" />
205
                <chmod file="sitools" perm="ugo+rx" />
206
                <chmod file="${conf.bin.dir}/sitools" perm="ugo+rx" />
207

    
208
                <!-- build script start sitools -->
209
                <xslt in="${conf.build.userlib.dir}/sitools.userlibraries" out="${conf.bin.dir}/startSitools.sh" style="${conf.build.userlib.dir}/sitools.userlibraries.xsl" force="true" processor="SaxonLiaison">
210
                        <param name="output" expression="shell" />
211
                        <param name="ROOT_DIRECTORY" expression="${ROOT_DIRECTORY}" />
212
                        <param name="LOG_DIRECTORY" expression="${ROOT_DIRECTORY}" />
213
                        <param name="PORT" expression="${HOST_PORT}" />
214
                        <outputproperty name="method" value="text" />
215
                        <outputproperty name="standalone" value="no" />
216
                        <outputproperty name="encoding" value="UTF-8" />
217
                        <outputproperty name="indent" value="yes" />
218
                        <classpath location="${cots.dir}/saxon/saxon9he.jar" />
219
                        <classpath location="${cots.dir}/saxon/SaxonLiaison.jar" />
220
                </xslt>
221
                <xslt in="${conf.build.userlib.dir}/sitools.userlibraries" out="${conf.bin.dir}/startSitools.bat" style="${conf.build.userlib.dir}/sitools.userlibraries.xsl" force="true" processor="SaxonLiaison">
222
                        <param name="output" expression="bat" />
223
                        <param name="ROOT_DIRECTORY" expression="${ROOT_DIRECTORY}" />
224
                        <outputproperty name="method" value="text" />
225
                        <outputproperty name="standalone" value="no" />
226
                        <outputproperty name="encoding" value="UTF-8" />
227
                        <outputproperty name="indent" value="yes" />
228
                        <classpath location="${cots.dir}/saxon/saxon9he.jar" />
229
                        <classpath location="${cots.dir}/saxon/SaxonLiaison.jar" />
230
                </xslt>
231
                <copy outputencoding="UTF-8" tofile="startSitools.sh" file="${conf.bin.dir}/startSitools.sh" overwrite="true" />
232
                <copy outputencoding="UTF-8" tofile="startSitools.bat" file="${conf.bin.dir}/startSitools.bat" overwrite="true" />
233
                <chmod file="startSitools.sh" perm="ugo+rx" />
234
                <chmod file="${conf.bin.dir}/startSitools.sh" perm="ugo+rx" />
235
        </target>
236

    
237
        <target name="jar" description="target to refresh the core jar">
238
                <subant target="jar" buildpath="./conf/build" />
239
                <subant target="deploy-jar" buildpath="./conf/build" />
240
        </target>
241

    
242
        <target name="copy-log4j-properties" description="Copy the log4j properties to the root folder">
243
                <copy outputencoding="UTF-8" tofile="log4j.properties" file="${conf.properties.dir}/log4j.properties" overwrite="true" />
244
        </target>
245

    
246

    
247

    
248

    
249
</project>