Project

General

Profile

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

git_sitools_idoc / flarecast / workspace / sitools-install-izpack / build.xml @ d2a8c3fd

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.install" default="build" basedir=".">
21

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

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

    
35
        <property name="fr.cnes.sitools.core.dir"
36
                value="${ROOT_DIRECTORY_LOCAL}/workspace/fr.cnes.sitools.core" />
37

    
38
        <property name="data.dir" value="${ROOT_DIRECTORY_LOCAL}/data" />
39
        <property name="freemarker.data.dir" value="${data.dir}/freemarker" />
40

    
41
        <property name="conf.dir" value="${fr.cnes.sitools.core.dir}/conf" />
42
        <property name="conf.bin.dir" value="${conf.dir}/bin" />
43
        <property name="conf.jar.dir" value="${conf.dir}/jar" />
44
        <property name="conf.properties.dir" value="${conf.dir}/properties" />
45
        <property name="conf.reference.dir" value="${conf.dir}/reference" />
46
        <property name="conf.build.userlib.dir" value="${conf.dir}/build/userlibrairies" />
47
        <property name="cots.dir" value="${ROOT_DIRECTORY_LOCAL}/cots" />
48

    
49
        <!-- Informations pour la construction de l'installeur -->
50
        <property name="install.dir" value="${basedir}" />
51
        <property name="install.res.dir" value="${install.dir}/res" />
52
        <property name="install.res.script.dir" value="${install.res.dir}/script" />
53
        <property name="install.res.properties.dir" value="${install.res.dir}/properties" />
54
        <property name="install.res.data.dir" value="${install.res.dir}/data" />
55
        <property name="install.lib.dir" value="${install.dir}/lib" />
56
        <property name="install.conf.dir" value="${install.dir}/conf" />
57
        <property name="install.build.dir" value="${install.conf.dir}/build" />
58

    
59
        <property name="product.short.name" value="sitools2" />
60
        <property name="product.version" value="0.1" />
61
        <property name="temp.dir" value="${install.dir}/tmp" />
62

    
63

    
64

    
65
        <!-- Allows us to use the IzPack Ant task -->
66
        <taskdef name="izpack" classpath="${install.lib.dir}/standalone-compiler.jar"
67
                classname="com.izforge.izpack.ant.IzPackTask" />
68

    
69

    
70
        <target name="build-jars" description="creates the Jars for IzPack custom behavior">
71
                <subant target="build-jars">
72
                        <fileset dir="${install.build.dir}" includes="build.xml" />
73
                </subant>
74
        </target>
75

    
76
        <target name="build"
77
                depends="build-jars, refresh-properties-for-install, build-shell-for-install, minify-javascripts, build-izpack-installer" />
78

    
79
        <!-- TARGET refresh-properties-for-install -->
80
        <target name="refresh-properties-for-install"
81
                description="Mise à jour du fichier de propriétés sitools.properties pour install">
82
                <copy outputencoding="UTF-8"
83
                        tofile="${install.res.properties.dir}/sitools.properties" file="${conf.reference.dir}/sitools-reference.properties"
84
                        overwrite="true" />
85
                <propertyfile file="${install.res.properties.dir}/sitools.properties"
86
                        comment="Update root property">
87
                        <!-- Sitools server parameters -->
88
                        <entry key="Starter.ROOT_DIRECTORY" value="${ROOT_DIRECTORY}" />
89
                        <entry key="Starter.HOST_DOMAIN" value="${HOST_DOMAIN}" />
90
                        <entry key="Starter.HOST_PORT" value="${HOST_PORT}" />
91
                        <entry key="Starter.PUBLIC_HOST_DOMAIN" value="${PUBLIC_HOST_DOMAIN}" />
92
                        <!-- Database parameters -->
93
                        <entry key="Starter.DATABASE_URL" value="${DATABASE_URL}" />
94
                        <entry key="Starter.DATABASE_USER" value="${DATABASE_USER}" />
95
                        <entry key="Starter.DATABASE_PASSWORD" value="${DATABASE_PASSWORD}" />
