Skip to main content
summaryrefslogtreecommitdiffstats
blob: b5b19ddd71079611950c90c2f6ebeb42b11007ec (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"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output indent="yes"/>

    <xsl:template match="/">
        <project name="CDT Build Main" default="all">

	    <target name="build">

		<!-- Set up build environment -->
		<ftp server="${{build.server}}"
		    userid="${{build.userid}}" password="${{build.password}}"
		    remotedir="${{build.remotedir}}" action="get" passive="no">
		    <fileset dir=".">
		        <include name="site.xml"/>
			<include name="build.number"/>
		    </fileset>
		</ftp>
	    	<buildnumber/>
		<echo message="Build number: ${{build.version}}.${{build.number}}"/>
		<delete dir="build"/>
		<unzip src="zips/eclipse-SDK-2.1.1-linux-gtk.zip" dest="."/>
		<move todir="build">
		    <fileset dir="eclipse"/>
		</move>

	        <!-- Download source from CVS -->
	        <xsl:for-each select="projects/plugin">
		    <cvs
		        cvsroot=":pserver:anonymous@dev.eclipse.org:/home/tools"
			dest="build/plugins" quiet="true">
			    <xsl:attribute name="package">
			        <xsl:value-of select="@name"/>
			    </xsl:attribute>
		    </cvs>
		</xsl:for-each>

		<xsl:for-each select="projects/feature">
		    <cvs
		        cvsroot=":pserver:anonymous@dev.eclipse.org:/home/tools"
			dest="build/features" quiet="true">
			    <xsl:attribute name="package">
			        <xsl:value-of select="@name"/>
				<xsl:text>-feature</xsl:text>
			    </xsl:attribute>
		    </cvs>
		    <move>
			<xsl:attribute name="todir">
			    <xsl:text>build/features/</xsl:text>
			    <xsl:value-of select="@name"/>
			</xsl:attribute>
			<fileset defaultexcludes="no">
			   <xsl:attribute name="dir">
			        <xsl:text>build/features/</xsl:text>
				<xsl:value-of select="@name"/>
				<xsl:text>-feature</xsl:text>
			    </xsl:attribute>
			</fileset>
		    </move>
		</xsl:for-each>

		<!-- Fix up the versions to match build number -->
	        <xsl:for-each select="projects/plugin|projects/feature">
		    <xslt out="x" style="plugin.xsl">
		        <xsl:attribute name="in">
			    <xsl:text>build/</xsl:text>
			    <xsl:value-of select="name()"/>
			    <xsl:text>s/</xsl:text>
			    <xsl:value-of select="@name"/>
			    <xsl:text>/</xsl:text>
			    <xsl:value-of select="@type"/>
			    <xsl:text>.xml</xsl:text>
			</xsl:attribute>
			<param name="version" expression="${{build.version}}.${{build.number}}"/>
		    </xslt>
		    <move file="x">
		        <xsl:attribute name="tofile">
			    <xsl:text>build/</xsl:text>
			    <xsl:value-of select="name()"/>
			    <xsl:text>s/</xsl:text>
			    <xsl:value-of select="@name"/>
			    <xsl:text>/</xsl:text>
			    <xsl:value-of select="@type"/>
			    <xsl:text>.xml</xsl:text>
			</xsl:attribute>
		    </move>
		</xsl:for-each>

		<!-- Prepare the source plugin -->
		<property name="source.plugin" value="org.eclipse.cdt.source"/>
		<replace
		    file="build/plugins/${{source.plugin}}/build.properties"
		    token="plugin.properties"
		    value="plugin.properties,src/"/>
		
		<!-- Generate build.xml files for projects -->
	        <xslt in="manifest.xml" out="build/genscripts.xml" style="genscripts.xsl"/>
		<chmod perm="+x" file="build/eclipse"/>
		<exec executable="${{basedir}}/build/eclipse">
		    <arg line="-nosplash -data build/workspace"/>
		    <arg line="-application org.eclipse.ant.core.antRunner"/>
		    <arg line="-buildfile build/genscripts.xml"/>
		</exec>

		<!-- Run the build.xml scripts -->
		<xsl:for-each select="projects/plugin">
		    <!-- Build the source jars -->
		    <ant target="build.sources">
		        <xsl:attribute name="dir">
			    <xsl:text>build/plugins/</xsl:text>
			    <xsl:value-of select="@name"/>
			</xsl:attribute>
			<property name="javacFailOnError" value="true"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		    </ant>
		    <ant target="gather.sources">
		        <xsl:attribute name="dir">
			    <xsl:text>build/plugins/</xsl:text>
			    <xsl:value-of select="@name"/>
			</xsl:attribute>
			<property name="javacFailOnError" value="true"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
			<property name="destination.temp.folder" value="../${{source.plugin}}/src"/>
		    </ant>
		</xsl:for-each>

	        <xsl:for-each select="projects/feature">
		    <!-- The default to build the update jars -->
		    <ant>
		        <xsl:attribute name="dir">
			    <xsl:text>build/features/</xsl:text>
			    <xsl:value-of select="@name"/>
			</xsl:attribute>
			<property name="javacFailOnError" value="true"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		    </ant>
		    <!-- The old style zips -->
		    <ant target="zip.distribution">
		        <xsl:attribute name="dir">
			    <xsl:text>build/features/</xsl:text>
			    <xsl:value-of select="@name"/>
			</xsl:attribute>
			<property name="javacFailOnError" value="true"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		    </ant>
		</xsl:for-each>

		<!-- Move jars and zips to the update site format -->
		<delete dir="plugins"/>
		<copy todir="plugins" flatten="true">
		    <fileset dir="build/plugins">
		        <xsl:for-each select="projects/plugin">
			    <include>
			        <xsl:attribute name="name">
				    <xsl:value-of select="@name"/>
				    <xsl:text>/</xsl:text>
				    <xsl:value-of select="@name"/>
				    <xsl:text>_${build.version}.${build.number}.jar</xsl:text>
				</xsl:attribute>
			    </include>
			</xsl:for-each>
		    </fileset>
		</copy>
		<delete dir="features"/>
		<copy todir="features" flatten="true">
		    <fileset dir="build/features">
		        <xsl:for-each select="projects/feature">
			    <include>
			        <xsl:attribute name="name">
				    <xsl:value-of select="@name"/>
				    <xsl:text>/</xsl:text>
				    <xsl:value-of select="@name"/>
				    <xsl:text>_${build.version}.${build.number}.jar</xsl:text>
				</xsl:attribute>
			    </include>
			</xsl:for-each>
		    </fileset>
		</copy>
		<delete dir="dist"/>
		<copy todir="dist" flatten="true">
		    <fileset dir="build/features">
		        <xsl:for-each select="projects/feature">
			    <include>
			        <xsl:attribute name="name">
				    <xsl:value-of select="@name"/>
				    <xsl:text>/</xsl:text>
				    <xsl:value-of select="@name"/>
				    <xsl:text>_${build.version}.${build.number}.bin.dist.zip</xsl:text>
				</xsl:attribute>
			    </include>
			</xsl:for-each>
		    </fileset>
		</copy>

	        <!-- Set up the test environment -->
	        <delete dir="test"/>
		<unzip src="zips/eclipse-SDK-2.1.1-linux-gtk.zip" dest="."/>
		<move todir="test">
		    <fileset dir="eclipse"/>
		</move>
		<unzip src="zips/org.eclipse.test_2.1.0.zip" dest="test/plugins"/>
		<unzip src="zips/org.eclipse.ant.optional.junit_2.1.0.zip" dest="test/plugins"/>

		<xsl:for-each select="projects/plugin|projects/feature">
		    <unjar>
		        <xsl:attribute name="src">
			    <xsl:value-of select="name()"/>
			    <xsl:text>s/</xsl:text>
			    <xsl:value-of select="@name"/>
			    <xsl:text>_${build.version}.${build.number}.jar</xsl:text>
			</xsl:attribute>
			<xsl:attribute name="dest">
			    <xsl:text>test/</xsl:text>
			    <xsl:value-of select="name()"/>
			    <xsl:text>s/</xsl:text>
			    <xsl:value-of select="@name"/>
			    <xsl:text>_${build.version}.${build.number}</xsl:text>
			</xsl:attribute>
		    </unjar>
		</xsl:for-each>

		<!-- Run the tests -->
		<chmod perm="+x" file="test/eclipse"/>
		<exec executable="${{basedir}}/test/eclipse" dir="test">
		    <arg line="-nosplash"/>
		    <arg line="-application org.eclipse.ant.core.antRunner"/>
		    <arg line="-buildfile plugins/org.eclipse.cdt.core.tests_${{build.version}}.${{build.number}}/test.xml"/>
		    <arg line="-Dorg.eclipse.test=org.eclipse.test_2.1.0"/>
		    <arg line="-Declipse-home=${{basedir}}/test"/>
		    <arg line="-Dos=linux -Dws=gtk -Darch=x86"/>
		</exec>

	        <!-- Create the reports -->
		<delete dir="logs"/>
	        <xslt in="test/org.eclipse.cdt.core.tests.xml"
	            out="logs/${{build.version}}.${{build.number}}/org.eclipse.cdt.core.tests.html"
		    style="junit.xsl"/>

	        <!-- Add our version to site.xml -->
		<tstamp>
		    <format property="build.date" pattern="EEE MMM d HH:mm:ss z yyyy"/>
		</tstamp>
		<xslt in="site.xml" out="s" style="site.xsl">
		    <param name="version" expression="${{build.version}}.${{build.number}}"/>
		    <param name="date" expression="${{build.date}}"/>
		</xslt>
		<move file="s" tofile="site.xml"/>

	        <!-- Generate the site home page -->
		<xslt in="site.xml" out="index.html" style="index.xsl"/>

	    </target>

	    <target name="upload">
		<!-- Upload the update site -->
		<ftp server="${{build.server}}"
		    userid="${{build.userid}}" password="${{build.password}}"
		    remotedir="${{build.remotedir}}" action="put" passive="no">
		    <fileset dir=".">
		        <include name="plugins/*.jar"/>
			<include name="features/*.jar"/>
			<include name="dist/*.zip"/>
		        <include name="logs/**/*.html"/>
			<include name="build.number"/>
			<include name="index.html"/>
			<include name="site.xml"/>
		    </fileset>
		</ftp>
	    </target>

	    <target name="mail">
	        <mail from="dschaefe@ca.ibm.com"
		    tolist="cdt-test-dev@eclipse.org"
		    subject="CDT Build ${{build.version}}.${{build.number}} completed"
		    message="This has been an automated message"/>
	    </target>

	    <target name="all" depends="build,upload,mail"/>
	</project>
    </xsl:template>

</xsl:transform>

Back to the top