Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6838a5f70c5d743c87713de149fab0b902292df5 (plain) (blame)
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<?xml version="1.0" encoding="UTF-8"?>
<project name="org.eclipse.help.webapp" default="build.jars" basedir=".">

	<property name="basews" value="${ws}"/>
	<property name="baseos" value="${os}"/>
	<property name="basearch" value="${arch}"/>
	<property name="basenl" value="${nl}"/>

	<!-- Compiler settings. -->
	<property name="javacFailOnError" value="false"/>
	<property name="javacDebugInfo" value="on"/>
	<property name="javacVerbose" value="false"/>
	<property name="javacSource" value="1.3"/>
	<property name="javacTarget" value="1.2"/>
	<property name="compilerArg" value=""/>
	<property name="logExtension" value=".log"/> 

	<path id="path_bootclasspath">
		<fileset dir="${java.home}/lib">
			<include name="*.jar"/>
		</fileset>
	</path>
	<property name="bootclasspath" refid="path_bootclasspath"/>
	
	<property name="fragment" value="org.eclipse.help.webapp"/>
	<property name="version.suffix" value="3.2.0"/>
	<property name="full.name" value="${fragment}_${version.suffix}"/>

	<target name="init" depends="properties">
		<condition property="pluginTemp" value="${buildTempFolder}/plugins">
			<isset property="buildTempFolder"/>
		</condition>
		<property name="pluginTemp" value="${basedir}"/>
		<condition property="build.result.folder" value="${pluginTemp}/org.eclipse.help.webapp">
			<isset property="buildTempFolder"/>
		</condition>
		<property name="build.result.folder" value="${basedir}"/>
		<property name="temp.folder" value="${basedir}/temp.folder"/>
		<property name="plugin.destination" value="${basedir}"/>
	</target>

	<target name="properties" if="eclipse.running">
		<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>

	</target>

	<target name="build.update.jar" depends="init" description="Build the plug-in: org.eclipse.help.webapp for an update site.">
		<delete dir="${temp.folder}"/>
		<mkdir dir="${temp.folder}"/>
		<antcall target="build.jars"/>
		<antcall target="gather.bin.parts">
			<param name="destination.temp.folder" value="${temp.folder}/"/>
		</antcall>
		<zip destfile="${plugin.destination}/${full.name}.jar" basedir="${temp.folder}/${full.name}" filesonly="false" whenempty="skip" update="false"/>
		<delete dir="${temp.folder}"/>
	</target>

	<target name="webapp.jar" depends="init" unless="webapp.jar" description="Create jar: webapp.jar.">
		<delete dir="${temp.folder}/webapp.jar.bin"/>
		<mkdir dir="${temp.folder}/webapp.jar.bin"/>
		<!-- compile the source code -->
		<javac destdir="${temp.folder}/webapp.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" source="${javacSource}" target="${javacTarget}"		>
			<compilerarg line="${compilerArg}"/>
			<classpath>
				<pathelement path="../org.eclipse.help.base/bin"/>
				<pathelement path="../org.eclipse.help.base/@dot"/>
				<pathelement path="../org.apache.lucene/bin"/>
				<pathelement path="../org.apache.lucene/lucene-1.4.3.jar"/>
				<pathelement path="../org.apache.lucene/parser.jar"/>
				<pathelement path="../org.eclipse.help/bin"/>
				<pathelement path="../org.eclipse.help/@dot"/>
				<pathelement path="../org.eclipse.core.runtime"/>
				<pathelement path="../org.eclipse.core.runtime/@dot"/>
				<pathelement path="../org.eclipse.equinox.common"/>
				<pathelement path="../org.eclipse.equinox.common/@dot"/>
				<pathelement path="../org.eclipse.equinox.preferences"/>
				<pathelement path="../org.eclipse.equinox.preferences/@dot"/>	
				<pathelement path="../org.eclipse.osgi"/>
				<pathelement path="../org.eclipse.osgi/@dot"/>
				<pathelement path="../org.eclipse.help.appserver/bin"/>
				<pathelement path="../org.eclipse.help.appserver/@dot"/>
				<pathelement path="../org.eclipse.osgi/bin"/>
				<pathelement path="../org.eclipse.core.runtime/bin"/>
				<pathelement path="../org.eclipse.help"/>
				<pathelement path="../org.eclipse.help.base"/>
				<pathelement path="../org.eclipse.help.appserver"/>
				<pathelement path="../org.eclipse.tomcat/servlet.jar"/>
				<pathelement path="../org.eclipse.tomcat/jasper-runtime.jar"/>
			</classpath>
			<src path="src/"			/>
			<compilerarg line="-log ${temp.folder}/webapp.jar.bin${logExtension}" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/> 
			</javac>
		<!-- Copy necessary resources -->
		<copy todir="${temp.folder}/webapp.jar.bin" failonerror="true">
			<fileset dir="src/" excludes="**/*.java, **/package.htm*"			/>
		</copy>
