Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: efc46cc992423f6b8c43fd307c87a76aae399851 (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
<?xml version="1.0"?>
<project name="Papyrus">
	
	<property name="build.config.root.dir" location=".." />
	<echo message="build.config.root.dir=${build.config.root.dir}" />

	<condition property="properties.file" value="build.properties" else="local.properties">
		<isset property="server.build" />
	</condition>

	<condition property="mspec.file" value="build.mspec" else="local.mspec">
		<isset property="server.build" />
	</condition>
	<echo message="mspec.file=${mspec.file}"/>

	<echo message="Sourcing ${properties.file}" />
	<property file="${properties.file}" />
	<property environment="env" />

	<condition property="build.root" value="${env.WORKSPACE}/buildroot" else="${basedir}/../build">
		<isset property="env.WORKSPACE" />
	</condition>
	<echo message="build.root=${build.root}"/>

	<condition property="buckminster.loglevel" value="${env.BUCKMINSTER_LOGLEVEL}" else="INFO">
		<isset property="env.BUCKMINSTER_LOGLEVEL" />
	</condition>
	<echo message="buckminster.loglevel=${buckminster.loglevel}"/>

	<condition property="clean.tools" value="true">
		<equals arg1="${env.CLEAN_TOOLS}" arg2="true" />
	</condition>

	<condition property="clean.tp" value="true">
		<equals arg1="${env.CLEAN_TP}" arg2="true" />
	</condition>

	<condition property="clean.workspace" value="true">
		<equals arg1="${env.CLEAN_WORKSPACE}" arg2="true" />
	</condition>

	<condition property="clean.output" value="true">
		<equals arg1="${env.CLEAN_OUTPUT}" arg2="true" />
	</condition>

	<condition property="build.type" value="${env.BUILD_TYPE}" else="N">
		<isset property="env.BUILD_TYPE" />
	</condition>
	<echo message="build.type=${build.type}"/>

	<condition property="build.nightly" value="true">
		<equals arg1="${build.type}" arg2="N" />
	</condition>

	<condition property="no.proxy" value="${env.no_proxy}, dev.eclipse.org" else="dev.eclipse.org">
		<isset property="env.no_proxy" />
	</condition>

	<!-- Default properties intended to be overridden by entries in the above property file -->
	<property name="tools" location="${build.root}/tools" />
	<property name="result" location="${build.root}/result" />
	<property name="workspace" location="${result}/workspace" />
	<property name="targetPlatformPath" location="${result}/targetPlatform" />
	<property name="buckminster.output.root" location="${result}/output" />
	<property name="buckminster.temp.root" location="${result}/temp" />
	
	<echo message="tools=${tools}"/>
	<echo message="result=${result}"/>
	<echo message="workspace=${workspace}"/>
	<echo message="targetPlatformPath=${targetPlatformPath}"/>

	<!-- This macro executes the default application of an eclipse installation
			 that resides in the folder ${buildtools}/@app -->
	<macrodef name="eclipse.launch">
		<attribute name="app" />
		<element name="properties" optional="true" />
		<element name="args" optional="true" />
		<sequential>
			<!-- We assume that the eclipse installation is beneath ${buildtools} -->
			<property name="@{app}.deploy.dir" value="${tools}/@{app}" />

			<!-- Find the Eclipse launcher and assing its location to the @{app}.launcher property -->
			<pathconvert property="@{app}.launcher">
				<first count="1">
					<sort>
						<fileset dir="${@{app}.deploy.dir}/plugins" includes="**/org.eclipse.equinox.launcher_*.jar" />
						<reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators">
							<date />
						</reverse>
					</sort>
				</first>
			</pathconvert>

			<!-- Launch the eclipse application -->
			<java fork="true" jar="${@{app}.launcher}" dir="${@{app}.deploy.dir}" failonerror="true">
				<env key="no_proxy" value="${no.proxy}" />
				<properties />
				<!-- Uncomment to debug <jvmarg value="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y"/> -->
				<args />
			</java>
		</sequential>
	</macrodef>

	<macrodef name="buckminster">
		<attribute name="command" />
		<attribute name="workspace" default="${workspace}" />
		<element name="sysproperties" optional="true" />
		<element name="globargs" optional="true" />
		<element name="cmdargs" optional="true" />
		<sequential>
			<eclipse.launch app="buckminster">
				<args>
					<jvmarg value="-Xmx1024m" />
					<arg value="-data" />
					<arg value="@{workspace}" />
					<arg value="--loglevel" />
					<arg value="${buckminster.loglevel}" />
					<arg value="--displaystacktrace" />
					<globargs />
					<arg value="@{command}" />
					<arg value="-P" />
					<arg value="${properties.tmp}" />
					<cmdargs />
				</args>
			</eclipse.launch>
		</sequential>
	</macrodef>

	<target name="init.clean.tools" if="clean.tools">
		<antcall target="clean.tools" />
	</target>

	<target name="init.clean.tp" if="clean.tp">
		<antcall target="clean.tp" />
	</target>

	<target name="init.clean.workspace" if="clean.workspace">
		<antcall target="clean.workspace" />
	</target>

	<target name="init.clean.output" if="clean.output">
		<antcall target="clean.output" />
	</target>

	<target name="init.checks" depends="init.clean.tools,init.clean.tp,init.clean.workspace,init.clean.output">
		<available file="${tools}/director/director" property="director.exists" />
		<available file="${tools}/buckminster/buckminster" property="buckminster.exists" />
	</target>

	<target name="get.director" unless="director.exists">
		<echo message="Fetching headless director application" />
		<tempfile destdir="${java.io.tmpdir}" prefix="director-" suffix=".zip" property="director.zip" deleteonexit="true" />
		<get src="${eclipse.downloads}/${director.path}" dest="${director.zip}" />
		<mkdir dir="${tools}" />
		<unzip src="${director.zip}" dest="${tools}" />
		<delete file="${director.zip}" />
	</target>

	<target name="install.buckminster" unless="buckminster.exists" depends="get.director">
		<echo message="Configuring headless buckminster with needed features" />
		<echo message="pack200 location configured as: ${org.eclipse.update.jarprocessor.pack200.buckminster}" />
		<eclipse.launch app="director">
			<args>
				<jvmarg value="-Declipse.p2.mirrors=false" />
				<!--
				Hudson Ant property: org.eclipse.update.jarprocessor.pack200=${jdk1.5.dir}/jre/bin
				<jvmarg value="-Dorg.eclipse.update.jarprocessor.pack200=${org.eclipse.update.jarprocessor.pack200}" />
				-->
				<jvmarg value="-Dorg.eclipse.update.jarprocessor.pack200=${org.eclipse.update.jarprocessor.pack200.buckminster}" />
				<arg value="-r" />
				<arg value="${eclipse.downloads}/${bm.headless.path}" />
				<arg value="-d" />
				<arg value="${tools}/buckminster" />
				<arg value="-p" />
				<arg value="Buckminster" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.cmdline.product" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.core.headless.feature.feature.group" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.pde.headless.feature.feature.group" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.cvs.headless.feature.feature.group" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.emma.headless.feature.feature.group" />
			</args>
		</eclipse.launch>
		
		<!-- install svn headless connector -->
		<eclipse.launch app="director">
			<args>
				<jvmarg value="-Declipse.p2.mirrors=false" />
				<!--<jvmarg value="-Dorg.eclipse.update.jarprocessor.pack200=/shared/common/jdk-1.5.0-22.x86_64/jre/bin" />-->
				<jvmarg value="-Dorg.eclipse.update.jarprocessor.pack200=${org.eclipse.update.jarprocessor.pack200.buckminster}" />
				<arg value="-r" />
				<arg value="http://download.cloudsmith.com/buckminster/external-3.6" />
				<arg value="-d" />
				<arg value="${tools}/buckminster" />
				<arg value="-p" />
				<arg value="Buckminster" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.subclipse.headless.feature.feature.group" />
			</args>
		</eclipse.launch>
	</target>

	<target name="init.workspace" unless="workspace.exists">
		<echo>creating new workspace from template</echo>
		<unzip dest="${workspace}" src="${build.config.root.dir}/resources/workspace.template.zip"/>
	</target>

	<target name="init.build.properties">
		<!-- Echo relevant properties to a temporary file so that Buckminster can read them -->
		<tempfile destdir="${java.io.tmpdir}" prefix="build-" suffix=".properties" deleteonexit="true" property="properties.tmp" />
		<echo message="Properties file is: ${properties.tmp}" />
		<echoproperties destfile="${properties.tmp}">
			<!-- We don't want these. basedir in particular will cause problems if passed explicitly -->
			<propertyset negate="true">
				<propertyref name="basedir" />
				<propertyref name="eclipse.home" />
				<propertyref name="properties.tmp" />
				<propertyref name="line.separator" />
				<propertyref name="path.separator" />
				<propertyref prefix="ant." />
				<propertyref prefix="file." />
				<propertyref prefix="java." />
				<propertyref prefix="sun." />
				<propertyref prefix="user." />
			</propertyset>
		</echoproperties>
	</target>

	<target name="provision" depends="init.checks,init.workspace,install.buckminster,init.build.properties" unless="skip.provision">
		<echo message="Importing projects into workspace ${workspace} and binaries into target platform ${targetPlatformPath}" />
		<!--
		<buckminster command="installJRE">
			<cmdargs>
				<arg value="- -location" />
				<arg value="${env.JAVA_HOME}" />
			</cmdargs>
		</buckminster>
		-->
		<buckminster command="setpref">
			<cmdargs>
				<arg value="targetPlatformPath=${targetPlatformPath}" />
			</cmdargs>
		</buckminster>

		<buckminster command="import">
			<cmdargs>
				<arg value="-P" />
				<arg value="${basedir}/${properties.file}" />
				<arg value="--bomfile"/>
				<arg value="${build.root}/papyrus_bom.xml"/>
				<arg value="${basedir}/${mspec.file}" />
			</cmdargs>
		</buckminster>
	</target>

	<target name="build" depends="provision" unless="skip.build">
		<echo message="Building all projects in workspace ${workspace}" />
		<buckminster command="build">
			<cmdargs>
				<arg value="--thorough" />
			</cmdargs>
		</buckminster>
	</target>
	
	<target name="test" depends="build" unless="skip.tests">
		<echo message="Running JUnit tests" />
		<mkdir dir="${result}/testresults/" />
		<mkdir dir="${result}/testresults/xml" />
		<mkdir dir="${result}/testresults/consolelogs" />
		<buckminster command="junit">
			<cmdargs>
				<arg value="-l" />
				<arg value="org.eclipse.papyrus.tests/Papyrus ALL tests.launch" />
				<arg value="-o" />
				<arg value="${result}/testresults/xml/testReport.xml" />
				<arg value="--terseXML" />
				<arg value="--flatXML" />
				<arg value="--stderr" />
				<arg value="${result}/testresults/consolelogs/ErrorLogJunitPapyrus.txt" />
				<arg value="--stdout" />
				<arg value="${result}/testresults/consolelogs/OutputLogJunitPapyrus.txt" />
			</cmdargs>
		</buckminster>
		<echo message="End of tests (1/2)" />
		
		<buckminster command="junit">
			<cmdargs>
				<arg value="-l" />
				<arg value="org.eclipse.papyrus.tests/Papyrus SysML tests.launch" />
				<arg value="-o" />
				<arg value="${result}/testresults/xml/SysMLTestReport.xml" />
				<arg value="--terseXML" />
				<arg value="--flatXML" />
				<arg value="--stderr" />
				<arg value="${result}/testresults/consolelogs/ErrorLogJunitPapyrus.txt" />
				<arg value="--stdout" />
				<arg value="${result}/testresults/consolelogs/OutputLogJunitPapyrus.txt" />
			</cmdargs>
		</buckminster>
		<echo message="End of tests (2/2)" />
		
		<echo>Generating HTML report for Junit tests</echo>
		<junitreport todir="${result}/testresults">
			<fileset dir="${result}/testresults/xml">
				<include name="*.xml" />
			</fileset>
			<report format="frames" todir="${result}/testresults/html" />
		</junitreport>
		
	</target>

	<target name="clean.tools">
		<delete dir="${tools}/director" failonerror="true" quiet="true" />
		<delete dir="${tools}/buckminster" failonerror="true" quiet="true" />
	</target>

	<target name="clean.tp">
		<delete dir="${targetPlatformPath}" failonerror="true" quiet="true" />
	</target>

	<target name="clean.workspace">
		<delete dir="${workspace}" failonerror="true" quiet="true" />
	</target>

	<target name="clean.output">
		<delete dir="${buckminster.output.root}" failonerror="true" quiet="true" />
		<delete dir="${buckminster.temp.root}" failonerror="true" quiet="true" />
		<delete dir="${result}/testresults" failonerror="true" quiet="true" />
	</target>

	<target name="clean.all" depends="clean.tools,clean.workspace,clean.tp,clean.output" />
	
	<target name="do.nothing" />

</project>

Back to the top