Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0464d88edf8f9ad38f45ccf9c0904a3ec4590a6a (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
<?xml version="1.0" encoding="UTF-8"?>
<project name="build-kernel" xmlns:ivy="antlib:org.apache.ivy.ant">

	<path id="unit.test.bundles">
		<pathelement location="../org.eclipse.virgo.kernel.equinox.extensions"/>
		<pathelement location="../org.eclipse.virgo.kernel.artifact"/>
		<pathelement location="../org.eclipse.virgo.kernel.services"/>
		<pathelement location="../org.eclipse.virgo.kernel.osgi"/>
		<pathelement location="../org.eclipse.virgo.kernel.deployer"/>
		<pathelement location="../org.eclipse.virgo.kernel.userregionfactory"/>
		<pathelement location="../org.eclipse.virgo.kernel.userregion"/>
		<pathelement location="../org.eclipse.virgo.kernel.agent.dm"/>
		<pathelement location="../org.eclipse.virgo.kernel.kerneldmfragment"/>
		<pathelement location="../org.eclipse.virgo.management.fragment"/>
		<pathelement location="../org.eclipse.virgo.management.console"/>
		<pathelement location="../org.eclipse.virgo.kernel.dmfragment"/>
		<pathelement location="../org.eclipse.virgo.kernel.deployer.dm"/>
		<pathelement location="../org.eclipse.virgo.kernel.model"/>
		<pathelement location="../org.eclipse.virgo.kernel.shell"/>
		<pathelement location="../org.eclipse.virgo.kernel.osgicommand"/>
		<pathelement location="../org.eclipse.virgo.kernel.stubs"/>
	</path>

	<path id="bundles">
		<path refid="unit.test.bundles" />
		<pathelement location="../org.eclipse.virgo.kernel"/>
		<pathelement location="../org.eclipse.virgo.kernel.test"/>
		<pathelement location="../org.eclipse.virgo.kernel.deployer.testbundle"/>
		<pathelement location="../org.eclipse.virgo.kernel.deployer.test"/>
	</path>

	<property file="${basedir}/../build.properties"/>
	<property file="${basedir}/../build.versions"/>
	<import file="${basedir}/../virgo-build/multi-bundle/default.xml"/>

	<target name="precommit" depends="clean, clean-integration, test, findbugs, package, smoke-test"
		description="Performs a CI server-like build, should be run prior to performing a Git push"/>

	<target name="fetch-nano-updatesite">
		<mkdir dir="${target.dir}"/>

		<condition property="dependancy.folder" value="milestone" else="${adjusted.release.type}">
			<or>
				<contains string="${org.eclipse.virgo.nano}" substring=".M"/>
				<contains string="${org.eclipse.virgo.nano}" substring=".RC"/>
			</or>
		</condition>

		<condition property="dependancy.folder" value="release" else="${adjusted.release.type}">
			<contains string="${org.eclipse.virgo.nano}" substring=".RELEASE"/>
		</condition>

		<get src="http://build.eclipse.org/rt/virgo/zips/${dependancy.folder}/VN/${org.eclipse.virgo.nano}/virgo-nano-updatesite-${org.eclipse.virgo.nano}.zip"
			dest="${target.dir}/virgo-nano-updatesite-${org.eclipse.virgo.nano}.zip"
			usetimestamp="true" />

		<echo message="Fetched the Nano zip to ${target.dir}/virgo-nano-updatesite-${org.eclipse.virgo.nano}.zip"/>
	</target>

	<target name="package" depends="ivy.init, fetch-nano-updatesite">
		<delete dir="${package.output.dir}" quiet="true"/>
		<mkdir dir="${package.output.dir}"/>

		<unzip src="${target.dir}/virgo-nano-updatesite-${org.eclipse.virgo.nano}.zip" dest="${p2.repository.dir}">
			<globmapper from="virgo-nano-updatesite-${org.eclipse.virgo.nano}/*" to="*"/>
		</unzip>
		<delete file="${target.dir}/virgo-nano-updatesite-${org.eclipse.virgo.nano}.zip" quiet="true"/>

		<echo message="Fetched the Nano update site zip to ${target.dir}/virgo-nano-updatesite-${org.eclipse.virgo.nano}.zip"/>

		<!-- Assemble the kernel bundles for publishing -->
		<ivy:resolve resolveId="copy.path" file="${basedir}/plugins-ivy.xml" transitive="true"/>
		<ivy:retrieve resolveId="copy.path" pattern="${target.dir}/assembly/plugins/[artifact]_[revision].[ext]" conf="plugins" type="jar"/>
		<!-- Prepare the features for publishing -->
		<copy todir="${target.dir}/assembly/features" failonerror="false">
			<fileset dir="${basedir}/publish_resources/features" excludes="keystore"/>
			<filterset>
				<filter token="REGION.VERSION" value="${org.eclipse.equinox.region}"/>
				<filter token="KERNEL.VERSION" value="${bundle.version}"/>
				<filter token="REPOSITORY.VERSION" value="${org.eclipse.virgo.repository}"/>
				<filter token="SPRING.VERSION" value="${org.springframework}"/>
				<filter token="JAVAX.SERVLET.VERSION" value="${javax.servlet}"/>
				<filter token="EQUINOX.HTTP.VERSION" value="${org.eclipse.equinox.http}"/>
				<filter token="OSGI.ENTERPRISE.VERSION" value="${org.osgi.enterprise}"/>
				<filter token="GEMINI.MANAGEMENT.VERSION" value="${org.eclipse.gemini.management}"/>
			</filterset>
		</copy>

		<!-- prepare Kernel's resources - configurations and bundles that are not installed initially -->
		<property name="kernel.resources" value="${target.dir}/kernel_resources"/>

		<ivy:resolve resolveId="copy.path" file="${basedir}/lib-ivy.xml" transitive="true"/>
		<ivy:retrieve resolveId="copy.path" pattern="${kernel.resources}/lib/[artifact]_[revision].[ext]" conf="lib" type="jar"/>

		<ivy:resolve resolveId="copy.path" file="${basedir}/repository-ext-ivy.xml" transitive="true"/>
		<ivy:retrieve resolveId="copy.path" pattern="${kernel.resources}/repository/ext/[artifact]_[revision].[ext]" conf="repository-ext" type="jar"/>
		
		<ivy:resolve resolveId="copy.path" file="${basedir}/pickup-ivy.xml" transitive="true"/>
		<ivy:retrieve resolveId="copy.path" pattern="${kernel.resources}/pickup/[artifact]_[revision].[ext]" type="jar, war, wab" conf="pickup"/>
		<ivy:retrieve resolveId="copy.path" pattern="${kernel.resources}/pickup/[artifact]_[revision].[ext]" type="plan" conf="pickup-plan"/>
		<ivy:retrieve resolveId="copy.path" pattern="${kernel.resources}/repository/ext/[artifact]_[revision].[ext]" type="jar, war, wab" conf="pickup-plan"/>

		<mkdir dir="${kernel.resources}/configuration"/>

		<copy todir="${kernel.resources}/configuration" failonerror="false">
			<fileset dir="${basedir}/configuration" excludes="org.eclipse.virgo.kernel.userregion.properties"/>
		</copy>

		<copy todir="${kernel.resources}" failonerror="false">
			<fileset dir="${basedir}/resources"/>
		</copy>

		<copy todir="${kernel.resources}/repository/ext" failonerror="false">
			<fileset dir="${basedir}/repository/ext"/>
		</copy>

		<copy todir="${kernel.resources}/repository/ext" failonerror="false">
			<fileset dir="${target.dir}/assembly/plugins">
				<include name="org.eclipse.virgo.kernel.agent.dm_*.jar"/>
			</fileset>
		</copy>
		<!-- Prepare these two as part of the resources. They need a later installation, not with the other initial kernel region bundles. -->
		<copy todir="${kernel.resources}/plugins" failonerror="false">
			<fileset dir="${target.dir}/assembly/plugins">
				<include name="org.eclipse.virgo.kernel.userregion_*.jar"/>
				<include name="org.eclipse.virgo.kernel.osgicommand_*.jar"/>
			</fileset>
		</copy>

		<move todir="${kernel.resources}/repository/ext" failonerror="false">
			<fileset dir="${target.dir}/assembly/plugins">
				<include name="org.eclipse.virgo.kernel.dmfragment_*.jar"/>
				<include name="org.eclipse.virgo.kernel.deployer.dm_*.jar"/>
			</fileset>
		</move>

		<mkdir dir="${kernel.resources}/repository/usr"/>

		<property name="kernel.resources.location" value="${target.dir}/kernel_resources_zipped"/>
		<zip destfile="${kernel.resources.location}/binary/kernel_resources">
			<zipfileset dir="${kernel.resources}"/>
		</zip>
		<delete dir="${kernel.resources}" quiet="true"/>

		<!-- Assemble and prepare for publishing the Kernel's specific resources -->
		<property name="specific.resources" value="${target.dir}/specific_resources"/>
		<mkdir dir="${specific.resources}/lib"/>
		<mkdir dir="${specific.resources}/configuration"/>

		<copy todir="${specific.resources}/configuration" failonerror="false">
			<fileset dir="${basedir}/configuration">
				<include name="org.eclipse.virgo.kernel.userregion.properties"/>
			</fileset>
			<filterset>
				<filter token="ASPECTJ.VERSION" value="${org.aspectj}"/>
				<filter token="OSGI.SERVICES.VERSION" value="${org.eclipse.osgi.services}"/>
				<filter token="EQUINOX.EVENT.VERSION" value="${org.eclipse.equinox.event}"/>
				<filter token="EQUINOX.CONFIGADMIN.VERSION" value="${org.eclipse.equinox.cm}"/>
				<filter token="EQUINOX.DS.VERSION" value="${org.eclipse.equinox.ds}"/>
				<filter token="EQUINOX.UTIL.VERSION" value="${org.eclipse.equinox.util}"/>
				<filter token="OSGI.ENTERPRISE.VERSION" value="${org.osgi.enterprise}"/>
				<filter token="GEMINI.MANAGEMENT.VERSION" value="${org.eclipse.gemini.management}"/>
				<filter token="KERNEL.VERSION" value="${bundle.version}"/>
				<filter token="MEDIC.VERSION" value="${org.eclipse.virgo.medic}"/>
				<filter token="REPOSITORY.VERSION" value="${org.eclipse.virgo.repository}"/>
				<filter token="SLF4J.VERSION" value="${org.slf4j.api}"/>
				<filter token="SPRING.DM.VERSION" value="${org.eclipse.gemini.blueprint}"/>	
				<filter token="SPRING.VERSION" value="${org.springframework}"/>
				<filter token="UTIL.VERSION" value="${org.eclipse.virgo.util}"/>
				<filter token="FELIX.GOGO.RUNTIME.VERSION" value="${org.apache.felix.gogo.runtime}"/>
				<filter token="FELIX.GOGO.COMMAND.VERSION" value="${org.apache.felix.gogo.command}"/>
				<filter token="FELIX.GOGO.SHELL.VERSION" value="${org.apache.felix.gogo.shell}"/>
				<filter token="MINA.CORE.VERSION" value="${org.apache.mina.core}"/>
				<filter token="SSHD.CORE.VERSION" value="${org.apache.sshd.core}"/>
				<filter token="EQUINOX.CONSOLE.VERSION" value="${org.eclipse.equinox.console}"/>
                <filter token="EQUINOX.CONSOLE.SSH.VERSION" value="${org.eclipse.equinox.console.ssh}"/>
                
			</filterset>
		</copy>

		<!-- get and reconfigure the serviceability.xml and .version -->
		<unzip src="${p2.repository.dir}/binary/nano_specific_resources_1.0.0" dest="${specific.resources}">
			<globmapper from="nano_specific_resources/*" to="*"/>
		</unzip>
		<echo file="${specific.resources}/lib/.version" append="true" message="virgo.kernel.version=${bundle.version}&#xa;"/>

		<replaceregexp match="virgo-nano" replace="virgo-kernel" flags="g" file="${specific.resources}/configuration/serviceability.xml"/>

		<property name="specific.resources.location" value="${target.dir}/specific_resources_zipped"/>
		<zip destfile="${specific.resources.location}/binary/kernel_specific_resources">
			<zipfileset dir="${specific.resources}"/>
		</zip>
		<delete dir="${specific.resources}" quiet="true"/>

		<!-- Publish -->
		<mkdir dir="${artifacts.dir}"/>

		<antcall target="fetch-unzipped-virgo-build-tools"/>

		<antcall target="p2.generate-inf">
			<param name="source" value="${target.dir}/assembly/features"/>
		</antcall>

		<property name="p2.products.location" value="${basedir}/publish_resources/products"/>

		<antcall target="p2.publish-binary">
			<param name="repository" value="${p2.repository.dir}"/>
			<param name="source" value="${kernel.resources.location}"/>
		</antcall>
		<echo message="Published the kernel resources to ${p2.repository.dir}."/>

		<antcall target="p2.publish-binary">
			<param name="repository" value="${p2.repository.dir}"/>
			<param name="source" value="${specific.resources.location}"/>
		</antcall>
		<echo message="Published the kernel specific resources to ${p2.repository.dir}."/>

		<antcall target="p2.publish-bundles-features">
			<param name="repository" value="${p2.repository.dir}"/>
			<param name="source" value="${target.dir}/assembly"/>
		</antcall>
		<echo message="Published bundles and features to ${p2.repository.dir}."/>

		<antcall target="p2.publish-product">
			<param name="repository" value="${p2.repository.dir}"/>
			<param name="product.file.location" value="${p2.products.location}/kernel-base/kernel-base.product"/>
		</antcall>
		<echo message="Published kernel base product to ${p2.repository.dir}."/>

		<antcall target="p2.publish-product">
			<param name="repository" value="${p2.repository.dir}"/>
			<param name="product.file.location" value="${p2.products.location}/kernel/kernel.product"/>
		</antcall>
		<echo message="Published kernel product to ${p2.repository.dir}."/>

		<antcall target="p2.install-virgo-product">
			<param name="repository" value="${p2.repository.dir}"/>
			<param name="destination" value="${package.output.dir}"/>
			<param name="product.iu" value="kernel.product"/>
		</antcall>
		<echo message="Installed Virgo Kernel for distribution purposes."/>

		<delete dir="${package.output.dir}/Eclipse.app" quiet="true"/>

		<zip destfile="${package.output.file}">
			<zipfileset dir="${package.dir}" includes="${package.basename}/bin/*.sh" filemode="755"/>
			<zipfileset dir="${package.dir}" includes="${package.basename}/configuration/org.eclipse.virgo.kernel.jmxremote.access.properties" filemode="600"/>
			<zipfileset dir="${package.dir}">
				<exclude name="${package.basename}/bin/*.sh"/>
				<exclude name="${package.basename}/configuration/org.eclipse.virgo.kernel.jmxremote.access.properties"/>
			</zipfileset>
		</zip>
		<zip destfile="${updatesite.output.file}">
			<zipfileset dir="${p2.repository.dir}"/>
		</zip>

		<delete dir="${kernel.resources.location}" quiet="true"/>
		<delete dir="${specific.resources.location}" quiet="true"/>
		<delete dir="${target.dir}/assembly" quiet="true"/>
		<delete dir="${tools.dir}" quiet="true"/>
	</target>
	
	<target name="smoke-test" description="Runs a smoke test on the kernel packaged build">
		<path id="smoke.test.bundles">
			<pathelement location="${basedir}/../org.eclipse.virgo.kernel.smoketest" />
		</path>
		<antcall target="test.pre"/>
		<all-bundles target="test-package" buildpathRef="smoke.test.bundles">
			<property name="package.output.file" value="${package.output.file}"/>
			<property name="package.basename" value="${package.basename}"/>
		</all-bundles>
		<antcall target="test.post"/>
	</target>

</project>

Back to the top