appveyor.bat 1.42 KB
Newer Older
1 2
setlocal

3
IF %platform%==MinGW GOTO build_mingw
4 5 6
IF %language%==cpp GOTO build_cpp
IF %language%==csharp GOTO build_csharp

7
echo Unsupported language %language% and platform %platform%. Exiting.
8 9
goto :error

10 11 12 13 14 15 16 17 18 19 20
:build_mingw
echo Building MinGW
set PATH=C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH:C:\Program Files\Git\usr\bin;=%
mkdir build_mingw
cd build_mingw
cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=0 ../cmake
mingw32-make -j8 all || goto error
rem cd %configuration%
rem tests.exe || goto error
goto :EOF

21 22 23 24
:build_cpp
echo Building C++
mkdir build_msvc
cd build_msvc
25
cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% ../cmake
26 27 28 29 30 31 32 33
msbuild protobuf.sln /p:Platform=%vcplatform% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || goto error
cd %configuration%
tests.exe || goto error
goto :EOF

:build_csharp
echo Building C#
cd csharp\src
34 35 36
REM The platform environment variable is implicitly used by msbuild;
REM we don't want it.
set platform=
37
dotnet restore
38
dotnet build -c %configuration% || goto error
39 40

echo Testing C#
41
dotnet test -c %configuration% -f netcoreapp2.1 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
42
dotnet test -c %configuration% -f net451 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
43

44 45 46 47
goto :EOF

:error
echo Failed!
48
EXIT /b %ERRORLEVEL%