Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8590509f3b428f90bdaff38cc27a143737feebc1 (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
<?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.shutdown"/>
		<pathelement location="../org.eclipse.virgo.kernel.authentication"/>
		<pathelement location="../org.eclipse.virgo.kernel.core"/>
		<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.deployer.p2"/>
		<pathelement location="../org.eclipse.virgo.kernel.build.p2"/>
        <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.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"/>

    <!--P2 publishing properties-->
    <property name="publishing.dir" value="${basedir}/target/repository"/>
    <property name="distro.res" value="${basedir}/distro_resources"/>
    <property name="p2.repo.url" value="file:///${publishing.dir}"/>
    <property name="product.file" value="${basedir}/org.eclipse.virgo.kernel.product"/>
    <property name="lib.product.file" value="${basedir}/org.eclipse.virgo.kernel.lib.product"/>
    <property name="lib.kernel.product.file" value="${basedir}/org.eclipse.virgo.kernel.lib.kernel.product"/>
    <property name="repository.ext.product.file" value="${basedir}/org.eclipse.virgo.kernel.repository.ext.product"/>

	<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="package" depends="ivy.init">
		<delete dir="${basedir}/p2" quiet="true"/>
		<mkdir dir="${basedir}/p2"/>
		
		<delete dir="${package.output.dir}" quiet="true"/>
		<mkdir dir="${package.output.dir}"/>
		
		<!-- Prepare the p2 build client -->
		<ivy:resolve resolveId="copy.path" file="${basedir}/p2runtime-ivy.xml" transitive="true"/>
		<ivy:retrieve resolveId="copy.path" pattern="${basedir}/p2/[artifact]_[revision].[ext]" conf="p2-runtime" type="jar"/>
		
		<ivy:resolve resolveId="copy.path" file="${basedir}/p2build-ivy.xml" transitive="true"/>
		<ivy:retrieve resolveId="copy.path" pattern="${basedir}/p2/[artifact]_[revision].[ext]" conf="p2-build" type="jar"/>
		
		<copy todir="${basedir}/p2/configuration" failonerror="false">
			<fileset dir="${basedir}/p2_resources" excludes="keystore"/>
			<filterset>
				<filter token="SIMPLE.CONFIG.VERSION" value="${org.eclipse.equinox.simpleconfigurator}"/>
			</filterset>
		</copy>
		<java jar="${basedir}/p2/org.eclipse.virgo.kernel.build.p2_${bundle.version}.jar" fork="true" taskname="BundlesInfoBuilder" failonerror="true" maxmemory="256m">
			<arg value="${basedir}"/>
		</java>

		<!-- Assemble artifacts -->
		<ivy:resolve resolveId="copy.path" file="${basedir}/kernel-ivy.xml" transitive="true"/>
		<ivy:retrieve resolveId="copy.path" pattern="${package.dir}/zip/repository/ext/[artifact]_[revision].[ext]" conf="repository-ext" type="jar"/> 

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

		<ivy:resolve resolveId="copy.path" file="${basedir}/user-ivy.xml" transitive="false"/>
		<ivy:retrieve resolveId="copy.path" pattern="${package.dir}/zip/lib/user/[artifact]_[revision].[ext]" conf="lib-user" type="jar"/>
		
		<!-- Copy the kernel artifacts to a prepared for publishing location - a p2 repo will be built around them -->
		<ivy:resolve resolveId="copy.path" file="${basedir}/kernel-ivy.xml" transitive="true"/>
		<ivy:retrieve resolveId="copy.path" pattern="${target.dir}/p2repo/[artifact]_[revision].[ext]" conf="lib-kernel" type="jar"/>

		<ivy:resolve resolveId="copy.path" file="${basedir}/p2runtime-ivy.xml" transitive="true"/>
		<ivy:retrieve resolveId="copy.path" pattern="${target.dir}/p2repo/[artifact]_[revision].[ext]" conf="p2-runtime" type="jar"/>
	
		<mkdir dir="${package.dir}/zip/config"/>
		<mkdir dir="${package.dir}/zip/pickup"/>

		<echo file="${package.dir}/zip/lib/.version"
				message="virgo.kernel.version=${bundle.version}&#xa;"/>
		
		<copy todir="${package.dir}/zip" failonerror="false">
			<fileset dir="${basedir}/resources"/>
		</copy>

		<copy todir="${package.dir}/zip/bin" failonerror="false">
			<fileset dir="${basedir}/bin"/>
		</copy>

		<copy todir="${package.dir}/zip/lib" failonerror="false">
			<fileset dir="${basedir}/lib"/>
			<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="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}"/>
				<filter token="SPRING.DM.VERSION" value="${org.springframework.osgi}"/>	
				<filter token="SPRING.VERSION" value="${org.springframework}"/>
				<filter token="UTIL.VERSION" value="${org.eclipse.virgo.util}"/>
				<filter token="OSGI.EXTENSIONS.VERSION" value="${org.eclipse.virgo.osgi}"/>
				<filter token="CORE.CONTENTTYPE" value="${org.eclipse.core.contenttype}"/>
				<filter token="CORE.JOBS" value="${org.eclipse.core.jobs}"/>
				<filter token="CORE.RUNTIME" value="${org.eclipse.core.runtime}"/>
				<filter token="ECF" value="${org.eclipse.ecf}"/>
				<filter token="ECF.FILETRANSFER" value="${org.eclipse.ecf.filetransfer}"/>
				<filter token="ECF.IDENTITY" value="${org.eclipse.ecf.identity}"/>
				<filter token="ECF.PROVIDER.FILETRANSFER" value="${org.eclipse.ecf.provider.filetransfer}"/>
				<filter token="ECF.PROVIDER.FILETRANSFER.SSL" value="${org.eclipse.ecf.provider.filetransfer.ssl}"/>
				<filter token="ECF.SSL" value="${org.eclipse.ecf.ssl}"/>
				<filter token="EQUINOX.APP" value="${org.eclipse.equinox.app}"/>
				<filter token="EQUINOX.COMMON" value="${org.eclipse.equinox.common}"/>
				<filter token="EQUINOX.FRAMEWORKADMIN" value="${org.eclipse.equinox.frameworkadmin}"/>
				<filter token="EQUINOX.FRAMEWORKADMIN.EQUINOX" value="${org.eclipse.equinox.frameworkadmin.equinox}"/>
				<filter token="EQUINOX.LAUNCHER" value="${org.eclipse.equinox.launcher}"/>
				<filter token="EQUINOX.P2.ARTIFACT.REPOSITORY" value="${org.eclipse.equinox.p2.artifact.repository}"/>
				<filter token="EQUINOX.P2.CONSOLE" value="${org.eclipse.equinox.p2.console}"/>
			</filterset>
		</copy>
		
		<copy todir="${package.dir}/zip/config" failonerror="false">
			<fileset dir="${basedir}/config" excludes="keystore"/>
			<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="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}"/>
				<filter token="SPRING.DM.VERSION" value="${org.springframework.osgi}"/>	
				<filter token="SPRING.VERSION" value="${org.springframework}"/>
				<filter token="UTIL.VERSION" value="${org.eclipse.virgo.util}"/>
			</filterset>
		</copy>
		
		<copy todir="${package.dir}/zip/repository/ext" failonerror="false">
			<fileset dir="${basedir}/repository/ext"/>
		</copy>
		
		<copy todir="${package.dir}/zip/repository/ext" failonerror="false">
			<fileset dir="${target.dir}/p2repo">
				<include name="org.eclipse.virgo.kernel.agent.dm_*.jar"/>
			</fileset>
		</copy>
		
		<move todir="${package.dir}/zip/repository/ext" failonerror="false">
			<fileset dir="${target.dir}/p2repo">
				<include name="org.eclipse.virgo.kernel.dmfragment_*.jar"/>
				<include name="org.eclipse.virgo.kernel.deployer.dm_*.jar"/>
			</fileset>
		</move>
				
		<mkdir dir="${package.dir}/zip/repository/usr"/>
		
		<copy file="${basedir}/config/keystore" todir="${package.output.dir}/config" failonerror="false"/>

		<chmod perm="600">
			<fileset dir="${package.dir}/zip/config">
				<include name="org.eclipse.virgo.kernel.jmxremote.access.properties"/>
			</fileset>
		</chmod>

		<chmod perm="755">
			<fileset dir="${package.dir}/zip/bin">
				<include name="*.sh"/>
			</fileset>
		</chmod>

		<!-- zip the published Virgo repositories and configuration data -->
		<zip destfile="${target.dir}/p2repo/virgo_resources.zip">
			<zipfileset dir="${package.dir}/zip"/>
		</zip>
		
		<delete dir="${package.dir}/zip" quiet="true"/>
		
		<!-- execute product publisher -->
		<echo message="Publishing Virgo kernel product in p2 repository" />
		<java jar="${basedir}/p2/org.eclipse.osgi_3.7.0.v20110224.jar" fork="true" taskname="p2ProductPublishing" failonerror="true" maxmemory="256m">
			<sysproperty key="operationType" value="p2repoPublish"/>
			<sysproperty key="launch.config.location" value="${basedir}/lib/org.eclipse.virgo.kernel.launch.properties"/>
			<sysproperty key="product.location" value="${target.dir}/p2repo"/>
		</java>
		
		<!-- execute product install -->
		<echo message="Installing Virgo product to get the final assembly of Virgo kernel" />
		<java jar="${basedir}/p2/org.eclipse.osgi_3.7.0.v20110224.jar" fork="true" taskname="p2ProductInstall" failonerror="true" maxmemory="256m">
			<sysproperty key="operationType" value="installKernel"/>
			<sysproperty key="source.p2.repo" value="file:${target.dir}/p2repo"/>
			<sysproperty key="install.location" value="${package.output.dir}"/>
			<sysproperty key="installIU" value="virgo.product"/>
			<sysproperty key="profile" value="VIRGO.kernel"/>
		</java>
		
		<mkdir dir="${artifacts.dir}"/>
		<zip destfile="${package.output.file}">
			<zipfileset dir="${package.dir}" includes="${package.basename}/bin/*.sh" filemode="755"/>
			<zipfileset dir="${package.dir}" includes="${package.basename}/config/org.eclipse.virgo.kernel.jmxremote.access.properties" filemode="600"/>
			<zipfileset dir="${package.dir}">
				<exclude name="${package.basename}/bin/*.sh"/>
				<exclude name="${package.basename}/config/org.eclipse.virgo.kernel.jmxremote.access.properties"/>
			</zipfileset>
		</zip>
	</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>

    <target name="package.resources" depends="package"
            description="Creates a special bundle containing Virgo entities that are not bundles">
        <property name="meta.inf" value="${distro.res}/META-INF"/>
        <property name="content" value="${distro.res}/root_content"/>
        <property name="resources.jar" value="${package.output.dir}/lib/org.eclipse.virgo.kernel.resources.jar"/>
        <zip destfile="${resources.jar}">
            <zipfileset dir="${distro.res}"/>
            <zipfileset dir="${package.dir}/${package.basename}"
                        includes="bin/*.sh" filemode="755"/>
            <zipfileset dir="${package.dir}/${package.basename}"
                        includes="config/org.eclipse.virgo.kernel.jmxremote.access.properties" filemode="600"/>
            <zipfileset dir="${package.dir}/${package.basename}">
                <exclude name="bin/*.sh"/>
                <exclude name="config/org.eclipse.virgo.kernel.jmxremote.access.properties"/>
                <exclude name="**/*.jar"/>
            </zipfileset>
        </zip>
    </target>

    <target name="p2.publish" depends="package.resources, p2.extract-publisher"
            description="Publishes bundles, features and product">
        <java jar="${p2.launcher.jar}" fork="true" taskname="p2bundles" failonerror="true" maxmemory="256m">
            <arg line="-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher"/>
            <arg line="-metadataRepository ${p2.repo.url}"/>
            <arg line="-artifactRepository ${p2.repo.url}"/>
            <arg line="-bundles ${package.output.dir}/lib,${package.output.dir}/repository/ext"/>
            <arg line="-publishArtifacts"/>
            <arg line="-configs all"/>
        </java>

        <sshexec host="build.eclipse.org" 
                username="${eclipse.buildId}" 
                keyfile="${key.file}" 
                passphrase="${passphrase}"
                command="mkdir -pv /opt/public/rt/virgo/update-site/${release.type}/${build.stamp}"/>

        <scp todir="${eclipse.buildId}@build.eclipse.org:/opt/public/rt/virgo/update-site/${release.type}/${build.stamp}/" 
                keyfile="${key.file}"
                passphrase="${passphrase}">
            <fileset dir="${publishing.dir}"/>
        </scp>
 
    </target>

</project>

Back to the top