<!-- custom begin -->
		<copy file="${temp.folder}/webapp.jar.bin/org/eclipse/help/internal/webapp/WebappResources.properties" tofile="${temp.folder}/webapp.jar.bin/org/eclipse/help/internal/webapp/WebappResources_en.properties" />
<!-- custom end -->
		<mkdir dir="${build.result.folder}"/>
		<jar destfile="${build.result.folder}/webapp.jar" basedir="${temp.folder}/webapp.jar.bin"/>
		<delete dir="${temp.folder}/webapp.jar.bin"/>
	</target>

	<target name="webappsrc.zip" depends="init" unless="webappsrc.zip">
		<mkdir dir="${build.result.folder}"/>
		<zip destfile="${build.result.folder}/webappsrc.zip" filesonly="false" whenempty="skip" update="false">
			<fileset dir="src/" includes="**/*.java"			/>
		</zip>
	</target>

	<target name="WEB-INF/lib/servlets.jar" depends="init" unless="WEB-INF/lib/servlets.jar" description="Create jar: WEB-INF/lib/servlets.jar.">
		<delete dir="${temp.folder}/WEB-INF/lib/servlets.jar.bin"/>
		<mkdir dir="${temp.folder}/WEB-INF/lib/servlets.jar.bin"/>
		<!-- compile the source code -->
		<javac destdir="${temp.folder}/WEB-INF/lib/servlets.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" source="${javacSource}" target="${javacTarget}"		>
			<compilerarg line="${compilerArg}"/>
			<classpath>
				<pathelement path="../org.eclipse.help.base/bin"/>
				<pathelement path="../org.eclipse.help.base/@dot"/>
				<pathelement path="../org.apache.lucene/bin"/>
				<pathelement path="../org.apache.lucene/lucene-1.4.3.jar"/>
				<pathelement path="../org.apache.lucene/parser.jar"/>
				<pathelement path="../org.eclipse.help/bin"/>
				<pathelement path="../org.eclipse.help/@dot"/>
				<pathelement path="../org.eclipse.core.runtime"/>
				<pathelement path="../org.eclipse.core.runtime/@dot"/>
				<pathelement path="../org.eclipse.equinox.common"/>
				<pathelement path="../org.eclipse.equinox.common/@dot"/>
				<pathelement path="../org.eclipse.equinox.preferences"/>
				<pathelement path="../org.eclipse.equinox.preferences/@dot"/>	
				<pathelement path="../org.eclipse.osgi"/>
				<pathelement path="../org.eclipse.osgi/@dot"/>
				<pathelement path="../org.eclipse.help.appserver/bin"/>
				<pathelement path="../org.eclipse.help.appserver/@dot"/>
				<pathelement path="${build.result.folder}/bin"/>
				<pathelement path="${build.result.folder}/WEB-INF/classes"/>
				<pathelement path="${build.result.folder}/webapp.jar"/>
				<pathelement path="../org.eclipse.osgi/bin"/>
				<pathelement path="../org.eclipse.core.runtime/bin"/>
				<pathelement path="../org.eclipse.help"/>
				<pathelement path="../org.eclipse.help.base"/>
				<pathelement path="../org.eclipse.help.appserver"/>
				<pathelement path="../org.eclipse.tomcat/servlet.jar"/>
				<pathelement path="../org.eclipse.tomcat/jasper-runtime.jar"/>
			</classpath>
			<src path="src_servlets/"			/>
			<compilerarg line="-log ${temp.folder}/WEB-INF/lib/servlets.jar.bin${logExtension}" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/> 
			</javac>
		<!-- Copy necessary resources -->
		<copy todir="${temp.folder}/WEB-INF/lib/servlets.jar.bin" failonerror="true">
			<fileset dir="src_servlets/" excludes="**/*.java, **/package.htm*"			/>
		</copy>
		<mkdir dir="${build.result.folder}/WEB-INF/lib"/>
		<jar destfile="${build.result.folder}/WEB-INF/lib/servlets.jar" basedir="${temp.folder}/WEB-INF/lib/servlets.jar.bin"/>
		<delete dir="${temp.folder}/WEB-INF/lib/servlets.jar.bin"/>
	</target>

	<target name="WEB-INF/lib/servletssrc.zip" depends="init" unless="WEB-INF/lib/servletssrc.zip">
		<mkdir dir="${build.result.folder}/WEB-INF/lib"/>
		<zip destfile="${build.result.folder}/WEB-INF/lib/servletssrc.zip" filesonly="false" whenempty="skip" update="false">
			<fileset dir="src_servlets/" includes="**/*.java"			/>
		</zip>
	</target>

	<target name="WEB-INF/lib/jsp.jar" depends="init" unless="WEB-INF/lib/jsp.jar" description="Create jar: WEB-INF/lib/jsp.jar.">
		<delete dir="${temp.folder}/WEB-INF/lib/jsp.jar.bin"/>
		<mkdir dir="${temp.folder}/WEB-INF/lib/jsp.jar.bin"/>