96
                        <entry key="Starter.DATABASE_DRIVER" value="${DATABASE_DRIVER}" />
97
                        <entry key="Starter.DATABASE_SCHEMA" value="${DATABASE_SCHEMA}" />
98
                        <!-- email parameters -->
99
                        <entry key="Starter.mail.send.admin" value="${EMAIL_ADDRESS}" />
100
                        <entry key="Starter.mail.send.server" value="${SMTP_SERVER}" />
101
                        <entry key="Starter.mail.send.tls" value="${SMTP_TLS}" />
102
                        <entry key="Starter.mail.send.identifier" value="${SMTP_IDENTIFIER}" />
103
                        <entry key="Starter.mail.send.secret" value="${SMTP_PASSWORD}" />
104
                        <entry key="Starter.StatusService.CONTACT_MAIL" value="${EMAIL_ADDRESS}" />
105
                        <!-- Proxy parameters -->
106
                        <entry key="Starter.WITH_PROXY" value="${WITH_PROXY}" />
107
                        <entry key="Starter.PROXY_HOST" value="${PROXY_HOST}" />
108
                        <entry key="Starter.PROXY_PORT" value="${PROXY_PORT}" />
109
                        <entry key="Starter.PROXY_USER" value="${PROXY_USER}" />
110
                        <entry key="Starter.PROXY_PASSWORD" value="${PROXY_PASSWORD}" />
111
                        <entry key="Starter.NONPROXY_HOSTS" value="${NONPROXY_HOSTS}" />
112

    
113
                        <entry key="Starter.APP_PATH" value="${APP_PATH}" />
114

    
115

    
116

    
117
                </propertyfile>
118
        </target>
119

    
120
        <!-- TARGET xslt-build-shell-for-install -->
121
        <target name="build-shell-for-install"
122
                description="Mise à jour du shell de lancement pour l'installeur">
123
                <property file="${install.res.properties.dir}/sitools.properties" prefix="properties" />
124
                <!-- build script sitools -->
125
                <copy file="${conf.reference.dir}/sitools-reference" tofile="${install.res.script.dir}/sitools"
126
                        outputencoding="UTF-8" overwrite="true">
127
                        <filterchain>
128
                                <replacetokens>
129
                                        <token key="ROOT_DIRECTORY" value="%{INSTALL_PATH}" />
130
                                        <token key="VERSION" value="%{APP_VER}" />
131
                                        <token key="PORT" value="%{host_port}" />
132
                                        <token key="COPYRIGHT" value="${properties.Starter.COPYRIGHT}" />
133
                                </replacetokens>
134
                        </filterchain>
135
                </copy>
136

    
137

    
138
                <xslt in="${conf.build.userlib.dir}/sitools.dist.userlibraries"
139
                        out="${install.res.script.dir}/startSitools.sh" style="${conf.build.userlib.dir}/sitools.userlibraries.xsl"
140
                        force="true" processor="SaxonLiaison">
141
                        <param name="output" expression="shell" />
142
                        <param name="ROOT_DIRECTORY" expression="%INSTALL_PATH" />
143
                        <param name="LOG_DIRECTORY" expression="%INSTALL_PATH" />
144
                        <param name="PORT" expression="%{host_port}" />
145
                        <outputproperty name="method" value="text" />
146
                        <outputproperty name="standalone" value="no" />
147
                        <outputproperty name="encoding" value="UTF-8" />
148
                        <outputproperty name="indent" value="yes" />
149
                        <classpath location="${cots.dir}/saxon/saxon9he.jar" />
150
                        <classpath location="${cots.dir}/saxon/SaxonLiaison.jar" />
151
                </xslt>
152
                <xslt in="${conf.build.userlib.dir}/sitools.dist.userlibraries"
153
                        out="${install.res.script.dir}/startSitools.bat" style="${conf.build.userlib.dir}/sitools.userlibraries.xsl"
154
                        force="true" processor="SaxonLiaison">
155
                        <param name="output" expression="bat" />
