source: versions/3.5.201/Bui_Core/xConstructVirtualProject.xml @ 9258

Revision 9258, 9.8 KB checked in by anp, 5 years ago (diff)

deploiement modelingLevel1 opérationnel

Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!--
3 * LICENCE[[
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1/CeCILL 2.O
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is utc.fr code.
16 *
17 * The Initial Developer of the Original Code is
18 * antoine.pourchez@kelis.fr
19 *
20 * Portions created by the Initial Developer are Copyright (C) 2005
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 *
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * or the CeCILL Licence Version 2.0 (http://www.cecill.info/licences.en.html),
30 * in which case the provisions of the GPL, the LGPL or the CeCILL are applicable
31 * instead of those above. If you wish to allow use of your version of this file
32 * only under the terms of either the GPL or the LGPL, and not to allow others
33 * to use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL, the LGPL or the CeCILL.
38 * ]]LICENCE
39  -->
40
41<project name="Bui_virtualProject" basedir="."><!-- basedir toujours déja défini par l'appelant. niveau "project" -->
42       
43        <!-- Emplacement des sources -->
44        <property name="coreResourcesDir" value="${coredir}\resources"/>
45        <property name="coreXslConstructGlobal" value="${coreResourcesDir}\virtualsProjects\generateAnt.xsl"/>
46        <property name="currentFilePath" value="${wspdir}\Bui_Core\xConstructVirtualProject.xml"/>
47        <property name="destinstallerdir" value="${basedir}\..\..\releases"/>
48       
49        <!-- Paramètres -->
50        <property name="virtualProject.extension.exec.xsl" value="exec.xsl"/>
51        <property name="virtualProject.extension.exec.ant" value="exec.ant"/>
52        <property name="virtualProject.extension.remove" value="remove"/>
53       
54
55<!--**
56         * Construction du projet
57         * Paramètres d'entrée :
58         *   - virtualProject.in.path
59         *   - virtualProject.in.mainFile
60         *   - virtualProject.out.path
61         **-->
62        <target name="xConstructProject" description="Création du wspPack">
63                <property name="tmpDir.vp" value="tmp.virtualProjectTmpDir"/>
64                <property name="mainFilePath" location="${virtualProject.in.path}/${virtualProject.in.mainFile}.tmp"/>
65                <!-- # ini -->
66                <echo message="initialisations"/>
67                <mkdir dir="${tmpDir.vp}"/>
68                <delete dir="${virtualProject.out.path}"/>
69                <mkdir dir="${virtualProject.out.path}"/>
70                <!-- résolution des variables dans le mainFile -->
71                <copy file="${virtualProject.in.path}/${virtualProject.in.mainFile}" tofile="${mainFilePath}">
72                        <filterchain>
73                                <expandproperties/>
74                        </filterchain>
75                </copy>
76                <xmlproperty file="${mainFilePath}" semanticAttributes="true"/>
77                <echo message="Construction du projet '${virtualProject.in.path}/${virtualProject.in.mainFile}'"/>
78                <!-- # copie du projet source -->
79                <echo message="- copie du projet source"/>
80                <copy todir="${virtualProject.out.path}">
81                        <fileset dir="${virtualProject.mainProjectPath}"/>
82                </copy>
83                <!-- # copie des éléments statiques -->
84                <echo message="- copie des éléments statiques"/>
85                <copy todir="${virtualProject.out.path}" overwrite="true" failonerror="false">
86                        <fileset dir="${virtualProject.in.path}/${virtualProject.overlays.url}">
87                                <include name="**/**"/>
88                                <!--
89                                <exclude name="**/*.${virtualProject.extension.remove}"/>
90                                <exclude name="**/*.${virtualProject.extension.exec.xsl}"/>
91                                <exclude name="**/*.${virtualProject.extension.exec.ant}"/>
92                                -->
93                        </fileset>
94                </copy>
95                <!-- # suppression des éléments .remove -->
96                <foreach target="xDeleteDir" param="pElementToRemovePath">
97                        <path>
98                                <dirset dir="${virtualProject.out.path}">
99                                        <include name="**/*.${virtualProject.extension.remove}"/>
100                        </dirset>
101                        </path>
102                </foreach>
103                <foreach target="xDeleteFile" param="pElementToRemovePath">
104                        <path>
105                                <fileset dir="${virtualProject.out.path}">
106                                        <include name="**/*.${virtualProject.extension.remove}"/>
107                        </fileset>
108                        </path>
109                </foreach>
110                <!-- # execution des xsl -->
111                <foreach target="xExecXsl" param="pXslPath">
112                        <path>
113                                <fileset dir="${virtualProject.out.path}">
114                                        <include name="**/*.${virtualProject.extension.exec.xsl}"/>
115                        </fileset>
116                        </path>
117                </foreach>
118                <!-- # execution des ant -->
119                <foreach target="xExecAnt" param="pAntPath">
120                        <path>
121                                <fileset dir="${virtualProject.out.path}">
122                                        <include name="**/*.${virtualProject.extension.exec.ant}"/>
123                        </fileset>
124                        </path>
125                </foreach>
126                <!-- # création du ant pour les traitements globaux -->
127                <echo message="création du ant"/>
128                <property name="ant.path" value="${tmpDir.vp}/ant.ant"/>
129                <xslt in="${mainFilePath}" out="${ant.path}" style="${coreXslConstructGlobal}">
130                        <outputproperty name="method" value="xml"/>
131                        <param name="virtualProject.in.path" expression="${virtualProject.in.path}"/>
132                        <param name="virtualProject.out.path" expression="${virtualProject.out.path}"/>
133                        <param name="antFile" expression="${ant.path}"/>
134                </xslt>
135                <!-- # execution du ant pour créer les packages -->
136                <echo message="execution du ant pour création des packages"/>
137                <ant antfile="${ant.path}" inheritall="no"/>
138                <!-- # post processing -->
139                <delete dir="${tmpDir.vp}"/>
140                <delete file="${mainFilePath}" failonerror="false"/>
141        </target>
142       
143<!--**
144         * Suppression d'éléments (rep/fichier)
145         * Paramètres d'entrée :
146         *   - pElementToRemovePath
147         **-->
148        <target name="xDeleteFile" description="Suppression d'un fichier">
149                <propertyregex property="tmp.fileToRemovePath"
150              input="${pElementToRemovePath}"
151              regexp="(.*).${virtualProject.extension.remove}"
152              select="\1"
153              casesensitive="true"/>
154                <echo message="Suppression de '${tmp.fileToRemovePath}'"/>
155                <delete file="${tmp.fileToRemovePath}" failonerror="false"/>
156                <delete file="${pElementToRemovePath}" failonerror="false"/>
157        </target>
158        <target name="xDeleteDir" description="Suppression d'un répertoire">
159                <propertyregex property="tmp.fileToRemovePath"
160              input="${pElementToRemovePath}"
161              regexp="(.*).${virtualProject.extension.remove}"
162              select="\1"
163              casesensitive="true"/>
164                <echo message="Suppression de '${tmp.fileToRemovePath}'"/>
165                <delete dir="${tmp.fileToRemovePath}" failonerror="false"/>
166                <delete dir="${pElementToRemovePath}" failonerror="false"/>
167        </target>
168       
169<!--**
170         * Execution d'une XSL
171         * Paramètres d'entrée :
172         *   - pXslPath
173         **-->
174        <target name="xExecXsl" description="Execution d'une XSL">
175                <propertyregex property="tmp.fileToModifyPath"
176              input="${pXslPath}"
177              regexp="(.*).${virtualProject.extension.exec.xsl}"
178              select="\1"
179              casesensitive="true"/>
180                <echo message="Execution de la XSL sur '${tmp.fileToModifyPath}'"/>
181                <!-- on renomme le fichier pour éviter pb de fichier locké -->
182                <move file="${tmp.fileToModifyPath}" tofile="${tmp.fileToModifyPath}.srcXslTmp"/>
183                <!-- # on encode le fichier (pb doctype, entités, ...)-->
184                <!-- Remplacement du doctype -->
185                <replaceregexp flags="gm" match="&lt;(!ENTITY[^&gt;]*)&gt;" replace="#XxX#ENTITYTAG#BEGIN#XxX#\1#XxX#ENTITYTAG#END#XxX#" file="${tmp.fileToModifyPath}.srcXslTmp"/>
186                <replaceregexp match="&lt;!(DOCTYPE[^&gt;]*)&gt;" replace="&lt;!--\1--&gt;" file="${tmp.fileToModifyPath}.srcXslTmp"/>
187                <!-- Remplacement des entités -->
188                <replaceregexp flags="mg" match="&amp;" replace="#XxX#ENTITYTAG#AMP#XxX#" file="${tmp.fileToModifyPath}.srcXslTmp"/>
189                <!-- # on éxécute la XSL -->
190                <echo>IN : ${tmp.fileToModifyPath}.srcXslTmp</echo>
191                <echo>XSL : ${pXslPath}</echo>
192                <echo>OUT : ${tmp.fileToModifyPath}</echo>
193                <xslt style="${pXslPath}" in="${tmp.fileToModifyPath}.srcXslTmp" out="${tmp.fileToModifyPath}">
194                        <outputproperty name="method" value="xml"/>
195                </xslt>
196                <!-- # on décode le résultat (remise en état du doctye, ...)-->
197                <!-- Decode des entités -->
198                <replaceregexp flags="mg" match="#XxX#ENTITYTAG#AMP#XxX#" replace="&amp;" file="${tmp.fileToModifyPath}"/>
199                <!-- Decode du doctype -->
200                <replaceregexp match="&lt;!--(DOCTYPE[^&gt;]*)--&gt;" replace="&lt;!\1&gt;" file="${tmp.fileToModifyPath}"/>
201                <replaceregexp flags="gm" match="#XxX#ENTITYTAG#BEGIN#XxX#([^&gt;]*)#XxX#ENTITYTAG#END#XxX#" replace="&lt;\1&gt;" file="${tmp.fileToModifyPath}"/>
202                <!-- on supprime les fichiers temporaires -->
203                <delete file="${tmp.fileToModifyPath}.srcXslTmp" failonerror="false"/>
204                <delete file="${pXslPath}" failonerror="false"/>
205        </target>
206       
207<!--**
208         * Execution d'un ANT
209         * Paramètres d'entrée :
210         *   - pAntPath
211         **-->
212        <target name="xExecAnt" description="Execution d'un ANT">
213                <propertyregex property="tmp.fileToModifyPath"
214              input="${pAntPath}"
215              regexp="(.*).${virtualProject.extension.exec.ant}"
216              select="\1"
217              casesensitive="true"/>
218                <echo message="Execution du ANT sur '${tmp.fileToModifyPath}'"/>
219                <ant antfile="${pAntPath}">
220                        <property name="file.path" value="${tmp.fileToModifyPath}"/>
221                </ant>
222                <!-- on supprime les fichiers temporaires -->
223                <delete file="${pAntPath}" failonerror="false"/>
224        </target>
225
226</project>
227
Note: See TracBrowser for help on using the repository browser.