Added Windows build batch script. This adds a script that will be run on the ASF CI, similar to how the `docker_build.sh` script is used for the existing Linux-based CI.
This Jenkins job for Mesos on Windows can be found here: https://builds.apache.org/job/Mesos-Windows/ Review: https://reviews.apache.org/r/49926/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/285c04a1 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/285c04a1 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/285c04a1 Branch: refs/heads/master Commit: 285c04a110b69ccc5454ff867d7daea4f1dd3067 Parents: d7269f7 Author: Joseph Wu <jos...@mesosphere.io> Authored: Mon Jul 25 17:38:25 2016 -0700 Committer: Joseph Wu <josep...@apache.org> Committed: Mon Jul 25 17:38:25 2016 -0700 ---------------------------------------------------------------------- support/windows-build.bat | 95 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/285c04a1/support/windows-build.bat ---------------------------------------------------------------------- diff --git a/support/windows-build.bat b/support/windows-build.bat new file mode 100644 index 0000000..4603a2b --- /dev/null +++ b/support/windows-build.bat @@ -0,0 +1,95 @@ +REM Licensed to the Apache Software Foundation (ASF) under one +REM or more contributor license agreements. See the NOTICE file +REM distributed with this work for additional information +REM regarding copyright ownership. The ASF licenses this file +REM to you under the Apache License, Version 2.0 (the +REM "License"); you may not use this file except in compliance +REM with the License. You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, software +REM distributed under the License is distributed on an "AS IS" BASIS, +REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +REM See the License for the specific language governing permissions and +REM limitations under the License. + +@echo on + +REM NOTE: Before you run this script, you must have the Visual Studio +REM environment variables set up. Visual Studio provides a script to do +REM this at `/path/to/Visual Studio 14/VC/vcvarsall.bat`. + +REM NOTE: Batch doesn't have any way of exiting upon failing a command. +REM The best we can do is add this line after every command that matters: +REM if %errorlevel% neq 0 exit /b %errorlevel% + +REM NOTE: In order to run the tests, your Windows volume must have a +REM folder named `tmp` at the top level. You can create it like this: +REM MKDIR %CD:~0,3%tmp + +REM Make sure that we are in the right directory. We do this by checking that +REM the `support` folder exists in the current directory and is not a symlink. +REM This code is awkwardly split across two conditionals because batch scripts +REM do not support logical operators like `&&`. +if not exist support ( + goto not_in_root +) + +fsutil reparsepoint query "support" | find "Symbolic Link" >nul && ( + goto not_in_root +) + +REM Create a build directory. +MKDIR build +CD build +if %errorlevel% neq 0 exit /b %errorlevel% + +REM Generate the Visual Studio solution. +REM You can pass in other flags by setting `OTHER_CMAKE_OPTIONS` before +REM calling the script. For example, the ASF CI will add `-DPATCHEXE_PATH=...` +REM because the path to GNU Patch is not the default. +cmake .. -G "Visual Studio 14 2015 Win64" -DENABLE_LIBEVENT=1 %OTHER_CMAKE_OPTIONS% +if %errorlevel% neq 0 exit /b %errorlevel% + +REM NOTE: We pass in the build option `/p:PreferredToolArchitecture=x64` +REM to force Visual Studio to use the native toolchain, which is (infinitely?) +REM faster than the default cross-compiler. + +REM NOTE: The build option `/m` tells Visual Studio to build projects in +REM parallel if possible. + +REM NOTE: Specifying a build "target" is done via the build option `/t`. +REM Multiple targets can be specified with semi-comma separation. + +REM Build and run the stout tests. +msbuild Mesos.sln /p:PreferredToolArchitecture=x64 /m /t:stout_tests +if %errorlevel% neq 0 exit /b %errorlevel% + +REM TODO(josephw): Uncomment this after fixing the tests on Windows. +REM "3rdparty/stout/tests/Debug/stout_tests.exe" +REM if %errorlevel% neq 0 exit /b %errorlevel% + +REM Build and run the libprocess tests. +msbuild Mesos.sln /p:PreferredToolArchitecture=x64 /m /t:process_tests +if %errorlevel% neq 0 exit /b %errorlevel% + +REM TODO(josephw): Uncomment this after fixing the tests on Windows. +REM "3rdparty/libprocess/src/tests/Debug/process_tests.exe" +REM if %errorlevel% neq 0 exit /b %errorlevel% + +REM Build everything else. +msbuild Mesos.sln /p:PreferredToolArchitecture=x64 /m +if %errorlevel% neq 0 exit /b %errorlevel% + +REM TODO(josephw): Run mesos tests. + +goto :eof + +REM If we are not in the root directory, print error and exit. +:not_in_root +echo. 1>&2 +echo You must run windows-build from the root of the distribution. 1>&2 +echo. 1>&2 + +exit /b 1