forked from alextu/ipWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·282 lines (246 loc) · 12.3 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<project name="ipWeb" default="build" basedir=".">
<target name="build" depends="init.build,build.woapp,javaclient,ssdd,war,split,package" />
<target name="install" depends="init.install,cleanbuild,build.woapp,javaclient,ssdd,war,split,package" />
<target name="package-asso" depends="init.install">
<property name="wsdest.dir" value="${dest.dir}/Split" />
<condition property="org.cocktail.versionClass.check.failed">
<not>
<isset property="org.cocktail.versionClass" />
</not>
</condition>
<fail message="La propriété org.cocktail.versionClass n'est pas définie. Vérifiez le fichier build.properties." if="org.cocktail.versionClass.check.failed" />
<condition property="org.cocktail.sphere.check.failed">
<not>
<isset property="org.cocktail.sphere" />
</not>
</condition>
<fail message="La propriété org.cocktail.sphere n'est pas définie. Vérifiez le fichier build.properties." if="org.cocktail.sphere.check.failed" />
<java classname="${org.cocktail.versionClass}" fork="yes" outputproperty="_versionNum" classpath="bin" />
<condition property="legal-version">
<matches pattern="^([0-9]+(.[0-9]+)*)$" string="${_versionNum}"/>
</condition>
<fail message="Le résultat de la methode Main de la classe ${org.cocktail.versionClass} n'est pas un n° de version valide"
unless="legal-version"/>
<tstamp>
<format property="TODAY_ASSO" pattern="yyyy.MM.dd" locale="fr,FR"/>
</tstamp>
<property name="org.cocktail.woadestfile" value="${dest.dir}/woa - ${org.cocktail.sphere} - ${TODAY_ASSO} - ${build.app.name.lowercase} v${_versionNum}.tar.gz" />
<property name="org.cocktail.webdestfile" value="${dest.dir}/web - ${org.cocktail.sphere} - ${TODAY_ASSO} - ${build.app.name.lowercase} v${_versionNum}.tar.gz" />
<delete file="${org.cocktail.woadestfile}" failonerror="false"/>
<delete file="${org.cocktail.webdestfile}" failonerror="false"/>
<tar destfile="${org.cocktail.woadestfile}"
compression="gzip"
longfile="gnu">
<tarfileset dir="${dest.dir}" mode="750">
<include name="${build.app.name}.woa/${build.app.name}"/>
</tarfileset>
<tarfileset dir="${dest.dir}">
<exclude name="${build.app.name}.woa/${build.app.name}"/>
<include name="${build.app.name}.woa/**"/>
</tarfileset>
</tar>
<tar destfile="${org.cocktail.webdestfile}"
compression="gzip"
basedir="${wsdest.dir}/WebObjects"
longfile="gnu"
includes="${build.app.name}.woa/**">
</tar>
</target>
<target name="clean" depends="init.properties">
<delete dir="bin" />
<delete dir="dist" />
</target>
<target name="cleanbuild" depends="init.properties">
<delete dir="${dest.dir}/${build.app.name}.woa" />
<delete file="${dest.dir}/${build.app.name}-Application.${build.app.version}.tar.gz"/>
<delete file="${dest.dir}/${build.app.name}-WebServerResources.${build.app.version}.tar.gz"/>
</target>
<!-- basic initializations -->
<target name="init.install" depends="init.properties">
<tstamp />
<property name="dest.dir" value="${wo.apps.root}" />
</target>
<target name="init.build" depends="init.properties">
<tstamp />
<property name="dest.dir" value="dist" />
</target>
<!-- property determination -->
<target name="init.properties">
<property file="build.properties" />
<property name="wolips.properties" value="${user.home}${file.separator}Library${file.separator}Application Support${file.separator}WOLips${file.separator}wolips.properties" />
<property file="${wolips.properties}" />
<condition property="wo.properties.check.failed">
<not>
<and>
<isset property="wo.system.frameworks" />
<isset property="wo.local.frameworks" />
</and>
</not>
</condition>
<fail message="The properties 'wo.system.frameworks' and 'wo.local.frameworks' must be set. Check that your ${wolips.properties} is correct." if="wo.properties.check.failed" />
<property name="build.app.name" value="${project.name}" />
<property name="build.app.name.lowercase" value="${project.name.lowercase}" />
</target>
<!-- This copies webserver resources from app.woa's embedded frameworks into split install bundle -->
<target name="split" description="Adds embedded framework webserver resources to the split install bundle by copying from deployment build bundle" unless="servletDeployment">
<property name="wsdest.dir" value="${dest.dir}/Split" />
<mkdir dir="${wsdest.dir}"/>
<copy todir="${wsdest.dir}/WebObjects/${build.app.name}.woa" verbose="true">
<fileset dir="${dest.dir}/${build.app.name}.woa/Contents">
<include name="Frameworks/*.framework/WebServerResources/**"/>
</fileset>
<fileset dir="${dest.dir}/${build.app.name}.woa">
<include name="Contents/WebServerResources/**"/>
</fileset>
</copy>
</target>
<target name="package" unless="servletDeployment">
<tar destfile="${dest.dir}/${build.app.name}-Application.${build.app.version}.tar.gz"
compression="gzip"
longfile="gnu">
<tarfileset dir="${dest.dir}" mode="750">
<include name="${build.app.name}.woa/${build.app.name}"/>
</tarfileset>
<tarfileset dir="${dest.dir}">
<exclude name="${build.app.name}.woa/${build.app.name}"/>
<include name="${build.app.name}.woa/**"/>
</tarfileset>
</tar>
<tar destfile="${dest.dir}/${build.app.name}-WebServerResources.${build.app.version}.tar.gz"
compression="gzip"
basedir="${wsdest.dir}/WebObjects"
longfile="gnu"
includes="${build.app.name}.woa/**">
</tar>
</target>
<!-- woproject tasks -->
<target name="build.woapp" depends="compile">
<taskdef name="woapplication" classname="org.objectstyle.woproject.ant.WOApplication"/>
<woapplication name="${build.app.name}" wsdestdir="${wo.ws.docroot}" frameworksBaseURL="/WebObjects/${project.name}.woa/Frameworks" destDir="${dest.dir}" customInfoPListContent="${customInfoPListContent}" principalClass="${principalClass}" webXML="${webXML}" webXML_CustomContent="${webXML_CustomContent}" servletAdaptor="com.webobjects.jspservlet.WOServletAdaptor">
<classes dir="${classes.dir}">
<includesfile name="woproject/classes.include.patternset" />
<excludesfile name="woproject/classes.exclude.patternset" />
</classes>
<wsresources dir=".">
<includesfile name="woproject/wsresources.include.patternset" />
<excludesfile name="woproject/wsresources.exclude.patternset" />
</wsresources>
<resources dir=".">
<includesfile name="woproject/resources.include.patternset" />
<excludesfile name="woproject/resources.exclude.patternset" />
</resources>
<frameworks root="ProjectLocal" embed="${embed.ProjectLocal}" eclipse="true" />
<frameworks root="External" embed="${embed.External}" eclipse="true" />
<frameworks root="Local" embed="${embed.Local}" eclipse="true" />
<frameworks root="User" embed="${embed.User}" eclipse="true" />
<frameworks root="System" embed="${embed.System}" eclipse="true" />
<frameworks root="Network" embed="${embed.Network}" eclipse="true" />
<lib dir="Libraries">
<include name="*.jar" />
</lib>
</woapplication>
</target>
<target name="javaclient" if="javaClient" depends="build.woapp">
<mkdir dir="${dest.dir}/${build.app.name}.woa/Contents/WebServerResources/Java" />
<jar basedir="${classes.dir}" includes="**/client/**/*.class,**/common/**/*.class" jarfile="${dest.dir}/${build.app.name}.woa/Contents/WebServerResources/Java/${build.app.name}.jar"/>
<!-- project user.d2wmodel file (D2JC only) -->
<copy file="user.d2wmodel" tofile="${dest.dir}/${build.app.name}.woa/Contents/Resources/user.d2wmodel"/>
</target>
<target name="war" if="servletDeployment" depends="ssdd">
<war destfile="${dest.dir}/${build.app.name}.war" webxml="${dest.dir}/${build.app.name}/WEB-INF/web.xml">
<fileset dir="${dest.dir}/${build.app.name}">
<include name="**" />
</fileset>
</war>
</target>
<!-- To use this target
1) create the LICENSE in your project directory
2) add JavaWOJSPServlet in your WOFrameworks build path
3) set servlet deployment to true in WOLips Properties
-->
<target name="ssdd" if="servletDeployment" depends="build.woapp">
<mkdir dir="${dest.dir}/${build.app.name}/WEB-INF/classes" />
<mkdir dir="${dest.dir}/${build.app.name}/WEB-INF/tlds" />
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/">
<fileset dir="${dest.dir}/${build.app.name}.woa/Contents/">
<include name="web.xml" />
</fileset>
</copy>
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/">
<fileset dir="..">
<include name="LICENSE" />
</fileset>
</copy>
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/">
<fileset dir="${dest.dir}">
<include name="${build.app.name}.woa/**" />
</fileset>
</copy>
<!-- copy the frameworks to the WEBINFROOT/Library directory -->
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/">
<fileset dir="${dest.dir}/${build.app.name}.woa/Contents">
<include name="Library/**" />
</fileset>
</copy>
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/">
<fileset dir="${dest.dir}/${build.app.name}.woa">
<include name="Resources/**" />
</fileset>
</copy>
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/lib/">
<fileset dir="${dest.dir}/${build.app.name}/WEB-INF">
<include name="**/Resources/**/*.jar" />
</fileset>
<mapper type="flatten" />
</copy>
<!-- Get the necessary Frameworks from the webobjects system root instead of the project wrapper -->
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/lib" file="${wo.system.frameworks}/JavaWOJSPServlet.framework/WebServerResources/Java/JavaWOJSPServlet_client.jar" />
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/tlds">
<fileset dir="${wo.system.frameworks}/JavaWOJSPServlet.framework/Resources/">
<include name="WOtaglib_1_0.tld" />
</fileset>
</copy>
<!-- the WebObject Extensions -->
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/lib">
<fileset dir="${wo.extensions}">
<include name="*.jar" />
<exclude name="servlet.jar" />
</fileset>
<mapper type="flatten" />
</copy>
<!-- the Java Client Client-Side Classes -->
<copy todir="${dest.dir}/${build.app.name}/WEB-INF/${build.app.name}.woa/Contents/WebServerResources/Java">
<fileset dir="${wo.local.frameworks}">
<include name="**/WebServerResources/Java/*.jar"/>
</fileset>
<mapper type="flatten"/>
</copy>
<!-- fix the Macos*ClassPath.txt files -->
<replaceregexp file="${dest.dir}/${build.app.name}/WEB-INF/${build.app.name}.woa/Contents/MacOS/MacOSClassPath.txt" match="APPROOT/Resources/Java/${build.app.name.lowercase}.jar" replace="APPROOT/${build.app.name}.woa/Contents/Resources/Java/${build.app.name.lowercase}.jar" byline="true" />
<replaceregexp file="${dest.dir}/${build.app.name}/WEB-INF/${build.app.name}.woa/Contents/MacOS/MacOSXServerClassPath.txt" match="APPROOT/Resources/Java/${build.app.name.lowercase}.jar" replace="APPROOT/${build.app.name}.woa/Contents/Resources/Java/${build.app.name.lowercase}.jar" byline="true" />
<!-- fix the web.xml file: the app itself needs build.app.name/Contents -->
<replaceregexp file="${dest.dir}/${build.app.name}/WEB-INF/web.xml" match="WEBINFROOT/Resources/Java/${build.app.name.lowercase}.jar" replace="WEBINFROOT/${build.app.name}.woa/Contents/Resources/Java/${build.app.name.lowercase}.jar" byline="true" />
<!-- fix the web.xml file to remove the extra Frameworks/ directory level for the frameworks -->
<replaceregexp file="${dest.dir}/${build.app.name}/WEB-INF/web.xml" match="WEBINFROOT/Frameworks//" replace="WEBINFROOT/" byline="true" />
</target>
<target name="compile" depends="init.properties">
<taskdef name="wocompile" classname="org.objectstyle.woproject.ant.WOCompile" />
<mkdir dir="bin" />
<wocompile srcdir="Sources" destdir="bin">
<frameworks root="ProjectLocal" embed="false" eclipse="true" />
<frameworks root="External" embed="false" eclipse="true" />
<frameworks root="Local" embed="false" eclipse="true" />
<frameworks root="User" embed="false" eclipse="true" />
<frameworks root="System" embed="false" eclipse="true" />
<frameworks root="Network" embed="false" eclipse="true" />
<classpath>
<fileset dir="Libraries">
<include name="*.jar" />
</fileset>
<fileset dir="${wo.extensions}">
<include name="*.jar" />
</fileset>
</classpath>
</wocompile>
</target>
</project>