<!-- custom begin -->
		<!-- generate java code from JSPs -->
		<path id="jasper.classpath" > 
			<pathelement location="../org.apache.ant/lib/ant.jar"/>
			<pathelement location="../org.apache.ant/lib/optional.jar"/>
			<pathelement location="../org.eclipse.tomcat/jasper-compiler.jar" />
			<pathelement location="../org.eclipse.tomcat/jasper-runtime.jar" />
			<pathelement location="../org.eclipse.tomcat/servlet.jar" />
			<pathelement location="../org.eclipse.tomcat/tomcat_util.jar" />  
		</path>
		<delete dir="${temp.folder}/jsp.jar.src"/>
  		<mkdir dir="${temp.folder}/jsp.jar.src"/>
		<java
			classname="org.apache.jasper.JspC"
			fork="true"
			failonerror="false"
			classpathref="jasper.classpath"
			output="${temp.folder}/WEB-INF/lib/jsp.jar.bin${logExtension}">
			<arg value="-v3" />
			<arg value="-d" /><arg value="${temp.folder}/jsp.jar.src" />
			<arg value="-die" />
			<arg value="-p" /><arg value="org.eclipse.help.internal.webapp.jsp"/>
			<arg value="-webinc" /><arg value="${temp.folder}/jsp.jar.src/web.xml.fragment" />
			<arg value="-webapp" /><arg value="${basedir}" />
		</java>
