Skip to main content
summaryrefslogtreecommitdiffstats
blob: ebc4c728a96d5382e50ba5448fb6ab8d5570b476 (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
<%!
/*  Copyright 2008 IBM Corp.  All rights reserved.  This source code is made available under the terms of the Eclipse Public License, v1.0. */
%>
<project name="Build specific targets and properties" default="noDefault" basedir=".">

<!-- ===================================================================== -->
<!-- Run a given ${target} on all elements being built -->
<!-- ===================================================================== -->
<target name="allElements">
	<ant antfile="${genericTargets}" target="${target}" >
		<property name="type" value="feature" />
		<property name="id" value="org.eclipse.<c:get select="$build/@projectNamespace"/>.tests" />
	</ant>
</target>

<!-- ===================================================================== -->
<!-- Targets to assemble the built elements for particular configurations  -->
<!-- These generally call the generated assemble scripts (named in -->
<!-- ${assembleScriptName}) but may also add pre and post processing -->
<!-- Add one target for each root element and each configuration -->
<!-- ===================================================================== -->

<target name="assemble.org.eclipse.<c:get select="$build/@projectNamespace"/>.tests">
	<property name="archiveName" value="<c:get select="$build/@parentProjectName"/>-${subprojectName}-junit-tests-${buildAlias}.zip"/>
	<ant antfile="${assembleScriptName}"/>
<!-- ADD POST STEPS -->
</target>

<!-- ===================================================================== -->
<!-- Check out map files from correct repository -->
<!-- Replace values for cvsRoot, package and mapVersionTag as desired. -->
<!-- ===================================================================== -->
<target name="checkLocal">
	<available property="mapsLocal" file="${buildDirectory}/maps" />
</target>

<target name="getMapFiles" depends="checkLocal" unless="mapsLocal">

	<!-- ***  change the repo info -->
	<property name="mapCvsRoot" value=":${cvsReadProtocol}:${cvsReadUser}@${cvsHost}:${cvsRep}" />
	<property name="mapVersionTag" value="HEAD" />
	<property name="packagePath" value="org.eclipse.${projectName}/org.eclipse.${subprojectName2}.releng/maps"/>

	<cvs cvsRsh="ssh" cvsRoot="${mapCvsRoot}" tag="${mapVersionTag}" 
		package="${packagePath}" dest="${buildDirectory}/maps" />
	<copy todir="${buildDirectory}/maps/CVS" overwrite="true">
		<fileset dir="${buildDirectory}/maps/${packagePath}/CVS" />
	</copy>
	<copy todir="${buildDirectory}/maps" overwrite="true">
		<fileset dir="${buildDirectory}/maps/${packagePath}" />
	</copy>
	<delete dir="${buildDirectory}/maps/org.eclipse.${projectName}" />

	<!--tag the map files project-->
	<antcall target="tagMapFiles" />
</target>

<target name="tagMapFiles" if="tagMaps">
	<cvs dest="${buildDirectory}/maps/org.eclipse.${subprojectName2}" command="tag v${timestamp}" />
</target>

<!-- ===================================================================== -->
<!-- Steps to do before setup -->
<!-- ===================================================================== -->
<target name="preSetup">
</target>

<!-- ===================================================================== -->
<!-- Steps to do after setup but before starting the build proper -->
<!-- ===================================================================== -->
<target name="postSetup">
</target>

<!-- ===================================================================== -->
<!-- Steps to do before fetching the build elements -->
<!-- ===================================================================== -->
<target name="preFetch">
</target>

<!-- ===================================================================== -->
<!-- Steps to do after the fetch -->
<!-- ===================================================================== -->
<target name="postFetch">
	<replace dir="${buildDirectory}/plugins" value="${timestamp}" token="@buildid@">
		<include name="**/about.mappings" />
	</replace>
</target>

<!-- ===================================================================== -->
<!-- Steps to do before generating build scripts -->
<!-- ===================================================================== -->
<target name="preGenerate">
</target>

<!-- ===================================================================== -->
<!-- Steps to do after generating the build scripts -->
<!-- ===================================================================== -->
<target name="postGenerate">
	<antcall target="clean" />
</target>

<!-- ===================================================================== -->
<!-- Steps to do before assembling -->
<!-- ===================================================================== -->
<target name="preAssemble">
</target>

<!-- ===================================================================== -->
<!-- Steps to do after assembling-->
<!-- ===================================================================== -->
<target name="postAssemble">
</target>

<!-- ===================================================================== -->
<!-- Steps to do before running the build.xmls for the elements being built. -->
<!-- ===================================================================== -->
<target name="preProcess">
	<replace dir="${buildDirectory}/plugins" value="${timestamp}" token="@build@">
		<include name="**/about.mappings" />
	</replace>
</target>

<!-- ===================================================================== -->
<!-- Steps to do after running the build.xmls for the elements being built. -->
<!-- ===================================================================== -->
<target name="postProcess">
	<condition property="logsAvailable">
		<istrue value="${javacVerbose}"/> 
	</condition>
	<antcall target="gatherLogs" />
</target>

<!-- ===================================================================== -->
<!-- Steps to do after everything is built and assembled -->
<!-- (e.g., testing, posting, emailing, ...) -->
<!-- ===================================================================== -->
<target name="postBuild">
	<antcall target="packageTestFramework" />	
</target>

<!-- ===================================================================== -->
<!-- Helper targets -->
<!-- ===================================================================== -->
<target name="gatherLogs" if="logsAvailable">
	<mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
	<antcall target="allElements">
		<param name="target" value="gatherLogs" />
	</antcall>

	<unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
		<fileset dir="${buildDirectory}/features/org.eclipse.<c:get select="$build/@projectNamespace"/>.tests">
			<include name="*.log.zip" />
		</fileset>
	</unzip>
</target>

<target name="clean" unless="noclean">
	<antcall target="allElements">
		<param name="target" value="cleanElement" />
	</antcall>
</target>

<target name="packageTestFramework">
	<!--package automated test framework used in <c:get select="$build/@parentProjectName"/>-${subprojectName} builds-->

	<property name="workingDirectory" value="${buildDirectory}/test.assembly" />
	<echo message="workingDirectory:  ${workingDirectory}"/>

	<!--unzip the junit tests-->
    <mkdir dir="${workingDirectory}/eclipse" />
	<unzip dest="${workingDirectory}" overwrite="true">
		<fileset dir="${buildDirectory}/${buildLabel}"><include name="**/<c:get select="$build/@parentProjectName"/>-${subprojectName}-junit-tests*.zip"/></fileset>
	</unzip>
	
	<!-- create top level testing directory-->    
	<delete dir="${workingDirectory}/testing"/>
    <mkdir dir="${workingDirectory}/testing" />
	
	<!--compile the tool used to generate the test.properties file, then run it.-->
	<!--test.properties maps test plugin id's to the name of the plugin directory-->
    
    <!--eclipse.home is relative to the scripts directory in the org.eclipse.pde.build plugin.  Assume the plugins used in the classpath are in the same directory as org.eclipse.pde.build-->
    <property name="eclipse.home" value="../../.." />

    <generateTestProperties 
            buildDirectory="${buildDirectory}" 
            featureId="org.eclipse.<c:get select="$build/@projectNamespace"/>.tests" 
            outputFile="${workingDirectory}/testing/test.properties" 
    /> 

	<!--load the property file created with the directory names for all test plugins-->
	<property file="${workingDirectory}/testing/test.properties" />

	<!-- Remove the plugin version number appended to the org.eclipse.test plugin directory.
   	     This is so that contributors of test.xml's do not have to update their paths to 
   	     library.xml in org.eclipse.test whenever its version is updated.
   	 -->
   	<move todir="${workingDirectory}/eclipse/plugins/org.eclipse.test">
    		<fileset dir="${workingDirectory}/eclipse/plugins/${org.eclipse.test}" />
  	</move>
  	
  	<!--the Ant move task leaves behind an empty directory-->
  	<delete dir="${workingDirectory}/eclipse/plugins/${org.eclipse.test}" includeEmptyDirs="true" />
	
 	<!-- rezip the JUnit plugin tests -->
	<zip destfile="${workingDirectory}/testing/<c:get select="$build/@parentProjectName"/>-${subprojectName}-junit-tests-${buildAlias}.zip">
		 <zipfileset dir="${workingDirectory}/eclipse" prefix="eclipse"/>
	</zip>
 	
 	<!--Copy scripts and doc used in the automated testing to the testing directory-->
    <copy todir="${workingDirectory}/testing">
     	<fileset dir="${buildDirectory}/plugins/org.eclipse.test" includes="testframework.html,JUNIT.XSL" />
    </copy>
    <copy todir="${workingDirectory}/testing">
     	<fileset dir="${builderDirectory}/scripts" />
    </copy>

	<!--copy in the file containing the URL of the Eclipse build used for testing-->
    <copy todir="${workingDirectory}/testing" file="${buildDirectory}/../build.cfg" />

	<!--create zip file of the automated testing framework-->	
	<zip destfile="${buildDirectory}/${buildLabel}/<c:get select="$build/@parentProjectName"/>-${subprojectName}-automated-tests-${buildAlias}.zip">
		 <zipfileset dir="${workingDirectory}/testing" prefix="testing"/>
	</zip>

	<delete file="${buildDirectory}/${buildLabel}/<c:get select="$build/@parentProjectName"/>-${subprojectName}-junit-tests-${buildAlias}.zip"  />
</target>

<!-- ===================================================================== -->
<!-- Default target                                                        -->
<!-- ===================================================================== -->
<target name="noDefault">
	<echo message="You must specify a target when invoking this file" />
</target>

</project>

Back to the top