Skip to main content
summaryrefslogtreecommitdiffstats
blob: eed5164fa432a50170dfd845c0b180075bfbafdf (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
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 
Copyright (c) 2010 Cloudsmith Inc, Martin Taal (Doorn, The Netherlands) and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html

Contributors:
  Cloudsmith Inc - build.xml for Buckminster project
   Martin Taal - changes for Texo

Some important parts have been copied from Buckminster's own
build setup:
http://dev.eclipse.org/viewsvn/index.cgi/trunk/org.eclipse.buckminster.releng/build.xml?root=Tools_BUCKMINSTER&view=markup
-->
<project default="run" name="Texo Tests">

	<!--
		Inherited properties:
		toolsPath: path containing buckminster
		buildSitePath: the path to which the p2 site should be copied
		buildZipsPath: the path to the directory with zip files
		
		buckminster.output.root
		buckminster.temp.root
	-->

	<property name="targetPlatformPath" location="${testPath}/tp" />
	<property name="workspacePath" location="${testPath}/workspace" />

	<property name="genTargetPlatformPath" location="${testPath}/gen-tp" />
	<property name="genWorkspacePath" location="${testPath}/gen-workspace" />

	<import file="../ant_common.xml" />

	<target name="run" depends="init.build.properties">
		<echo message="+++++++++++++++++++++++++++++++++++"/>
		<echo message="Test Step" />
		<echo message="+++++++++++++++++++++++++++++++++++"/>

		<antcall target="create.test.workspace" inheritRefs="true" inheritAll="true"/>		
		
		<echo message="-----------------------------------"/>
		<echo message="Building test workspace" />
		<echo message="-----------------------------------"/>
		<buckminster command="build" workspace="${workspacePath}">
			<cmdargs>
				<arg value="--thorough" />
			</cmdargs>		
		</buckminster>
		
		<antcall target="generate.model.code" inheritRefs="true" inheritAll="true"/>
		
		<echo message="-----------------------------------"/>
		<echo message="Building test workspace" />
		<echo message="-----------------------------------"/>
		<buckminster command="build" workspace="${workspacePath}">
			<cmdargs>
				<arg value="--thorough" />
			</cmdargs>		
		</buckminster>

		<echo message="-----------------------------------"/>
		<echo message="Running Texo Tests" />
		<echo message="-----------------------------------"/>
		<buckminster command="junit" workspace="${workspacePath}">
			<cmdargs>
				<arg value="-l" />
				<arg value="org.eclipse.emf.texo.test.all/TexoAllTests.launch" />
				<arg value="-o" />
				<arg value="${testResultsPath}/test-results-texo.xml" />
				<arg value="--stdout" />
				<arg value="${testResultsPath}/stdout.txt" />
				<arg value="--stderr" />
				<arg value="${testResultsPath}/stderr.txt" />
				<arg value="--flatXML"/>
			</cmdargs>
		</buckminster>		
	</target>
	
	<target name="create.test.workspace">
		<echo message="-----------------------------------"/>
		<echo message="Create test workspace" />
		<echo message="-----------------------------------"/>

		<mkdir dir="${targetPlatformPath}" />
		<mkdir dir="${workspacePath}" />
		
		<echo message="Setting jre to ${env.JAVA_HOME}"/>
		<buckminster command="installJRE" workspace="${workspacePath}">
		    <cmdargs>
		       <arg value="--location" />
		       <arg value="${env.JAVA_HOME}" />
		    </cmdargs>
		</buckminster> 

		<echo message="Using workspace ${workspacePath}" />
		<echo message="Setting targetPlatformPath to ${targetPlatformPath}" />
		<buckminster command="setpref" workspace="${workspacePath}">
			<cmdargs>
				<arg value="targetPlatformPath=${targetPlatformPath}" />
			</cmdargs>
		</buckminster>

		<echo message="Importing projects into workspace ${workspacePath}" />
		<echo message="Importing binaries into target platform ${targetPlatformPath}" />
		<buckminster command="import" workspace="${workspacePath}">
			<cmdargs>
				<arg value="${basedir}/texo.mspec" />
			</cmdargs>
		</buckminster>
	</target>
	
	<target name="generate.model.code">
		<echo message="-----------------------------------"/>
		<echo message="Creating model generation workspace" />
		<echo message="-----------------------------------"/>

		<mkdir dir="${genTargetPlatformPath}" />
		<mkdir dir="${genWorkspacePath}" />
		
		<echo message="Delete some to-be generated files"/>
		<delete dir="${gitPath}/tests/org.eclipse.emf.texo.test.model/src-test-gen/org/eclipse/emf/texo/test/model/samples/capa"/>
		<delete dir="${gitPath}/tests/org.eclipse.emf.texo.test.model/src-test-gen/org/eclipse/emf/texo/test/model/samples/employee"/>
		<delete dir="${gitPath}/tests/org.eclipse.emf.texo.test.model/src-test-gen/org/eclipse/emf/texo/test/model/samples/extendedpo2"/>
		<echo message="Copy from src-merge-test to src-test-gen, to test merging during generation"/>
		<copy todir="${gitPath}/tests/org.eclipse.emf.texo.test.model/src-test-gen" flatten="false">
			<fileset dir="${gitPath}/tests/org.eclipse.emf.texo.test.model/src-merge-testing">
				<include name="**/*"/>
			</fileset>
		</copy>
		
		<echo message="Setting jre to ${env.JAVA_HOME}"/>
		<buckminster command="installJRE" workspace="${genWorkspacePath}">
		    <cmdargs>
		       <arg value="--location" />
		       <arg value="${env.JAVA_HOME}" />
		    </cmdargs>
		</buckminster> 

		<echo message="Using workspace ${genWorkspacePath}" />
		<echo message="Setting targetPlatformPath to ${genTargetPlatformPath}" />
		<buckminster command="setpref" workspace="${genWorkspacePath}">
			<cmdargs>
				<arg value="targetPlatformPath=${genTargetPlatformPath}" />
			</cmdargs>
		</buckminster>

		<echo message="Importing projects into workspace ${genWorkspacePath}" />
		<echo message="Importing binaries into target platform ${genTargetPlatformPath}" />
		<buckminster command="import" workspace="${genWorkspacePath}">
			<cmdargs>
				<arg value="${basedir}/texo_generate_test.mspec" />
			</cmdargs>
		</buckminster>
		
		<echo message="Building" />
		<buckminster command="build" workspace="${genWorkspacePath}">
			<cmdargs>
				<arg value="--clean" />
				<arg value="--thorough" />
			</cmdargs>		
		</buckminster>

		<echo message="-----------------------------------"/>
		<echo message="Generating model code using workspace ${genWorkspacePath}" />
		<echo message="-----------------------------------"/>
		<buckminster command="junit" workspace="${genWorkspacePath}">
			<cmdargs>
				<arg value="-l" />
				<arg value="org.eclipse.emf.texo.modelgenerator.test/HudsonModelGeneratorTest.launch" />
				<arg value="-o" />
				<arg value="${testResultsPath}/generate-results-texo-modelgenerator.xml" />
				<arg value="--stdout" />
				<arg value="${testResultsPath}/gen-stdout.txt" />
				<arg value="--stderr" />
				<arg value="${testResultsPath}/gen-stderr.txt" />
				<arg value="--flatXML"/>
			</cmdargs>
		</buckminster>

		<echo message="-----------------------------------"/>
		<echo message="Generating ORMS" />
		<echo message="-----------------------------------"/>
		<buckminster command="junit" workspace="${genWorkspacePath}">
			<cmdargs>
				<arg value="-l" />
				<arg value="org.eclipse.emf.texo.orm.test/HudsonORMGeneratorTest.launch" />
				<arg value="-o" />
				<arg value="${testResultsPath}/generate-results-texo-ormgenerator.xml" />
				<arg value="--stdout" />
				<arg value="${testResultsPath}/gen-stdout.txt" />
				<arg value="--stderr" />
				<arg value="${testResultsPath}/gen-stderr.txt" />
				<arg value="--flatXML"/>
			</cmdargs>
		</buckminster>
	</target>
	
	<target name="init.build.properties">
		<!-- Echo relevant properties to a temporary file so that Buckminster can read them
		  -->
		<tempfile destdir="${java.io.tmpdir}" prefix="build-" suffix=".properties" deleteonexit="true" property="properties.tmp" />
		<echoproperties destfile="${properties.tmp}">
			<!-- We don't want these. basedir in particular will cause problems if passed explicitly -->
			<propertyset negate="true">
				<propertyref name="basedir" />
				<propertyref name="eclipse.home" />
				<propertyref name="properties.tmp" />
				<propertyref name="line.separator" />
				<propertyref name="path.separator" />
				<propertyref prefix="ant." />
				<propertyref prefix="file." />
				<propertyref prefix="java." />
				<propertyref prefix="sun." />
				<propertyref prefix="user." />
			</propertyset>
		</echoproperties>
	</target>

</project>

Back to the top