<!-- custom end -->	
		<!-- compile the source code -->
		<javac destdir="${temp.folder}/WEB-INF/lib/jsp.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" source="${javacSource}" target="${javacTarget}"		>
			<compilerarg line="${compilerArg}"/>
			<classpath>
				<pathelement path="../org.eclipse.help.base/bin"/>
				<pathelement path="../org.eclipse.help.base/@dot"/>
				<pathelement path="../org.apache.lucene/bin"/>
				<pathelement path="../org.apache.lucene/lucene-1.4.3.jar"/>
				<pathelement path="../org.apache.lucene/parser.jar"/>
				<pathelement path="../org.eclipse.help/bin"/>
				<pathelement path="../org.eclipse.help/@dot"/>
				<pathelement path="../org.eclipse.core.runtime"/>
				<pathelement path="../org.eclipse.core.runtime/@dot"/>
				<pathelement path="../org.eclipse.equinox.common"/>
				<pathelement path="../org.eclipse.equinox.common/@dot"/>
				<pathelement path="../org.eclipse.equinox.preferences"/>
				<pathelement path="../org.eclipse.equinox.preferences/@dot"/>	
				<pathelement path="../org.eclipse.osgi"/>
				<pathelement path="../org.eclipse.osgi/@dot"/>
				<pathelement path="../org.eclipse.help.appserver/bin"/>
				<pathelement path="../org.eclipse.help.appserver/@dot"/>
				<pathelement path="${build.result.folder}/bin"/>
				<pathelement path="${build.result.folder}/WEB-INF/classes"/>
				<pathelement path="${build.result.folder}/webapp.jar"/>
				<pathelement path="${build.result.folder}/WEB-INF/lib/servlets.jar"/>
				<pathelement path="../org.eclipse.osgi/bin"/>
				<pathelement path="../org.eclipse.core.runtime/bin"/>
				<pathelement path="../org.eclipse.help"/>
				<pathelement path="../org.eclipse.help.base"/>
				<pathelement path="../org.eclipse.help.appserver"/>
				<pathelement path="../org.eclipse.tomcat/servlet.jar"/>
				<pathelement path="../org.eclipse.tomcat/jasper-runtime.jar"/>
			</classpath>
			<src path="${temp.folder}/jsp.jar.src/"			/>
			<compilerarg line="-log ${temp.folder}/WEB-INF/lib/jsp.jar.bin${logExtension}" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/> 
<!-- custom begin -->
			<compilerarg value="-warn:-serial" />
<!-- custom end -->	
			</javac>
		<!-- Copy necessary resources -->
		<copy todir="${temp.folder}/WEB-INF/lib/jsp.jar.bin" failonerror="true">
			<fileset dir="${temp.folder}/jsp.jar.src/" excludes="**/*.java, **/package.htm*"			/>
		</copy>
		<mkdir dir="${build.result.folder}/WEB-INF/lib"/>
		<jar destfile="${build.result.folder}/WEB-INF/lib/jsp.jar" basedir="${temp.folder}/WEB-INF/lib/jsp.jar.bin"/>
		<delete dir="${temp.folder}/WEB-INF/lib/jsp.jar.bin"/>
	</target>

	<target name="WEB-INF/lib/jspsrc.zip" depends="init" unless="WEB-INF/lib/jspsrc.zip">
		<mkdir dir="${build.result.folder}/WEB-INF/lib"/>
	</target>

	<target name="build.jars" depends="init" description="Build all the jars for the plug-in: org.eclipse.help.webapp.">
		<available property="webapp.jar" file="${build.result.folder}/webapp.jar"/>
		<antcall target="webapp.jar"/>
		<available property="WEB-INF/lib/servlets.jar" file="${build.result.folder}/WEB-INF/lib/servlets.jar"/>
		<antcall target="WEB-INF/lib/servlets.jar"/>
		<available property="WEB-INF/lib/jsp.jar" file="${build.result.folder}/WEB-INF/lib/jsp.jar"/>
		<antcall target="WEB-INF/lib/jsp.jar"/>
	</target>

	<target name="build.sources" depends="init">
		<available property="webappsrc.zip" file="${build.result.folder}/webappsrc.zip"/>
		<antcall target="webappsrc.zip"/>
		<available property="WEB-INF/lib/servletssrc.zip" file="${build.result.folder}/WEB-INF/lib/servletssrc.zip"/>
		<antcall target="WEB-INF/lib/servletssrc.zip"/>
<!-- custom begin -->
<!--
		<available property="WEB-INF/lib/jspsrc.zip" file="${build.result.folder}/WEB-INF/lib/jspsrc.zip"/>
		<antcall target="WEB-INF/lib/jspsrc.zip"/>
-->
<!-- custom end -->
	</target>

	<target name="gather.bin.parts" depends="init" if="destination.temp.folder">
		<mkdir dir="${destination.temp.folder}/${full.name}"/>
		<copy todir="${destination.temp.folder}/${full.name}" failonerror="true">
			<fileset dir="${build.result.folder}" includes="webapp.jar,WEB-INF/lib/servlets.jar,WEB-INF/lib/jsp.jar" excludes="WEB-INF/classes/"			/>
		</copy>
		<copy todir="${destination.temp.folder}/${full.name}" failonerror="true">
			<fileset dir="${basedir}" includes="META-INF/,advanced/,basic/,WEB-INF/,*.html,*.jar,*.jsp,plugin.properties,plugin.xml,.options" excludes="WEB-INF/classes/"			/>
		</copy>
