Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: cb0344af04f77a2ca7eab637590addaf5cfa1b3e (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
<?xml version="1.0" encoding="UTF-8"?>
<!--
	Buckminster Headless - build

	buckminster.home defaults to ${user.home}/buckminster
	    but it can be specified on the command line, e.g.,
	 	ant -Dbuckminster.home=/home/bettini/buckminster -f build.ant

	Properties:
		WORKSPACE  			Eclipse workspace location, or hudson job workspace
		build.root 			Where to build? WARNING: This folder will be cleaned up, so do not point to user.home or something important
							Default: ${WORKSPACE}/buildroot
		buckminster.home	Buckminster headless to use. See http://www.eclipse.org/buckminster/downloads.html
		projects.location	Where to find projects to build?
							Default: ${WORKSPACE}
		eclipse.download	The base URL for all the repositories in the RMAP
							Default: http://download.eclipse.org
-->
<project name="common" >
	<property name="WORKSPACE" location="${ant.file}/../../../" />
	<property name="build.root" location="${WORKSPACE}/buildroot" />
	<property name="projects.location" location="${WORKSPACE}" />
	<property name="target.platform" value="target.platform" />
	<property name="eclipse.download" value="http://download.eclipse.org" />

	<property name="buckminster.home" location="${user.home}/buckminster" />
	<property name="b3.home" location="${user.home}/b3" />

	<property name="buckminster.output.root" value="${build.root}/buckminster.output" />
	<property name="buckminster.temp.root" value="${build.root}/buckminster.temp" />
	<property name="buckminster.workspace" value="${build.root}/buckminster.workspace"/>
	<property name="buckminster.configuration" value="${build.root}/configuration"/>
	<property name="buckminster.target.platform" value="${build.root}/${target.platform}"/>
	<property name="buckminster.loglevel" value="INFO" />
		
	<property name="director.install.dest" location="${user.home}" />
	<property name="director.dir" location="${director.install.dest}/director" />
	<property name="director.url" value="http://download.eclipse.org/tools/buckminster/products/director_latest.zip" />

	<property name="findbugs.version" value="2.0.3" />
	<property name="findbugs.url" value="http://prdownloads.sourceforge.net/findbugs/findbugs-${findbugs.version}.zip?download"/>
	<property name="findbugs.install.dest" value="${user.home}" />
	<property name="findbugs.home" value="${findbugs.install.dest}/findbugs-${findbugs.version}" />
	
	<property name="eclipse.p2.mirrors" value="true" />
	<property name="java.net.preferIPv4Stack" value="true" />
	
	<!-- = = = = = = = = = = = = = = = = =
          macrodef: run_buckminster
          pass the commandsfile to execute      
         = = = = = = = = = = = = = = = = = -->
	<macrodef name="run_buckminster">
		<attribute name="commandsfile" default="default" />
		<attribute name="propertiesfile" default="default" />
		<sequential>
			<echo message=" " />
			<echo message="java -Dbuckminster.output.root=${buckminster.output.root} -Dbuckminster.temp.root=${buckminster.temp.root} -Xms256m -Xmx512m -jar ${buckminster.home}/plugins/org.eclipse.equinox.launcher_*.jar -application org.eclipse.buckminster.cmdline.headless -data ${buckminster.workspace} --loglevel ${buckminster.loglevel} --script @{commandsfile} --properties @{propertiesfile}" />
			<java fork="true" dir="${buckminster.home}" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="true">
				<classpath>
					<fileset dir="${buckminster.home}/plugins">
						<include name="org.eclipse.equinox.launcher_*.jar" />
					</fileset>
				</classpath>
				<arg line='-application org.eclipse.buckminster.cmdline.headless' />
				<arg line='-data "${buckminster.workspace}"' />
				<arg line='-configuration "${buckminster.configuration}"' />
				<arg line='--properties "@{propertiesfile}"' />
				<arg line='--script "@{commandsfile}"' />
				<arg line='-L ${buckminster.loglevel}' />
				<!-- <arg line='-L ant=INFO' />  -->
				<!-- <arg line='-L DEBUG' /> -->
				<sysproperty key="projects.location" value="${projects.location}" />
				<sysproperty key="buckminster.output.root" value="${buckminster.output.root}" />
				<sysproperty key="buckminster.temp.root" value="${buckminster.temp.root}" />
				<sysproperty key="target.platform" value="${buckminster.target.platform}" />
				<sysproperty key="eclipse.download" value="${eclipse.download}" />
				<sysproperty key="findbugs.home" value="${findbugs.home}" />
				<sysproperty key="eclipse.p2.mirrors" value="${eclipse.p2.mirrors}" />
				<sysproperty key="java.net.preferIPv4Stack" value="${java.net.preferIPv4Stack}" />
				<jvmarg line=" -Xms256m -Xmx512m" />
			</java>
		</sequential>
	</macrodef>
	
	<!-- = = = = = = = = = = = = = = = = =
          macrodef: run_b3_aggregator
          pass the commandsfile to execute      
         = = = = = = = = = = = = = = = = = -->
	<macrodef name="run_b3_aggregator">
		<attribute name="buildmodel" default="default" />
		<element name="args" optional="true"/>
		<sequential>
			<java fork="true" dir="${b3.home}" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="true">
				<sysproperty key="eclipse.p2.mirrors" value="${eclipse.p2.mirrors}" />
				<sysproperty key="java.net.preferIPv4Stack" value="${java.net.preferIPv4Stack}" />
				<classpath>
					<fileset dir="${b3.home}/plugins">
						<include name="org.eclipse.equinox.launcher_*.jar" />
					</fileset>
				</classpath>
				<arg line='aggregate' />
				<arg line='--buildModel "@{buildmodel}"' />
				<args/>
				<!-- <arg line='-L DEBUG' /> -->
				<jvmarg line=" -Xms256m -Xmx512m" />
			</java>
		</sequential>
	</macrodef>
	
	<!-- example; replace the - - with two dashes (can't be done in this comment)
	<target name="b3_aggregation_with_buildroot" depends="install.b3.headless" description="Runs the b3 aggregation with explicit buildRoot">

		<property name="build.model" location="${releng.project}/aggregator/mirror.b3aggr" />
		<property name="b3.build.root" location="${releng.project}/../../mirrors/my-mirror"/>
		
		<echo message="IMPORTANT: Mirror aggregation may took over 10 minutes." />
		<echo message="build.model: ${build.model}" />
		<echo message="b3.build.root: ${b3.build.root}" />

		<run_b3_aggregator buildmodel="${build.model}" >
			<args>
				<arg value='- -buildRoot' />
				<arg value='${b3.build.root}' />
			</args>
		</run_b3_aggregator>
	</target>
	-->

	<target name="copy-xtext-grammar-to-bin">
	  <echo message="projects.location: ${projects.location}" />

	  <copy todir="${projects.location}" overwrite="true" verbose="true">
	    <fileset dir="${projects.location}" casesensitive="true">
	      <include name="**/src/**/*.xtext" />
	    </fileset>
	    <regexpmapper from="(.*)/(src)/(.*/*\.xtext)" to="\1/bin/\3" casesensitive="yes" handledirsep="yes"/>
	  </copy>
	</target>

	<target name="copy-xtext-grammar-to-bin-debug" description="only for debuging purpose">
		<fileset dir="${projects.location}" includes="**/src/**/*.xtext" />

		<path id="xtext.files">
		  <fileset dir="${projects.location}">
		      <include name="**/src/**/*.xtext*" />
		  </fileset>
		</path>

		<pathconvert property="xtext-files">
		    <path refid="xtext.files" />
		    <mapper type="regexp" 
		      from="(.*)/(src)/(.*/*\.xtext)" to="\1/bin/\3" />
		</pathconvert>

		<!-- <pathconvert property="xtext-files" refid="xtext.files" pathsep=" " /> -->
		<echo message="${xtext-files}" />
	</target>
	
	<target name="cleanup">
		<delete failonerror="false" includeemptydirs="true">
			<fileset dir="${build.root}" defaultexcludes="false">
				<exclude name="**/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/" />
				<exclude name="**/${target.platform}/" />
			</fileset>
		</delete>
	</target>

	<target name="clean-xtend-gen" unless="dont-clean-xtend-gen">
		<delete failonerror="false" includeemptydirs="true">
			<fileset dir="${projects.location}" defaultexcludes="false">
				<include name="**/xtend-gen/**/*.java*" />
			</fileset>
		</delete>
	</target>

	<target name="reset.target-platform">
		<delete includeemptydirs="true">
			<fileset dir="${build.root}" defaultexcludes="false">
				<include name="**/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/" />
				<include name="**/${target.platform}/" />
			</fileset>
		</delete>
	</target>


	<target name="install.buckminster.headless">
		<condition property="buckminster.headless.installed">
			<available file="${buckminster.home}/buckminster" />
		</condition>
		<antcall target="install.buckminster.headless.internal" />
	</target>

	<target name="install.buckminster.headless.internal" unless="buckminster.headless.installed" >
		<antcall target="install.p2.director" />
		<echo message="" />
		<echo message="Installing Buckminster Headless into ${buckminster.home}..." />
		<java fork="true" dir="${director.dir}" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="true">
			<sysproperty key="eclipse.p2.mirrors" value="${eclipse.p2.mirrors}" />
			<sysproperty key="java.net.preferIPv4Stack" value="${java.net.preferIPv4Stack}" />
			<classpath>
				<fileset dir="${director.dir}/plugins">
					<include name="org.eclipse.equinox.launcher_*.jar" />
				</fileset>
			</classpath>
			<arg line='-data "${director.dir}/workspace"' />
			<arg line="-r ${eclipse.download}/tools/buckminster/headless-4.3,http://download.cloudsmith.com/buckminster/external-4.3,${eclipse.download}/modeling/tmf/xtext/updates/composite/releases" />
			<arg line='-d "${buckminster.home}"' />
			<arg line="-p Buckminster" />
			<arg line="-roaming" />
			<arg line="-i org.eclipse.buckminster.cmdline.product" />
			<arg line="-i org.eclipse.buckminster.core.headless.feature.feature.group" />
			<arg line="-i org.eclipse.buckminster.pde.headless.feature.feature.group" />
			<arg line="-i org.eclipse.buckminster.git.headless.feature.feature.group" />
			<arg line="-i org.eclipse.buckminster.maven.headless.feature.feature.group" />
			<arg line="-i org.eclipse.buckminster.emma.headless.feature.feature.group" />
			<arg line="-i org.eclipse.emf.mwe2.launcher.feature.group" />
		</java>
	</target>
	
	<target name="install.b3.headless">
		<condition property="b3.headless.installed">
			<available file="${b3.home}/b3" />
		</condition>
		<antcall target="install.b3.headless.internal" />
	</target>

	<target name="install.b3.headless.internal" unless="b3.headless.installed" >
		<antcall target="install.p2.director" />
		<echo message="" />
		<echo message="Installing B3 Headless into ${b3.home}..." />
		<java fork="true" dir="${director.dir}" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="true">
			<sysproperty key="eclipse.p2.mirrors" value="false" />
			<classpath>
				<fileset dir="${director.dir}/plugins">
					<include name="org.eclipse.equinox.launcher_*.jar" />
				</fileset>
			</classpath>
			<arg line='-data "${director.dir}/workspace"' />
			<arg line="-r ${eclipse.download}/modeling/emft/b3/headless-4.3" />
			<arg line='-d "${b3.home}"' />
			<arg line="-p b3" />
			<arg line="-i org.eclipse.b3.cli.product" />
			<arg line="-i org.eclipse.b3.aggregator.engine.feature.feature.group" />
		</java>
	</target>

	<target name="install.p2.director">
		<condition property="p2.director.installed">
			<available file="${director.dir}" />
		</condition>
		<antcall target="install.p2.director.internal" />
	</target>

	<target name="install.p2.director.internal" unless="p2.director.installed">
		<echo message="" />
		<echo message="Installing director from ${director.url}..." />
		<tempfile destdir="${java.io.tmpdir}"
						          prefix="director-"
						          suffix=".zip"
						          property="director.zip"
						          deleteonexit="true" />
		<get src="${director.url}" dest="${director.zip}" />
		<unzip src="${director.zip}" dest="${director.install.dest}" />
		<chmod file="${director.install.dest}/director/director" perm="+x" />
		<delete file="${director.zip}" />
	</target>

	<target name="install.findbugs">
		<condition property="findbugs.installed">
			<available file="${findbugs.home}" />
		</condition>
		<antcall target="install.findbugs.internal" />
	</target>

	<target name="install.findbugs.internal" unless="findbugs.installed">
		<echo message="" />
		<echo message="Installing findbugs from ${findbugs.url}..." />
		<tempfile destdir="${java.io.tmpdir}"
						          prefix="findbugs-"
						          suffix=".zip"
						          property="findbugs.zip"
						          deleteonexit="true" />
		<get src="${findbugs.url}" dest="${findbugs.zip}" />
		<unzip src="${findbugs.zip}" dest="${findbugs.install.dest}" />
		<delete file="${findbugs.zip}" />
	</target>
</project>

Back to the top