156
                        <param name="ROOT_DIRECTORY" expression="%INSTALL_PATH" />
157
                        <param name="LOG_DIRECTORY" expression="%INSTALL_PATH" />
158
                        <outputproperty name="method" value="text" />
159
                        <outputproperty name="standalone" value="no" />
160
                        <outputproperty name="encoding" value="UTF-8" />
161
                        <outputproperty name="indent" value="yes" />
162
                        <classpath location="${cots.dir}/saxon/saxon9he.jar" />
163
                        <classpath location="${cots.dir}/saxon/SaxonLiaison.jar" />
164
                </xslt>
165
        </target>
166
        
167
        <target name="minify-javascripts" description="build javascript and freemarker for production use">
168
                
169
                <exec executable="conf/scripts/minifyjs.bat" osfamily="windows" failonerror="true">
170
            <arg value="${ROOT_DIRECTORY_LOCAL}"/>
171
        </exec>
172
                
173
        <exec executable="conf/scripts/minifyjs.sh" osfamily="unix" failonerror="true">
174
            <arg value="${ROOT_DIRECTORY_LOCAL}"/>
175
        </exec>
176
                
177
                <antcall target="build-freemarker-sources"/>
178
        </target>
179

    
180
        <!-- TARGET build freemarker for production use (with minified sources -->
181
        <target name="build-freemarker-sources" description="build freemarker for production use (with minified sources">
182
                <antcall target="configure-freemarker-as-minified">
183
                        <param name="name" value="adminIndex.ftl" />
184
                </antcall>
185
                <antcall target="configure-freemarker-as-minified">
186
                        <param name="name" value="portalIndex.ftl" />
187
                </antcall>
188
                <antcall target="configure-freemarker-as-minified">
189
                        <param name="name" value="projectIndex.ftl" />
190
                </antcall>
191
        </target>
192

    
193
        <!--
194
        Modify a specific freemarker to use production sources
195
        @param name : the name of the freemarker to set to prod use
196
        -->
197
        <target name="configure-freemarker-as-minified" description="Modify a specific freemarker to use production sources">
198

    
199
                <property name="freemarker.file" value="${install.res.data.dir}/freemarker/${name}" />
200
                <copy file="${freemarker.data.dir}/${name}" tofile="${freemarker.file}" outputencoding="UTF-8" overwrite="true">
201
                </copy>
202
                <replace file="${freemarker.file}" token="&lt;!-- BEGIN_JS_DEV_INCLUDES --&gt;" value="&lt;!--">
203
                </replace>
204
                <replace file="${freemarker.file}" token="&lt;!-- END_JS_DEV_INCLUDES --&gt;" value="--&gt;">
205
                </replace>
206
                <replace file="${freemarker.file}" token="&lt;!-- BEGIN_PROD" value="">
207
                </replace>
208
                <replace file="${freemarker.file}" token="END PROD --&gt;" value="">
209
                </replace>
210
                <replace file="${freemarker.file}" token="&lt;!-- BEGIN_DEV --&gt;" value="&lt;!--">
211
                </replace>
212
                <replace file="${freemarker.file}" token="&lt;!-- END_DEV --&gt;" value="--&gt;">
213
                </replace>
214
        </target>
215

    
216

    
217

    
218

    
219
        <!-- TARGET build-izpack-installer creates the izpack installer file -->
220

    
221
        <target name="build-izpack-installer" description="generation de l'installeur IzPack">
222
                <echo message="Build installer from file : ${install.dir}/install.xml with base dir = ${install.dir}" >
223
                </echo>
224
                <property file="${install.res.properties.dir}/sitools.properties" prefix="properties" />
225
                <!-- Run installer build -->
226
                <izpack input="${install.dir}/install.xml"
227
                        output="${install.dir}/${properties.Starter.appName}-${properties.Starter.VERSION}-install.jar"
228
                        installerType="standard" inheritAll="true" basedir="${install.dir}"
229
                        compression="deflate" compressionlevel="9" />
230
        </target>
231

    
232

    
233

    
234
</project>