Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9d81b52b866a84bb89f49702ee02712a8eddbf7d (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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (c) 2009, 2016 IBM Corporation and others.
    All rights reserved. This program and the accompanying materials
    are made available under the terms of the Eclipse Public License v1.0
    which accompanies this distribution, and is available at
    http://www.eclipse.org/legal/epl-v10.html
   
    Contributors:
        IBM Corporation - initial API and implementation
 -->

<project name="org.eclipse.swt.fragment" default="" basedir=".">

	<target name="init" depends="properties">
		<property name="compilerArg" value="" />
		<condition property="fragment" value="org.eclipse.swt.${swt.ws}.${swt.os}.${swt.arch}" else="org.eclipse.swt.${swt.ws}.${swt.os}">
			<isset property="swt.arch"/>
		</condition>
		<property name="full.name" value="${fragment}_${version.suffix}" />
		<property name="fragmentdir" value="${basedir}" />
		<property name="temp.folder" value="${fragmentdir}/temp.folder" />
		<property name="plugin.destination" value="${fragmentdir}" />
		<property name="build.result.folder" value="${fragmentdir}" />
		<property name="destination" value="${fragmentdir}/target" />
		<property name="javacVerbose" value="false" />
		<property name="logExtension" value=".xml" />
		<property name="javacSource" value="1.8" />
		<property name="javacTarget" value="1.8" />
		<condition property="bootclasspath" value="">
			<equals arg1="${swt.os}" arg2="macosx"/>
		</condition>
		<path id="path_bootclasspath">
			<fileset dir="${java.home}/lib">
				<include name="*.jar" />
			</fileset>
		</path>
		<property name="bootclasspath" refid="path_bootclasspath" />
		<property name="bundleJavacSource" value="${javacSource}" />
		<property name="bundleJavacTarget" value="${javacTarget}" />
		<property name="bundleBootClasspath" value="${bootclasspath}" />
		<condition property="p2.publish.parts" value="true">
			<istrue value="${p2.gathering}" />
		</condition>
		<mkdir dir="target"/>
	</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">
		<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 zipfile="${plugin.destination}/${full.name}.jar" basedir="${temp.folder}/${full.name}" filesonly="false" />
		<delete dir="${temp.folder}" />
	</target>

	<target name="@dot" depends="init" unless="@dot" description="Create jar: @dot.">
		<property name="destdir" value="${temp.folder}/@dot.bin" />
		<property name="debug" value="true" />
		<property name="jar.filename" value="swt.jar" />
		<delete dir="${temp.folder}/@dot.bin" />
		<mkdir dir="${temp.folder}/@dot.bin" />
		<antcall target="copy.${swt.ws}.src"/>
		<javac destdir="${temp.folder}/@dot.bin" verbose="${javacVerbose}" debug="${debug}" failonerror="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}">
			<src path="${temp.folder}/@dot.src/"/>
			<compilerarg line="-log '${temp.folder}'/@dot.bin${logExtension}" compiler="org.eclipse.jdt.core.JDTCompilerAdapter" />
			<compilerarg line="${compilerArg}" compiler="org.eclipse.jdt.core.JDTCompilerAdapter" />
		</javac>
		<copy todir="${temp.folder}/@dot.bin">
			<fileset dir="${temp.folder}/@dot.src/" excludes="**/*.java,**/package.htm*,**/library/" />
		</copy>
		<mkdir dir="${build.result.folder}/@dot" />
		<copy todir="${build.result.folder}/@dot" failonerror="true">
			<fileset dir="${temp.folder}/@dot.bin" />
		</copy>
		<condition property="arch" value="${swt.arch}" else="">
			<isset property="swt.arch"/>
		</condition>
		<jar jarfile="${build.result.folder}/${jar.filename}" basedir="${temp.folder}/@dot.bin">
			<manifest>
				<attribute name="SWT-OS" value="${swt.os}"/>
				<attribute name="SWT-WS" value="${swt.ws}"/>
				<attribute name="SWT-Arch" value="${arch}"/>
			</manifest>
		</jar>
	</target>

	<target name="build.jars" depends="init">
		<available property="@dot" file="${build.result.folder}/@dot" />
		<antcall target="@dot" />
	</target>

	<target name="src.zip" depends="init" unless="src.zip">
		<mkdir dir="${build.result.folder}/" />
		<antcall target="copy.${swt.ws}.src"/>
		<zip zipfile="${build.result.folder}/src.zip">
			<fileset dir="${temp.folder}/@dot.src" includes="**/*.java"/>
			<fileset dir="${temp.folder}/@dot.src" includes="**/*.properties"/>
			<fileset    dir="${temp.folder}/@dot.src/library/" excludes="**/*.sh"/>
			<zipfileset dir="${temp.folder}/@dot.src/library/" includes="**/*.sh" filemode="755"/>
			<fileset dir="${temp.folder}/@dot.src" includes="**/version.txt"/>
			<fileset dir="${fragmentdir}" includes="about.html,about_files/"/>
		</zip>
		<delete dir="${temp.folder}/@dot.src"/>
	</target>

	<target name="copy.src" depends="init">
		<antcall target="copy.${swt.ws}.src"/>
		<copy todir="${destination.temp.folder}/" failonerror="true" overwrite="true">
			<fileset dir="${temp.folder}/@dot.src" includes="**/*.java"/>
			<fileset dir="${temp.folder}/@dot.src" includes="**/*.properties"/>
			<fileset dir="${temp.folder}/@dot.src/library/"/>
			<fileset dir="${temp.folder}/@dot.src" includes="**/version.txt"/>
			<fileset dir="${fragmentdir}" includes="about.html,about_files/"/>
		</copy>
		<delete dir="${temp.folder}/@dot.src"/>
	</target>

	<target name="copy.cocoa.src">
		<property name="copy.src.dir" value="${temp.folder}/@dot.src"/>
		<delete dir="${copy.src.dir}" quiet="true"/>
		<copy todir="${copy.src.dir}" failonerror="true" overwrite="true">
			<fileset dir="${plugindir}/Eclipse SWT/cocoa/"/>
			<fileset dir="${plugindir}/Eclipse SWT/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT/common_j2se/" excludes="**/*._properties"/>
			<fileset dir="${plugindir}/Eclipse SWT/emulated/bidi/"/>
			<fileset dir="${plugindir}/Eclipse SWT/emulated/coolbar/"/>
			<fileset dir="${plugindir}/Eclipse SWT/emulated/expand/"/>
			<fileset dir="${plugindir}/Eclipse SWT/emulated/tooltip/"/>
			<fileset dir="${plugindir}/Eclipse SWT Accessibility/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Accessibility/cocoa/"/>
			<fileset dir="${plugindir}/Eclipse SWT AWT/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT AWT/cocoa/"/>
			<fileset dir="${plugindir}/Eclipse SWT WebKit/cocoa/"/>
			<fileset dir="${plugindir}/Eclipse SWT Browser/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Browser/cocoa/"/>
			<fileset dir="${plugindir}/Eclipse SWT Custom Widgets/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Drag and Drop/cocoa/"/>
			<fileset dir="${plugindir}/Eclipse SWT Drag and Drop/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT OpenGL/cocoa/"/>
			<fileset dir="${plugindir}/Eclipse SWT OpenGL/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT PI/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT PI/cocoa/" excludes="**/*.extras,**/*.bridgesupport"/>
			<fileset dir="${plugindir}/Eclipse SWT Printing/cocoa/"/>
			<fileset dir="${plugindir}/Eclipse SWT Printing/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Program/cocoa/"/>
			<fileset dir="${plugindir}/Eclipse SWT Program/common/"/>
		</copy>
		<antcall target="copy.translationfiles"/>
		<antcall target="replace64"/>
	</target>

	<target name="copy.gtk.src">
		<property name="copy.src.dir" value="${temp.folder}/@dot.src"/>
		<delete dir="${copy.src.dir}" quiet="true"/>
		<copy todir="${copy.src.dir}" failonerror="true" overwrite="true">
			<fileset dir="${plugindir}/Eclipse SWT/cairo/"/>
			<fileset dir="${plugindir}/Eclipse SWT/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT/common_j2se/" excludes="**/*._properties"/>
			<fileset dir="${plugindir}/Eclipse SWT/emulated/bidi/"/>
			<fileset dir="${plugindir}/Eclipse SWT/emulated/coolbar/"/>
			<fileset dir="${plugindir}/Eclipse SWT/emulated/taskbar/"/>
			<fileset dir="${plugindir}/Eclipse SWT/gtk/"/>
			<fileset dir="${plugindir}/Eclipse SWT Accessibility/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Accessibility/gtk/"/>
			<fileset dir="${plugindir}/Eclipse SWT AWT/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT AWT/gtk/"/>
			<fileset dir="${plugindir}/Eclipse SWT Browser/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Browser/gtk/"/>
			<fileset dir="${plugindir}/Eclipse SWT Custom Widgets/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Drag and Drop/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Drag and Drop/gtk/"/>
			<fileset dir="${plugindir}/Eclipse SWT OpenGL/gtk/"/>
			<fileset dir="${plugindir}/Eclipse SWT OpenGL/glx/"/>
			<fileset dir="${plugindir}/Eclipse SWT OpenGL/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT PI/cairo/"/>
			<fileset dir="${plugindir}/Eclipse SWT PI/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT PI/gtk/"/>
			<fileset dir="${plugindir}/Eclipse SWT Printing/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Printing/gtk/"/>
			<fileset dir="${plugindir}/Eclipse SWT Program/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Program/gtk/"/>
			<fileset dir="${plugindir}/Eclipse SWT WebKit/gtk/"/>
		</copy>
		<antcall target="copy.translationfiles"/>
		<antcall target="replace64"/>
	</target>
		
	<target name="copy.win32.src">
		<property name="copy.src.dir" value="${temp.folder}/@dot.src"/>
		<delete dir="${copy.src.dir}" quiet="true"/>
		<copy todir="${copy.src.dir}" failonerror="true" overwrite="true">
			<fileset dir="${plugindir}/Eclipse SWT/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT/common_j2se/" excludes="**/*._properties"/>
			<fileset dir="${plugindir}/Eclipse SWT/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT Accessibility/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Accessibility/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT AWT/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT AWT/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT Browser/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Browser/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT WebKit/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT Custom Widgets/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Drag and Drop/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Drag and Drop/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT OLE Win32/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT OpenGL/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT OpenGL/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT PI/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT PI/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT Printing/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Printing/win32/"/>
			<fileset dir="${plugindir}/Eclipse SWT Program/common/"/>
			<fileset dir="${plugindir}/Eclipse SWT Program/win32/"/>
		</copy>
		<antcall target="copy.translationfiles"/>
		<antcall target="replace64"/>
	</target>

	<target name="copy.translationfiles" if="includetranslationfiles">
		<copy todir="${copy.src.dir}" failonerror="true" overwrite="true">
			<fileset dir="${plugindir}/Eclipse SWT/common_j2se/" includes="**/*._properties"/>
			<mapper type="glob" from="*._properties" to="*.properties" />
		</copy>
	</target>

	<target name="is64">
		<condition property="is64" value="true">
			<or>
				<equals arg1="${swt.arch}" arg2="x86_64"/>
				<equals arg1="${swt.arch}" arg2="ia64"/>
				<equals arg1="${swt.arch}" arg2="ppc64"/>
				<equals arg1="${swt.arch}" arg2="ppc64le"/>
				<equals arg1="${swt.arch}" arg2="s390x"/>
				<equals arg1="${swt.arch}" arg2="sparcv9"/>
				<equals arg1="${swt.arch}" arg2="aarch64"/>
			</or>
		</condition>
		<echo>Is64=${is64}</echo>
	</target>
		
    <target name="replace64" depends="is64" unless="is64">
    	<echo>Converting java files to 32 bit</echo>
    	<replace dir="${copy.src.dir}" includes="**/*.java" value="int /*long*/" token="long /*int*/"/>
    	<replace dir="${copy.src.dir}" includes="**/*.java" value="int[] /*long[]*/" token="long[] /*int[]*/"/>
    	<replace dir="${copy.src.dir}" includes="**/*.java" value="float /*double*/" token="double /*float*/"/>
    	<replace dir="${copy.src.dir}" includes="**/*.java" value="float[] /*double[]*/" token="double[] /*float[]*/"/>
    </target>

	<target name="build.sources" depends="init">
		<available property="src.zip" file="${build.result.folder}/src.zip" />
		<antcall target="src.zip" />
	</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}" />
		<copy file="${build.result.folder}/src.zip" todir="${destination.temp.folder}/${full.name}/" />
		<copy todir="${destination.temp.folder}/${full.name}">
			<fileset dir="${fragmentdir}" includes="about.html,about_files/" />
		</copy>
	</target>

	<target name="gather.individual.sources" depends="init">
		<antcall target="copy.src" />
		<copy todir="${destination.temp.folder}">
			<fileset dir="${fragmentdir}" includes="about.html,about_files/" />
		</copy>
	</target>

	<target name="gather.logs" depends="init" if="destination.temp.folder">
		<mkdir dir="${destination.temp.folder}/${full.name}" />
		<copy file="${temp.folder}/@dot.bin${logExtension}" todir="${destination.temp.folder}/${full.name}/" />
	</target>

	<target name="publish.bin.parts" depends="init" if="p2.publish.parts">
		<antcall target="gather.bin.parts">
			<param name="destination.temp.folder" value="${build.result.folder}" />
		</antcall>
		<eclipse.gatherBundle metadataRepository="${p2.build.repo}" artifactRepository="${p2.build.repo}" buildResultFolder="${build.result.folder}" targetFolder="${build.result.folder}/${full.name}" />
	</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}/@dot" includes="**" />
		</copy>
		<copy todir="${destination.temp.folder}/${full.name}">
			<fileset dir="${fragmentdir}" includes="fragment.properties,about.html,about_files/,swt*.dll,libswt*.so,libswt*.sl,libswt*.a,libswt*.jnilib,libXm.so.2,META-INF/" />
		</copy>
		<chmod perm="755" dir="${destination.temp.folder}/${full.name}" includes="swt*.dll,libswt*.so,libswt*.sl,libswt*.a,libswt*.jnilib,libXm.so.2" />
		<eclipse.versionReplacer path="${destination.temp.folder}/${full.name}" version="${version.suffix}" />
	</target>

	<target name="swtdownload" depends="init">
		<delete dir="${temp.folder}" />
		<delete dir="${build.result.folder}/@dot" />
		<mkdir dir="${temp.folder}/swtdownload/" />
		<property name="includetranslationfiles" value="true" />
		<antcall target="build.jars" />
		<jar jarfile="${build.result.folder}/swt.jar" basedir="${fragmentdir}" update="true" includes="swt*.dll,libswt*.so,libswt*.sl,libswt*.a,libswt*.jnilib,libXm.so.2" />
		<move file="${build.result.folder}/swt.jar" todir="${temp.folder}/swtdownload" />
		<delete dir="${build.result.folder}/@dot" />
		<antcall target="build.sources" />
		<move file="${build.result.folder}/src.zip" todir="${temp.folder}/swtdownload" />
		<copy file="${plugindir}/build/.project" todir="${temp.folder}/swtdownload" />
		<copy file="${plugindir}/build/.classpath" todir="${temp.folder}/swtdownload" />
		<copy todir="${temp.folder}/swtdownload">
			<fileset dir="${fragmentdir}" includes="about.html,about_files/" />
		</copy>
		<condition property="zipfilename" value="swt-${buildid}-${swt.ws}-${swt.os}-${swt.arch}.zip" else="swt-${buildid}-${swt.ws}-${swt.os}.zip">
			<isset property="swt.arch"/>
		</condition>
		<zip zipfile="${destination}/${zipfilename}">
			<zipfileset dir="${temp.folder}/swtdownload/" />
		</zip>
		<delete dir="${temp.folder}" />
	</target>

	<target name="clean" depends="init">
		<delete dir="${build.result.folder}/@dot" />
		<delete file="${build.result.folder}/src.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">
		<eclipse.refreshLocal resource="${fragment}" depth="infinite" />
	</target>

	<target name="zip.plugin" depends="init">
		<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.xml" />
		</delete>
		<zip zipfile="${plugin.destination}/${full.name}.zip" basedir="${temp.folder}" filesonly="true" />
		<delete dir="${temp.folder}" />
	</target>

	<target name="jar.plugin" depends="init">
		<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>
		<condition property="arch" value="${swt.arch}" else="">
			<isset property="swt.arch"/>
		</condition>
		<jar jarfile="${plugin.destination}/${full.name}.jar" basedir="${temp.folder}/${full.name}" filesonly="true" manifest="${fragmentdir}/META-INF/MANIFEST.MF">
			<manifest>
				<attribute name="SWT-OS" value="${swt.os}"/>
				<attribute name="SWT-WS" value="${swt.ws}"/>
				<attribute name="SWT-Arch" value="${arch}"/>
			</manifest>
		</jar>
		<delete dir="${temp.folder}" />
	</target>
</project>

Back to the top