<!-- custom begin -->
		<loadfile
			property="web.xml.fragment"
			srcFile="${temp.folder}/jsp.jar.src/web.xml.fragment"/>
		<replace
			file="${destination.temp.folder}/${full.name}/WEB-INF/web.xml"
			token="&lt;!-- placeholder for JSPs web.xml --&gt;"
			value="${web.xml.fragment}"
			encoding="ISO-8859-1" />
		<eclipse.versionReplacer path="${destination.temp.folder}/${full.name}" version="${version.suffix}"/>
<!-- custom end -->
	</target>

	<target name="build.zips" depends="init">
	</target>

	<target name="gather.sources" depends="init" if="destination.temp.folder">
		<mkdir dir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
		<copy file="${build.result.folder}/WEB-INF/lib/servletssrc.zip" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib" failonerror="false"/>
<!-- custom begin -->
<!--
		<copy file="${build.result.folder}/WEB-INF/lib/jspsrc.zip" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib" failonerror="false"/>
-->
<!-- custom end -->
		<mkdir dir="${destination.temp.folder}/${full.name}"/>
		<copy file="${build.result.folder}/webappsrc.zip" todir="${destination.temp.folder}/${full.name}" failonerror="false"/>
		<copy todir="${destination.temp.folder}/${full.name}" failonerror="false">
			<fileset dir="${basedir}" includes="about.html"			/>
		</copy>
	</target>

	<target name="gather.logs" depends="init" if="destination.temp.folder">
		<mkdir dir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
		<copy file="${temp.folder}/WEB-INF/lib/servlets.jar.bin${logExtension}" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib" failonerror="false"/>
		<copy file="${temp.folder}/WEB-INF/lib/jsp.jar.bin${logExtension}" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib" failonerror="false"/>
		<mkdir dir="${destination.temp.folder}/${full.name}"/>
		<copy file="${temp.folder}/webapp.jar.bin${logExtension}" todir="${destination.temp.folder}/${full.name}" failonerror="false"/>
	</target>

	<target name="clean" depends="init" description="Clean the plug-in: org.eclipse.help.webapp of all the zips, jars and logs created.">
		<delete file="${build.result.folder}/WEB-INF/lib/servlets.jar"/>
		<delete file="${build.result.folder}/WEB-INF/lib/servletssrc.zip"/>
		<delete file="${build.result.folder}/WEB-INF/lib/jsp.jar"/>
		<delete file="${build.result.folder}/WEB-INF/lib/jspsrc.zip"/>
		<delete file="${build.result.folder}/webapp.jar"/>
		<delete file="${build.result.folder}/webappsrc.zip"/>
		<delete file="${plugin.destination}/${full.name}.jar"/>
		<delete file="${plugin.destination}/${full.name}.zip"/>
		<delete dir="${temp.folder}"/>
	</target>

	<target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
		<eclipse.convertPath fileSystemPath="d:/runtime-workspacePDE/org.eclipse.help.webapp" property="resourcePath"/>
		<eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
	</target>

	<target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: org.eclipse.help.webapp.">
		<delete dir="${temp.folder}"/>
		<mkdir dir="${temp.folder}"/>
		<antcall target="build.jars"/>
		<antcall target="build.sources"/>
		<antcall target="gather.bin.parts">
			<param name="destination.temp.folder" value="${temp.folder}/"/>
		</antcall>
		<antcall target="gather.sources">
			<param name="destination.temp.folder" value="${temp.folder}/"/>
		</antcall>
		<delete>
			<fileset dir="${temp.folder}" includes="**/*.bin${logExtension}"			/>
		</delete>
		<zip destfile="${plugin.destination}/${full.name}.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
		<delete dir="${temp.folder}"/>
	</target>

</project>

Back to the top