forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor-build.cmd
344 lines (278 loc) · 10.5 KB
/
appveyor-build.cmd
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
@echo off
:ARGUMENTS_VALIDATION
if /I "%1" == "/help" (goto :USAGE)
if /I "%1" == "/h" (goto :USAGE)
if /I "%1" == "/?" (goto :USAGE)
goto :ARGUMENTS_OK
:USAGE
echo Build and run a subset of test suites
echo.
echo Usage:
echo.
echo appveyor-build.cmd ^<all^|net40^|portable47^|portable7^|portable78^|portable259^|vs^|cambridge_suite^|qa_suite^|smoke^|smoke_only^>
echo.
echo No arguments default to 'smoke' ( build all profiles, run all unit tests, cambridge Smoke, fsharpqa Smoke)
echo.
echo To specify multiple values, separate strings by comma
echo.
echo The example below run portable47, vs and qa:
echo.
echo appveyor-build.cmd portable47,vs,qa_suite
exit /b 1
:ARGUMENTS_OK
set DO_NET40=0
set DO_PORTABLE47=0
set DO_PORTABLE7=0
set DO_PORTABLE78=0
set DO_PORTABLE259=0
set DO_VS=0
set TEST_NET40=0
set TEST_PORTABLE47=0
set TEST_PORTABLE7=0
set TEST_PORTABLE78=0
set TEST_PORTABLE259=0
set TEST_VS=0
set TEST_CAMBRIDGE_SUITE=0
set CONF_CAMBRIDGE_SUITE=
set TEST_QA_SUITE=0
set CONF_QA_SUITE=
setlocal enableDelayedExpansion
set /a counter=0
for /l %%x in (1 1 9) do (
set /a counter=!counter!+1
call :SET_CONFIG %%!counter! "!counter!"
)
setlocal disableDelayedExpansion
echo.
echo.
goto :MAIN
:SET_CONFIG
set BUILD_PROFILE=%~1
if "%BUILD_PROFILE%" == "1" if "%2" == "" (
set BUILD_PROFILE=smoke
)
if "%2" == "" if not "%BUILD_PROFILE%" == "smoke" goto :EOF
echo Parse argument %BUILD_PROFILE%
if /i '%BUILD_PROFILE%' == 'net40' (
set DO_NET40=1
set TEST_NET40=1
)
if /i '%BUILD_PROFILE%' == 'portable47' (
set DO_PORTABLE47=1
set TEST_PORTABLE47=1
)
if /i '%BUILD_PROFILE%' == 'portable7' (
set DO_PORTABLE7=1
set TEST_PORTABLE7=1
)
if /i '%BUILD_PROFILE%' == 'portable78' (
set DO_PORTABLE78=1
set TEST_PORTABLE78=1
)
if /i '%BUILD_PROFILE%' == 'portable259' (
set DO_PORTABLE259=1
set TEST_PORTABLE259=1
)
if /i '%BUILD_PROFILE%' == 'vs' (
set DO_VS=1
set TEST_VS=1
)
if /i '%BUILD_PROFILE%' == 'cambridge_suite' (
set DO_NET40=1
set TEST_CAMBRIDGE_SUITE=1
)
if /i '%BUILD_PROFILE%' == 'qa_suite' (
set DO_NET40=1
set TEST_QA_SUITE=1
)
if /i '%BUILD_PROFILE%' == 'all' (
set DO_NET40=1
set DO_PORTABLE47=1
set DO_PORTABLE7=1
set DO_PORTABLE78=1
set DO_PORTABLE259=1
set DO_VS=1
set TEST_NET40=1
set TEST_PORTABLE47=1
set TEST_PORTABLE7=1
set TEST_PORTABLE78=1
set TEST_PORTABLE259=1
set TEST_VS=1
set TEST_CAMBRIDGE_SUITE=1
set TEST_QA_SUITE=1
)
if /i '%BUILD_PROFILE%' == 'smoke' (
set DO_NET40=1
set DO_PORTABLE47=1
set DO_PORTABLE7=1
set DO_PORTABLE78=1
set DO_PORTABLE259=1
set DO_VS=1
set TEST_NET40=1
set TEST_PORTABLE47=1
set TEST_PORTABLE7=1
set TEST_PORTABLE78=1
set TEST_PORTABLE259=1
set TEST_VS=1
set TEST_CAMBRIDGE_SUITE=1
set CONF_CAMBRIDGE_SUITE=Smoke
set TEST_QA_SUITE=1
set CONF_QA_SUITE=Smoke
)
if /i '%BUILD_PROFILE%' == 'smoke_only' (
set CONF_CAMBRIDGE_SUITE=Smoke
set CONF_QA_SUITE=Smoke
)
goto :EOF
:MAIN
REM after this point, BUILD_PROFILE variable should not be used, use only DO_* or TEST_*
echo Build/Tests configuration:
echo.
echo DO_NET40=%DO_NET40%
echo DO_PORTABLE47=%DO_PORTABLE47%
echo DO_PORTABLE7=%DO_PORTABLE7%
echo DO_PORTABLE78=%DO_PORTABLE78%
echo DO_PORTABLE259=%DO_PORTABLE259%
echo DO_VS=%DO_VS%
echo.
echo TEST_NET40=%TEST_NET40%
echo TEST_PORTABLE47=%TEST_PORTABLE47%
echo TEST_PORTABLE7=%TEST_PORTABLE7%
echo TEST_PORTABLE78=%TEST_PORTABLE78%
echo TEST_PORTABLE259=%TEST_PORTABLE259%
echo TEST_VS=%TEST_VS%
echo TEST_CAMBRIDGE_SUITE=%TEST_CAMBRIDGE_SUITE%
echo CONF_CAMBRIDGE_SUITE=%CONF_CAMBRIDGE_SUITE%
echo TEST_QA_SUITE=%TEST_QA_SUITE%
echo CONF_QA_SUITE=%CONF_QA_SUITE%
echo.
@echo on
set APPVEYOR_CI=1
:: Check prerequisites
if not '%VisualStudioVersion%' == '' goto vsversionset
if exist "%VS140COMNTOOLS%..\ide\devenv.exe" set VisualStudioVersion=14.0
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe" set VisualStudioVersion=14.0
if exist "%ProgramFiles%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe" set VisualStudioVersion=14.0
if not '%VisualStudioVersion%' == '' goto vsversionset
if exist "%VS120COMNTOOLS%..\ide\devenv.exe" set VisualStudioVersion=12.0
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe" set VisualStudioVersion=12.0
if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe" set VisualStudioVersion=12.0
:vsversionset
if '%VisualStudioVersion%' == '' echo Error: Could not find an installation of Visual Studio && goto :failure
if exist "%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe" set _msbuildexe="%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
if exist "%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe" set _msbuildexe="%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. && goto :failure
:: See <http://www.appveyor.com/docs/environment-variables>
if defined APPVEYOR (
rem See <http://www.appveyor.com/docs/build-phase>
if exist "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" (
rem HACK HACK HACK
set _msbuildexe=%_msbuildexe% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
)
)
set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure
.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config
@if ERRORLEVEL 1 echo Error: Nuget restore failed && goto :failure
:: Build
%_msbuildexe% src\fsharp-proto-build.proj
@if ERRORLEVEL 1 echo Error: compiler proto build failed && goto :failure
%_ngenexe% install Proto\net40\bin\fsc-proto.exe
@if ERRORLEVEL 1 echo Error: NGen of proto failed && goto :failure
%_msbuildexe% src/fsharp-library-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library build failed && goto :failure
%_msbuildexe% src/fsharp-compiler-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: compiler build failed && goto :failure
if '%DO_PORTABLE47%' == '1' (
%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable47 build failed && goto :failure
)
if '%DO_PORTABLE7%' == '1' (
%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable7 build failed && goto :failure
)
if '%DO_PORTABLE78%' == '1' (
%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable78 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable78 build failed && goto :failure
)
if '%DO_PORTABLE259%' == '' (
%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable259 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable259 build failed && goto :failure
)
if '%TEST_NET40%' == '1' (
%_msbuildexe% src/fsharp-compiler-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: compiler unittests build failed && goto :failure
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
)
if '%TEST_PORTABLE47%' == '1' (
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable47 && goto :failure
)
if '%TEST_PORTABLE7%' == '1' (
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable7 && goto :failure
)
if '%TEST_PORTABLE78%' == '1' (
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable78 && goto :failure
)
if '%TEST_PORTABLE259%' == '1' (
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable259 && goto :failure
)
if '%DO_VS%' == '1' (
%_msbuildexe% vsintegration\fsharp-vsintegration-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: VS integration build failed && goto :failure
)
if '%TEST_VS%' == '1' (
%_msbuildexe% vsintegration\fsharp-vsintegration-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: VS integration unit tests build failed && goto :failure
)
@echo on
call src\update.cmd release -ngen
call vsintegration\update-vsintegration.cmd release
pushd tests
@echo on
call BuildTestTools.cmd release
@if ERRORLEVEL 1 echo Error: 'BuildTestTools.cmd release' failed && goto :failure
@echo on
if '%TEST_CAMBRIDGE_SUITE%' == '1' (
set FSHARP_TEST_SUITE_USE_NUNIT_RUNNER=true
%_msbuildexe% fsharp\fsharp.tests.fsproj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: fsharp cambridge tests for nunit failed && goto :failure
call RunTests.cmd release fsharp %CONF_CAMBRIDGE_SUITE%
@if ERRORLEVEL 1 type testresults\fsharp_failures.log && echo Error: 'RunTests.cmd release fsharp %CONF_CAMBRIDGE_SUITE%' failed && goto :failure
set FSHARP_TEST_SUITE_USE_NUNIT_RUNNER=
)
if '%TEST_QA_SUITE%' == '1' (
call RunTests.cmd release fsharpqa %CONF_QA_SUITE%
@if ERRORLEVEL 1 type testresults\fsharpqa_failures.log && echo Error: 'RunTests.cmd release fsharpqa %CONF_QA_SUITE%' failed && goto :failure
)
if '%TEST_NET40%' == '1' (
call RunTests.cmd release compilerunit
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release compilerunit' failed && goto :failure
call RunTests.cmd release coreunit
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunit' failed && goto :failure
)
if '%TEST_PORTABLE47%' == '1' (
call RunTests.cmd release coreunitportable47
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunitportable47' failed && goto :failure
)
if '%TEST_PORTABLE7%' == '1' (
call RunTests.cmd release coreunitportable7
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunitportable7' failed && goto :failure
)
if '%TEST_PORTABLE78%' == '1' (
call RunTests.cmd release coreunitportable78
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunitportable78' failed && goto :failure
)
if '%TEST_PORTABLE259%' == '1' (
call RunTests.cmd release coreunitportable259
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunitportable259' failed && goto :failure
)
rem tests for TEST_VS are not executed
popd
goto :eof
:failure
exit /b 1