build C tests and protoc artifacts on windows with cmake
diff --git a/tools/run_tests/artifacts/artifact_targets.py b/tools/run_tests/artifacts/artifact_targets.py
index 841bbdf..bd18626 100644
--- a/tools/run_tests/artifacts/artifact_targets.py
+++ b/tools/run_tests/artifacts/artifact_targets.py
@@ -328,12 +328,10 @@
environ=environ,
use_workspace=True)
else:
- generator = 'Visual Studio 12 Win64' if self.arch == 'x64' else 'Visual Studio 12'
- vcplatform = 'x64' if self.arch == 'x64' else 'Win32'
+ generator = 'Visual Studio 14 2015 Win64' if self.arch == 'x64' else 'Visual Studio 14 2015'
return create_jobspec(self.name,
['tools\\run_tests\\artifacts\\build_artifact_protoc.bat'],
- environ={'generator': generator,
- 'Platform': vcplatform},
+ environ={'generator': generator},
use_workspace=True)
def __str__(self):
diff --git a/tools/run_tests/artifacts/build_artifact_protoc.bat b/tools/run_tests/artifacts/build_artifact_protoc.bat
index f3598fb..f38a65f 100644
--- a/tools/run_tests/artifacts/build_artifact_protoc.bat
+++ b/tools/run_tests/artifacts/build_artifact_protoc.bat
@@ -22,10 +22,8 @@
cmake -G "%generator%" -Dprotobuf_BUILD_TESTS=OFF ../.. || goto :error
endlocal
-call vsprojects/build_plugins.bat || goto :error
-
-xcopy /Y third_party\protobuf\cmake\build\solution\Release\protoc.exe %ARTIFACTS_OUT%\ || goto :error
-xcopy /Y vsprojects\Release\*_plugin.exe %ARTIFACTS_OUT%\ || xcopy /Y vsprojects\x64\Release\*_plugin.exe %ARTIFACTS_OUT%\ || goto :error
+xcopy /Y cmake\build\third_party\protobuf\Release\protoc.exe %ARTIFACTS_OUT%\ || goto :error
+xcopy /Y cmake\build\Release\*_plugin.exe %ARTIFACTS_OUT%\ || goto :error
goto :EOF
diff --git a/tools/run_tests/helper_scripts/pre_build_c.bat b/tools/run_tests/helper_scripts/pre_build_c.bat
deleted file mode 100644
index 4eec024..0000000
--- a/tools/run_tests/helper_scripts/pre_build_c.bat
+++ /dev/null
@@ -1,35 +0,0 @@
-@rem Copyright 2016 gRPC authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem 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.
-
-@rem Performs nuget restore step for C/C++.
-
-setlocal
-
-@rem enter repo root
-cd /d %~dp0\..\..\..
-
-@rem Location of nuget.exe
-set NUGET=C:\nuget\nuget.exe
-
-if exist %NUGET% (
- %NUGET% restore vsprojects/grpc.sln || goto :error
-)
-
-endlocal
-
-goto :EOF
-
-:error
-echo Failed!
-exit /b %errorlevel%
diff --git a/tools/run_tests/helper_scripts/pre_build_cmake.bat b/tools/run_tests/helper_scripts/pre_build_cmake.bat
index e4bed8c..a770aa8 100644
--- a/tools/run_tests/helper_scripts/pre_build_cmake.bat
+++ b/tools/run_tests/helper_scripts/pre_build_cmake.bat
@@ -14,6 +14,8 @@
setlocal
+set ARCHITECTURE=%1
+
cd /d %~dp0\..\..\..
mkdir cmake
@@ -25,7 +27,7 @@
@rem If yasm is not on the path, use hardcoded path instead.
yasm --version || set USE_HARDCODED_YASM_PATH_MAYBE=-DCMAKE_ASM_NASM_COMPILER="C:/Program Files (x86)/yasm/yasm.exe"
-cmake -G "Visual Studio 14 2015" -DgRPC_BUILD_TESTS=ON %USE_HARDCODED_YASM_PATH_MAYBE% ../.. || goto :error
+cmake -G "Visual Studio 14 2015" -A %ARCHITECTURE% -DgRPC_BUILD_TESTS=ON %USE_HARDCODED_YASM_PATH_MAYBE% ../.. || goto :error
endlocal
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index e8a4be3..d874b2a 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -234,15 +234,17 @@
def configure(self, config, args):
self.config = config
self.args = args
- if self.args.compiler == 'cmake':
+ if self.platform == 'windows':
+ _check_compiler(self.args.compiler, ['default', 'cmake'])
+ _check_arch(self.args.arch, ['default', 'x64', 'x86'])
+ self._cmake_arch_option = 'x64' if self.args.arch == 'x64' else 'Win32'
+ self._use_cmake = True
+ self._make_options = []
+ elif self.args.compiler == 'cmake':
_check_arch(self.args.arch, ['default'])
self._use_cmake = True
self._docker_distro = 'jessie'
self._make_options = []
- elif self.platform == 'windows':
- self._use_cmake = False
- self._make_options = [_windows_toolset_option(self.args.compiler),
- _windows_arch_option(self.args.arch)]
else:
self._use_cmake = False
self._docker_distro, self._make_options = self._compiler_options(self.args.use_docker,
@@ -303,13 +305,7 @@
if self.args.iomgr_platform in target.get('exclude_iomgrs', []):
continue
if self.platform == 'windows':
- if self._use_cmake:
- binary = 'cmake/build/%s/%s.exe' % (_MSBUILD_CONFIG[self.config.build_config], target['name'])
- else:
- binary = 'vsprojects/%s%s/%s.exe' % (
- 'x64/' if self.args.arch == 'x64' else '',
- _MSBUILD_CONFIG[self.config.build_config],
- target['name'])
+ binary = 'cmake/build/%s/%s.exe' % (_MSBUILD_CONFIG[self.config.build_config], target['name'])
else:
if self._use_cmake:
binary = 'cmake/build/%s' % target['name']
@@ -370,16 +366,12 @@
return self._make_options;
def pre_build_steps(self):
- if self._use_cmake:
- if self.platform == 'windows':
- return [['tools\\run_tests\\helper_scripts\\pre_build_cmake.bat']]
- else:
- return [['tools/run_tests/helper_scripts/pre_build_cmake.sh']]
+ if self.platform == 'windows':
+ return [['tools\\run_tests\\helper_scripts\\pre_build_cmake.bat', self._cmake_arch_option]]
+ elif self._use_cmake:
+ return [['tools/run_tests/helper_scripts/pre_build_cmake.sh']]
else:
- if self.platform == 'windows':
- return [['tools\\run_tests\\helper_scripts\\pre_build_c.bat']]
- else:
- return []
+ return []
def build_steps(self):
return []
@@ -1111,30 +1103,6 @@
sys.exit(1)
-def _windows_build_bat(compiler):
- """Returns name of build.bat for selected compiler."""
- # For CoreCLR, fall back to the default compiler for C core
- if compiler == 'default' or compiler == 'vs2013':
- return 'vsprojects\\build_vs2013.bat'
- elif compiler == 'vs2015':
- return 'vsprojects\\build_vs2015.bat'
- else:
- print('Compiler %s not supported.' % compiler)
- sys.exit(1)
-
-
-def _windows_toolset_option(compiler):
- """Returns msbuild PlatformToolset for selected compiler."""
- # For CoreCLR, fall back to the default compiler for C core
- if compiler == 'default' or compiler == 'vs2013' or compiler == 'coreclr':
- return '/p:PlatformToolset=v120'
- elif compiler == 'vs2015':
- return '/p:PlatformToolset=v140'
- else:
- print('Compiler %s not supported.' % compiler)
- sys.exit(1)
-
-
def _docker_arch_suffix(arch):
"""Returns suffix to dockerfile dir to use."""
if arch == 'default' or arch == 'x64':
@@ -1233,7 +1201,6 @@
choices=['default',
'gcc4.4', 'gcc4.6', 'gcc4.8', 'gcc4.9', 'gcc5.3', 'gcc_musl',
'clang3.4', 'clang3.5', 'clang3.6', 'clang3.7',
- 'vs2013', 'vs2015',
'python2.7', 'python3.4', 'python3.5', 'python3.6', 'pypy', 'pypy3', 'python_alpine',
'node0.12', 'node4', 'node5', 'node6', 'node7', 'node8',
'electron1.3', 'electron1.6',
diff --git a/vsprojects/build_plugins.bat b/vsprojects/build_plugins.bat
deleted file mode 100644
index 85a3b78..0000000
--- a/vsprojects/build_plugins.bat
+++ /dev/null
@@ -1,37 +0,0 @@
-@rem Copyright 2016 gRPC authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem 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.
-
-@rem Convenience script to build gRPC protoc plugins from command line. protoc plugins are used to generate service stub code from .proto service defintions.
-
-setlocal
-
-@rem enter this directory
-cd /d %~dp0
-
-@rem Set VS variables (uses Visual Studio 2013)
-@call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" x86
-
-@rem Build third_party/protobuf
-msbuild ..\third_party\protobuf\cmake\build\solution\protobuf.sln /p:Configuration=Release || goto :error
-
-@rem Build the C# protoc plugins
-msbuild grpc_protoc_plugins.sln /p:Configuration=Release || goto :error
-
-endlocal
-
-goto :EOF
-
-:error
-echo Failed!
-exit /b %errorlevel%