Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d0ed369b2edab5edf51179f44558d42180e45ddb (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
<?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.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="${package.output.dir}" quiet="true"/>
		<mkdir dir="${package.output.dir}"/>

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

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

		<mkdir dir="${package.output.dir}/config"/>
		<mkdir dir="${package.output.dir}/work"/>
		<mkdir dir="${package.output.dir}/pickup"/>

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

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

		<copy todir="${package.output.dir}/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="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}"/>
			</filterset>
		</copy>

		<copy todir="${package.output.dir}/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="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.output.dir}/repository/ext" failonerror="false">
			<fileset dir="${basedir}/repository/ext"/>
		</copy>
		
		<copy todir="${package.output.dir}/repository/ext" failonerror="false">
			<fileset dir="${package.output.dir}/lib/kernel">
				<include name="org.eclipse.virgo.kernel.agent.dm-*.jar"/>
			</fileset>
		</copy>
		
		<move todir="${package.output.dir}/repository/ext" failonerror="false">
			<fileset dir="${package.output.dir}/lib/kernel">
				<include name="org.eclipse.virgo.kernel.dmfragment-*.jar"/>
				<include name="org.eclipse.virgo.kernel.deployer.dm-*.jar"/>
			</fileset>
		</move>
		
		<mkdir dir="${package.output.dir}/repository/usr"/>
		
		<copy file="${basedir}/config/keystore" todir="${package.output.dir}/config" failonerror="false"/>

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

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

		<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>
        
        
        
        <!-- <java jar="${p2.launcher.jar}" fork="true" taskname="p2product" failonerror="true" maxmemory="256m">
                 <arg line="-application org.eclipse.equinox.p2.publisher.ProductPublisher"/>
                 <arg line="-metadataRepository ${p2.repo.url}"/>
                 <arg line="-artifactRepository ${p2.repo.url}"/>
                 <arg line="-productFile ${product.file}"/>
                 <arg line="-append"/>
                 <arg line="-publishArtifacts"/>
                 <arg line="-flavor tooling"/>
                 <arg line="-configs all"/>
             </java>
             <java jar="${p2.launcher.jar}" fork="true" taskname="p2product" failonerror="true" maxmemory="256m">
                 <arg line="-application org.eclipse.equinox.p2.publisher.ProductPublisher"/>
                 <arg line="-metadataRepository ${p2.repo.url}"/>
                 <arg line="-artifactRepository ${p2.repo.url}"/>
                 <arg line="-productFile ${lib.product.file}"/>
                 <arg line="-append"/>
                 <arg line="-publishArtifacts"/>
                 <arg line="-flavor tooling"/>
                 <arg line="-configs all"/>
             </java>
             <java jar="${p2.launcher.jar}" fork="true" taskname="p2product" failonerror="true" maxmemory="256m">
                 <arg line="-application org.eclipse.equinox.p2.publisher.ProductPublisher"/>
                 <arg line="-metadataRepository ${p2.repo.url}"/>
                 <arg line="-artifactRepository ${p2.repo.url}"/>
                 <arg line="-productFile ${lib.kernel.product.file}"/>
                 <arg line="-append"/>
                 <arg line="-publishArtifacts"/>
                 <arg line="-flavor tooling"/>
                 <arg line="-configs all"/>
             </java>
             <java jar="${p2.launcher.jar}" fork="true" taskname="p2product" failonerror="true" maxmemory="256m">
                 <arg line="-application org.eclipse.equinox.p2.publisher.ProductPublisher"/>
                 <arg line="-metadataRepository ${p2.repo.url}"/>
                 <arg line="-artifactRepository ${p2.repo.url}"/>
                 <arg line="-productFile ${repository.ext.product.file}"/>
                 <arg line="-append"/>
                 <arg line="-publishArtifacts"/>
                 <arg line="-flavor tooling"/>
                 <arg line="-configs all"/>
             </java> -->
             <delete dir="${p2.publishing.dir}" excludes="p2agent.zip" includeemptydirs="true" quiet="true"/>
    </target>

</project>

Back to the top