You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/04/21 02:17:08 UTC

[1/7] mesos git commit: Enabled CSI proto compilation by default.

Repository: mesos
Updated Branches:
  refs/heads/master b95312d44 -> 654e5984f


Enabled CSI proto compilation by default.

CSI proto compilation is disabled due to MESOS-8749, which is resolved
by bumping CSI to v0.2. This patch enables the compilation again.

Review: https://reviews.apache.org/r/66577/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2adbfdcb
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2adbfdcb
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2adbfdcb

Branch: refs/heads/master
Commit: 2adbfdcbda9384ce5d29528a4a94b4b21dfca901
Parents: b95312d
Author: Chun-Hung Hsiao <ch...@apache.org>
Authored: Fri Apr 20 18:17:43 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri Apr 20 18:17:43 2018 -0700

----------------------------------------------------------------------
 src/CMakeLists.txt  |  7 ++++++-
 src/Makefile.am     | 37 +++++++++++++------------------------
 src/slave/flags.cpp |  2 --
 src/slave/slave.cpp |  4 ----
 4 files changed, 19 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2adbfdcb/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 31af9ea..4908cb9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,6 +29,10 @@ set(JAVA_PROTOBUF_SRC "")
 # Build the protobuf structs.
 #
 # NOTE: The following `PROTOC_GENERATE` calls will list append to
+# `PUBLIC_PROTO_PATH`, `PUBLIC_PROTOBUF_INCLUDE_DIR` and `PUBLIC_PROTOBUF_SRC`.
+PROTOC_GENERATE(GRPC LIB csi TARGET csi)
+
+# NOTE: The following `PROTOC_GENERATE` calls will list append to
 # `PUBLIC_PROTOBUF_SRC`.
 PROTOC_GENERATE(TARGET mesos/agent/agent)
 PROTOC_GENERATE(TARGET mesos/allocator/allocator)
@@ -364,7 +368,8 @@ set(RESOURCE_PROVIDER_SRC
   resource_provider/local.cpp
   resource_provider/manager.cpp
   resource_provider/registrar.cpp
-  resource_provider/validation.cpp)
+  resource_provider/validation.cpp
+  resource_provider/storage/disk_profile_adaptor.cpp)
 
 set(SCHEDULER_SRC
   sched/sched.cpp

http://git-wip-us.apache.org/repos/asf/mesos/blob/2adbfdcb/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 9d610bb..e50e43b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -384,7 +384,6 @@ CXX_PROTOS +=								\
   slave/containerizer/mesos/isolators/network/cni/spec.pb.cc		\
   slave/containerizer/mesos/isolators/network/cni/spec.pb.h
 
-if ENABLE_GRPC
 CXX_PROTOS +=								\
   resource_provider/storage/disk_profile.pb.cc				\
   resource_provider/storage/disk_profile.pb.h
@@ -395,6 +394,7 @@ CXX_CSI_PROTOS =							\
   csi/state.pb.cc							\
   csi/state.pb.h
 
+if ENABLE_GRPC
 CXX_CSI_PROTOS +=							\
   ../include/csi/csi.grpc.pb.cc						\
   ../include/csi/csi.grpc.pb.h
@@ -739,6 +739,7 @@ module_HEADERS =							\
   $(top_srcdir)/include/mesos/module/container_logger.hpp		\
   $(top_srcdir)/include/mesos/module/contender.hpp			\
   $(top_srcdir)/include/mesos/module/detector.hpp			\
+  $(top_srcdir)/include/mesos/module/disk_profile_adaptor.hpp		\
   $(top_srcdir)/include/mesos/module/hook.hpp				\
   $(top_srcdir)/include/mesos/module/hook.proto				\
   $(top_srcdir)/include/mesos/module/http_authenticatee.hpp		\
@@ -751,11 +752,6 @@ module_HEADERS =							\
   $(top_srcdir)/include/mesos/module/secret_generator.hpp		\
   $(top_srcdir)/include/mesos/module/secret_resolver.hpp
 
-if ENABLE_GRPC
-module_HEADERS +=							\
-  $(top_srcdir)/include/mesos/module/disk_profile_adaptor.hpp
-endif
-
 nodist_module_HEADERS =							\
   ../include/mesos/module/hook.pb.h					\
   ../include/mesos/module/module.pb.h
@@ -782,12 +778,8 @@ resourceproviderdir = $(pkgincludedir)/resource_provider
 
 resourceprovider_HEADERS =							\
   $(top_srcdir)/include/mesos/resource_provider/resource_provider.hpp		\
-  $(top_srcdir)/include/mesos/resource_provider/resource_provider.proto
-
-if ENABLE_GRPC
-resourceprovider_HEADERS +=							\
+  $(top_srcdir)/include/mesos/resource_provider/resource_provider.proto		\
   $(top_srcdir)/include/mesos/resource_provider/storage/disk_profile_adaptor.hpp
-endif
 
 nodist_resourceprovider_HEADERS =					\
   ../include/mesos/resource_provider/resource_provider.pb.h
@@ -1481,13 +1473,13 @@ libmesos_no_3rdparty_la_SOURCES +=					\
   authentication/executor/jwt_secret_generator.hpp
 endif
 
-if ENABLE_GRPC
 libmesos_no_3rdparty_la_SOURCES +=					\
   resource_provider/storage/disk_profile_adaptor.cpp			\
   resource_provider/storage/disk_profile.proto				\
   resource_provider/storage/disk_profile_utils.cpp			\
   resource_provider/storage/disk_profile_utils.hpp
 
+if ENABLE_GRPC
 libmesos_no_3rdparty_la_SOURCES +=					\
   resource_provider/storage/provider.cpp				\
   resource_provider/storage/provider.hpp
@@ -1539,20 +1531,19 @@ libmesos_no_3rdparty_la_LIBADD += libbuild.la
 # Convenience library for build the CSI client.
 noinst_LTLIBRARIES += libcsi.la
 libcsi_la_SOURCES =							\
-  csi/paths.cpp
-
-libcsi_la_SOURCES +=							\
-  csi/paths.hpp
-
-if ENABLE_GRPC
+  csi/paths.cpp								\
+  csi/utils.cpp
 libcsi_la_SOURCES +=							\
   ../include/csi/spec.hpp						\
-  csi/client.cpp							\
-  csi/client.hpp							\
+  csi/paths.hpp								\
   csi/state.hpp								\
   csi/state.proto							\
-  csi/utils.cpp								\
   csi/utils.hpp
+
+if ENABLE_GRPC
+libcsi_la_SOURCES +=							\
+  csi/client.cpp							\
+  csi/client.hpp
 endif
 
 nodist_libcsi_la_SOURCES = $(CXX_CSI_PROTOS)
@@ -2390,7 +2381,6 @@ libload_qos_controller_la_SOURCES += slave/qos_controllers/load.cpp
 libload_qos_controller_la_CPPFLAGS = $(MESOS_CPPFLAGS)
 libload_qos_controller_la_LDFLAGS = $(MESOS_MODULE_LDFLAGS)
 
-if ENABLE_GRPC
 # Library containing the URI disk profile adaptor module.
 pkgmodule_LTLIBRARIES += liburi_disk_profile_adaptor.la
 liburi_disk_profile_adaptor_la_SOURCES =			\
@@ -2399,7 +2389,6 @@ liburi_disk_profile_adaptor_la_SOURCES =			\
   resource_provider/storage/disk_profile_utils.hpp
 liburi_disk_profile_adaptor_la_CPPFLAGS = $(MESOS_CPPFLAGS)
 liburi_disk_profile_adaptor_la_LDFLAGS = $(MESOS_MODULE_LDFLAGS)
-endif
 
 MESOS_TEST_MODULE_LDFLAGS = $(MESOS_MODULE_LDFLAGS)
 
@@ -2522,6 +2511,7 @@ mesos_tests_SOURCES =						\
   tests/cram_md5_authentication_tests.cpp			\
   tests/credentials_tests.cpp					\
   tests/default_executor_tests.cpp				\
+  tests/disk_profile_adaptor_tests.cpp				\
   tests/disk_quota_tests.cpp					\
   tests/dynamic_weights_tests.cpp				\
   tests/environment.cpp						\
@@ -2631,7 +2621,6 @@ mesos_tests_SOURCES =						\
 if ENABLE_GRPC
 mesos_tests_SOURCES +=						\
   tests/csi_client_tests.cpp					\
-  tests/disk_profile_adaptor_tests.cpp				\
   tests/mock_csi_plugin.cpp					\
   tests/mock_csi_plugin.hpp
 endif

http://git-wip-us.apache.org/repos/asf/mesos/blob/2adbfdcb/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index e330e5f..0ee4f65 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -111,7 +111,6 @@ mesos::internal::slave::Flags::Flags()
       "  \"name\": \"lvm\"\n"
       "}");
 
-#ifdef ENABLE_GRPC
   add(&Flags::disk_profile_adaptor,
       "disk_profile_adaptor",
       "The name of the disk profile adaptor module that storage resource\n"
@@ -120,7 +119,6 @@ mesos::internal::slave::Flags::Flags()
       "If this flag is not specified, the default behavior for storage\n"
       "resource providers is to only expose resources for pre-existing\n"
       "volumes and not publish RAW volumes.");
-#endif
 
   add(&Flags::isolation,
       "isolation",

http://git-wip-us.apache.org/repos/asf/mesos/blob/2adbfdcb/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 9d2d192..2b8c6e0 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -36,9 +36,7 @@
 
 #include <mesos/module/authenticatee.hpp>
 
-#ifdef ENABLE_GRPC
 #include <mesos/resource_provider/storage/disk_profile_adaptor.hpp>
-#endif
 
 #include <process/after.hpp>
 #include <process/async.hpp>
@@ -424,7 +422,6 @@ void Slave::initialize()
       << mkdir.error();
   }
 
-#ifdef ENABLE_GRPC
   // Create the DiskProfileAdaptor module and set it globally so
   // any component that needs the module can share this instance.
   Try<DiskProfileAdaptor*> _diskProfileAdaptor =
@@ -440,7 +437,6 @@ void Slave::initialize()
     shared_ptr<DiskProfileAdaptor>(_diskProfileAdaptor.get());
 
   DiskProfileAdaptor::setAdaptor(diskProfileAdaptor);
-#endif
 
   string scheme = "http";
 


[6/7] mesos git commit: Built storage local resource provider with CMake.

Posted by ch...@apache.org.
Built storage local resource provider with CMake.

This patch adds CMake rules for compiling necessary source code for
building storage local resource provider and related tests.

Review: https://reviews.apache.org/r/66163/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/12a907bf
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/12a907bf
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/12a907bf

Branch: refs/heads/master
Commit: 12a907bf102014d31af6dd7d757ea96f5f6b4881
Parents: 8021e29
Author: Chun-Hung Hsiao <ch...@apache.org>
Authored: Fri Apr 20 18:17:53 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri Apr 20 18:17:53 2018 -0700

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake             |  5 ++++
 src/CMakeLists.txt                           | 33 ++++++++++++++++++-----
 src/examples/CMakeLists.txt                  | 12 +++++++++
 src/resource_provider/storage/CMakeLists.txt | 21 +++++++++++++++
 src/tests/CMakeLists.txt                     | 29 ++++++++++++++++++--
 5 files changed, 92 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/12a907bf/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 6a218e2..843786e 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -478,6 +478,11 @@ add_definitions(
   -DVERSION="${PACKAGE_VERSION}"
   -DPKGDATADIR="${DATA_INSTALL_PREFIX}")
 
+if (ENABLE_GRPC)
+  # TODO(chhsiao): Make this non-global.
+  add_definitions(-DENABLE_GRPC=1)
+endif ()
+
 if (ENABLE_SSL)
   # TODO(andschwa): Make this non-global.
   add_definitions(-DUSE_SSL_SOCKET=1)

http://git-wip-us.apache.org/repos/asf/mesos/blob/12a907bf/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4908cb9..d488131 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -30,6 +30,7 @@ set(JAVA_PROTOBUF_SRC "")
 #
 # NOTE: The following `PROTOC_GENERATE` calls will list append to
 # `PUBLIC_PROTO_PATH`, `PUBLIC_PROTOBUF_INCLUDE_DIR` and `PUBLIC_PROTOBUF_SRC`.
+# The GRPC option is a noop if gRPC is disabled.
 PROTOC_GENERATE(GRPC LIB csi TARGET csi)
 
 # NOTE: The following `PROTOC_GENERATE` calls will list append to
@@ -84,6 +85,8 @@ PROTOC_GENERATE(INTERNAL TARGET slave/containerizer/mesos/provisioner/docker/mes
 PROTOC_GENERATE(INTERNAL TARGET master/registry)
 PROTOC_GENERATE(INTERNAL TARGET resource_provider/registry)
 PROTOC_GENERATE(INTERNAL TARGET resource_provider/state)
+PROTOC_GENERATE(INTERNAL TARGET resource_provider/storage/disk_profile)
+PROTOC_GENERATE(INTERNAL TARGET csi/state)
 
 
 # BUILD PROTOBUFS.
@@ -104,7 +107,10 @@ add_library(
   ${PUBLIC_PROTOBUF_SRC}
   ${INTERNAL_PROTOBUF_SRC})
 
-target_link_libraries(mesos-protobufs PUBLIC protobuf)
+target_link_libraries(mesos-protobufs PUBLIC
+  protobuf
+  $<$<BOOL:${ENABLE_GRPC}>:grpc>)
+
 target_include_directories(
   mesos-protobufs
   PUBLIC
@@ -231,7 +237,13 @@ set(COMMON_SRC
   common/values.cpp)
 
 set(CSI_SRC
-  csi/paths.cpp)
+  csi/paths.cpp
+  csi/utils.cpp)
+
+if (ENABLE_GRPC)
+  list(APPEND CSI_SRC
+    csi/client.cpp)
+endif ()
 
 set(DOCKER_SRC
   docker/docker.cpp
@@ -369,7 +381,15 @@ set(RESOURCE_PROVIDER_SRC
   resource_provider/manager.cpp
   resource_provider/registrar.cpp
   resource_provider/validation.cpp
-  resource_provider/storage/disk_profile_adaptor.cpp)
+  resource_provider/storage/disk_profile_adaptor.cpp
+  resource_provider/storage/disk_profile_utils.cpp)
+
+# NOTE: The storage local resource provider uses Unix domain sockets to talk to
+# CSI plugins, thus it is currently not supported on Windows.
+if (ENABLE_GRPC AND NOT WIN32)
+  list(APPEND RESOURCE_PROVIDER_SRC
+    resource_provider/storage/provider.cpp)
+endif ()
 
 set(SCHEDULER_SRC
   sched/sched.cpp
@@ -381,9 +401,6 @@ set(SECRET_SRC
 set(STATE_SRC
   state/in_memory.cpp)
 
-set(STATUS_UPDATE_MANAGER_SRC
-  status_update_manager/operation.cpp)
-
 if (NOT WIN32)
   list(APPEND STATE_SRC
     state/leveldb.cpp
@@ -391,6 +408,9 @@ if (NOT WIN32)
     state/zookeeper.cpp)
 endif ()
 
+set(STATUS_UPDATE_MANAGER_SRC
+  status_update_manager/operation.cpp)
+
 set(URI_SRC
   uri/fetcher.cpp
   uri/utils.cpp
@@ -543,6 +563,7 @@ add_subdirectory(local)
 add_subdirectory(log)
 add_subdirectory(master)
 add_subdirectory(python/cli_new)
+add_subdirectory(resource_provider/storage)
 add_subdirectory(slave)
 add_subdirectory(slave/containerizer/mesos)
 add_subdirectory(usage)

http://git-wip-us.apache.org/repos/asf/mesos/blob/12a907bf/src/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt
index e85eed6..6a6ee7c 100644
--- a/src/examples/CMakeLists.txt
+++ b/src/examples/CMakeLists.txt
@@ -52,6 +52,11 @@ if (NOT WIN32)
   add_executable(test-http-framework           test_http_framework.cpp)
   add_executable(test-csi-user-framework       test_csi_user_framework.cpp)
 
+  # TODO(chhsiao): The test CSI plugin is Linux only for now.
+  if (ENABLE_GRPC AND LINUX)
+    add_executable(test-csi-plugin test_csi_plugin.cpp)
+  endif ()
+
   # NOTE: Do not replace this with `link_libraries()`. While it may result in
   # less code, it is deprecated and relies on side effects instead of
   # explicitness.
@@ -84,4 +89,11 @@ if (NOT WIN32)
   target_link_libraries(test-http-executor            PRIVATE mesos)
   target_link_libraries(test-http-framework           PRIVATE mesos)
   target_link_libraries(test-csi-user-framework       PRIVATE mesos)
+
+  # TODO(chhsiao): The test CSI plugin is Linux only for now.
+  if (ENABLE_GRPC AND LINUX)
+    # NOTE: We explicitly add `grpc` here since the test CSI plugin uses the
+    # server-side gRPC library, which might not be linked in mesos.
+    target_link_libraries(test-csi-plugin PRIVATE mesos grpc)
+  endif ()
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/12a907bf/src/resource_provider/storage/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/resource_provider/storage/CMakeLists.txt b/src/resource_provider/storage/CMakeLists.txt
new file mode 100644
index 0000000..90fdd61
--- /dev/null
+++ b/src/resource_provider/storage/CMakeLists.txt
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# THE URI DISK PROFILE ADAPTOR LIBRARY.
+#######################################
+# NOTE: This library uses underscores to be consistent with other modules.
+add_library(uri_disk_profile_adaptor uri_disk_profile_adaptor.cpp)
+target_link_libraries(uri_disk_profile_adaptor PRIVATE mesos)

http://git-wip-us.apache.org/repos/asf/mesos/blob/12a907bf/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index ade5180..4eb8e23 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -70,6 +70,12 @@ if (LINUX)
     containerizer/setns_test_helper.cpp)
 endif ()
 
+if (ENABLE_GRPC)
+  list(APPEND MESOS_TESTS_UTILS_SRC
+    csi_client_tests.cpp
+    mock_csi_plugin.cpp)
+endif ()
+
 
 # All the test sources.
 #######################
@@ -156,6 +162,7 @@ list(APPEND MESOS_TESTS_SRC
 if (NOT WIN32)
   list(APPEND MESOS_TESTS_SRC
     container_logger_tests.cpp
+    disk_profile_adaptor_tests.cpp
     disk_quota_tests.cpp
     dynamic_weights_tests.cpp
     examples_tests.cpp
@@ -228,20 +235,30 @@ if (LINUX)
     containerizer/volume_host_path_isolator_tests.cpp
     containerizer/volume_image_isolator_tests.cpp
     containerizer/volume_secret_isolator_tests.cpp)
+
+  if (ENABLE_GRPC)
+    list(APPEND MESOS_TESTS_SRC
+      agent_resource_provider_config_api_tests.cpp
+      storage_local_resource_provider_tests.cpp)
+  endif ()
 endif ()
 
 
 # THE TEST AND HELPER EXECUTABLES.
 ##################################
 add_library(mesos-tests-interface INTERFACE)
-target_link_libraries(mesos-tests-interface INTERFACE mesos googletest)
+target_link_libraries(
+  mesos-tests-interface INTERFACE
+  mesos
+  googletest)
 
 if (NOT WIN32)
   target_link_libraries(
     mesos-tests-interface INTERFACE
     load_qos_controller
     fixed_resource_estimator
-    logrotate_container_logger)
+    logrotate_container_logger
+    uri_disk_profile_adaptor)
 endif ()
 
 target_compile_definitions(
@@ -313,8 +330,16 @@ if (NOT WIN32)
     persistent-volume-framework
     test-executor
     test-framework
+    test-csi-user-framework
     test-http-executor
     test-http-framework)
+
+  # SLRP-related tests are Linux only and require the test CSI plugin binary.
+  if (ENABLE_GRPC AND LINUX)
+    add_dependencies(
+      mesos-tests
+      test-csi-plugin)
+  endif ()
 endif ()
 
 


[4/7] mesos git commit: Building gRPC with CMake.

Posted by ch...@apache.org.
Building gRPC with CMake.

This patch adds an `ENABLE_GRPC` option and builds the bundled gRPC
3rdparty library in CMake.

Review: https://reviews.apache.org/r/61096/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a2ee950f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a2ee950f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a2ee950f

Branch: refs/heads/master
Commit: a2ee950fc605c67085360f1d28a9a0373b34d067
Parents: e06f3ec
Author: Chun-Hung Hsiao <ch...@apache.org>
Authored: Fri Apr 20 18:17:48 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri Apr 20 18:17:48 2018 -0700

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt          | 135 ++++++++++++++++++++++++++++++++++
 3rdparty/cmake/Versions.cmake    |   2 +
 cmake/CompilationConfigure.cmake |   5 ++
 src/cmake/MesosProtobuf.cmake    |  18 +++--
 4 files changed, 154 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a2ee950f/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 2f768b3..b7362d2 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -29,6 +29,7 @@ set(CSI_URL             ${FETCH_URL}/csi-${CSI_VERSION}.tar.gz)
 set(ELFIO_URL           ${FETCH_URL}/elfio-${ELFIO_VERSION}.tar.gz)
 set(GLOG_URL            ${FETCH_URL}/glog-${GLOG_VERSION}.tar.gz)
 set(GOOGLETEST_URL      ${FETCH_URL}/googletest-release-${GOOGLETEST_VERSION}.tar.gz)
+set(GRPC_URL            ${FETCH_URL}/grpc-${GRPC_VERSION}.tar.gz)
 set(HTTP_PARSER_URL     ${FETCH_URL}/http-parser-${HTTP_PARSER_VERSION}.tar.gz)
 set(JEMALLOC_URL        ${FETCH_URL}/jemalloc-${JEMALLOC_VERSION}.tar.gz)
 set(PICOJSON_URL        ${FETCH_URL}/picojson-${PICOJSON_VERSION}.tar.gz)
@@ -991,6 +992,140 @@ ExternalProject_Add(
   URL_HASH          ${PROTOBUF_HASH})
 
 
+if (ENABLE_GRPC)
+  # gRPC: Google's high performance, open-source universal RPC framework.
+  # https://grpc.io/
+  #######################################################################
+  EXTERNAL(grpc ${GRPC_VERSION} ${CMAKE_CURRENT_BINARY_DIR})
+
+  add_library(libgpr ${LIBRARY_LINKAGE} IMPORTED)
+  add_dependencies(libgpr ${GRPC_TARGET})
+  add_library(libgrpc ${LIBRARY_LINKAGE} IMPORTED)
+  add_dependencies(libgrpc ${GRPC_TARGET})
+  add_library(libgrpc++ ${LIBRARY_LINKAGE} IMPORTED)
+  add_dependencies(libgrpc++ ${GRPC_TARGET})
+
+  add_library(grpc INTERFACE)
+  target_link_libraries(grpc INTERFACE libgpr libgrpc libgrpc++)
+
+  # TODO(chhsiao): Move grpc so these don't have to be GLOBAL.
+  add_executable(grpc_cpp_plugin IMPORTED GLOBAL)
+  add_dependencies(grpc_cpp_plugin ${GRPC_TARGET})
+
+  set(GRPC_CMAKE_ARGS
+    ${CMAKE_C_FORWARD_ARGS}
+    ${CMAKE_CXX_FORWARD_ARGS}
+    -DCMAKE_PREFIX_PATH=${PROTOBUF_ROOT}-build
+    -DgRPC_PROTOBUF_PROVIDER=package
+    -DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG
+    -DgRPC_ZLIB_PROVIDER=package)
+
+  if (ENABLE_SSL)
+    list(APPEND GRPC_CMAKE_ARGS -DgRPC_SSL_PROVIDER=package ${CMAKE_SSL_FORWARD_ARGS})
+  else ()
+    set(GRPC_UNSECURE _unsecure)
+    list(APPEND GRPC_CMAKE_ARGS -DgRPC_SSL_PROVIDER=none)
+  endif ()
+
+  set(GRPC_BUILD_CMD
+    ${CMAKE_COMMAND} --build . --target gpr &&
+    ${CMAKE_COMMAND} --build . --target grpc${GRPC_UNSECURE} &&
+    ${CMAKE_COMMAND} --build . --target grpc++${GRPC_UNSECURE} &&
+    ${CMAKE_COMMAND} --build . --target grpc_cpp_plugin)
+
+  set_target_properties(
+    grpc PROPERTIES
+    INTERFACE_INCLUDE_DIRECTORIES ${GRPC_ROOT}/include)
+
+  if (WIN32)
+    PATCH_CMD(GRPC_PATCH_CMD grpc-${GRPC_VERSION}.patch)
+
+    list(APPEND GRPC_CMAKE_ARGS -DZLIB_ROOT=${ZLIB_ROOT}-lib)
+
+    if (CMAKE_GENERATOR MATCHES "Visual Studio")
+      set_target_properties(
+        libgpr PROPERTIES
+        IMPORTED_LOCATION_DEBUG ${GRPC_ROOT}-build/Debug/gpr${LIBRARY_SUFFIX}
+        IMPORTED_LOCATION_RELEASE ${GRPC_ROOT}-build/Release/gpr${LIBRARY_SUFFIX}
+        IMPORTED_IMPLIB_DEBUG ${GRPC_ROOT}-build/Debug/gpr${CMAKE_IMPORT_LIBRARY_SUFFIX}
+        IMPORTED_IMPLIB_RELEASE ${GRPC_ROOT}-build/Release/gpr${CMAKE_IMPORT_LIBRARY_SUFFIX})
+
+      set_target_properties(
+        libgrpc PROPERTIES
+        IMPORTED_LOCATION_DEBUG ${GRPC_ROOT}-build/Debug/grpc${GRPC_UNSECURE}${LIBRARY_SUFFIX}
+        IMPORTED_LOCATION_RELEASE ${GRPC_ROOT}-build/Release/grpc${GRPC_UNSECURE}${LIBRARY_SUFFIX}
+        IMPORTED_IMPLIB_DEBUG ${GRPC_ROOT}-build/Debug/grpc${GRPC_UNSECURE}${CMAKE_IMPORT_LIBRARY_SUFFIX}
+        IMPORTED_IMPLIB_RELEASE ${GRPC_ROOT}-build/Release/grpc${GRPC_UNSECURE}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+
+      set_target_properties(
+        libgrpc++ PROPERTIES
+        IMPORTED_LOCATION_DEBUG ${GRPC_ROOT}-build/Debug/grpc++${GRPC_UNSECURE}${LIBRARY_SUFFIX}
+        IMPORTED_LOCATION_RELEASE ${GRPC_ROOT}-build/Release/grpc++${GRPC_UNSECURE}${LIBRARY_SUFFIX}
+        IMPORTED_IMPLIB_DEBUG ${GRPC_ROOT}-build/Debug/grpc++${GRPC_UNSECURE}${CMAKE_IMPORT_LIBRARY_SUFFIX}
+        IMPORTED_IMPLIB_RELEASE ${GRPC_ROOT}-build/Release/grpc++${GRPC_UNSECURE}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+
+      set_target_properties(
+        grpc_cpp_plugin PROPERTIES
+        IMPORTED_LOCATION_DEBUG ${GRPC_ROOT}-build/Debug/grpc_cpp_plugin.exe
+        IMPORTED_LOCATION_RELEASE ${GRPC_ROOT}-build/Release/grpc_cpp_plugin.exe)
+    else ()
+      set_target_properties(
+        libgpr PROPERTIES
+        IMPORTED_LOCATION ${GRPC_ROOT}-build/gpr${LIBRARY_SUFFIX}
+        IMPORTED_IMPLIB ${GRPC_ROOT}-build/gpr${CMAKE_IMPORT_LIBRARY_SUFFIX})
+
+      set_target_properties(
+        libgrpc PROPERTIES
+        IMPORTED_LOCATION ${GRPC_ROOT}-build/grpc${GRPC_UNSECURE}${LIBRARY_SUFFIX}
+        IMPORTED_IMPLIB ${GRPC_ROOT}-build/grpc${GRPC_UNSECURE}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+
+      set_target_properties(
+        libgrpc++ PROPERTIES
+        IMPORTED_LOCATION ${GRPC_ROOT}-build/grpc++${GRPC_UNSECURE}${LIBRARY_SUFFIX}
+        IMPORTED_IMPLIB ${GRPC_ROOT}-build/grpc++${GRPC_UNSECURE}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+
+      set_target_properties(
+        grpc_cpp_plugin PROPERTIES
+        IMPORTED_LOCATION ${GRPC_ROOT}-build/grpc_cpp_plugin.exe)
+    endif()
+  else ()
+    set_target_properties(
+      libgpr PROPERTIES
+      IMPORTED_LOCATION ${GRPC_ROOT}-build/libgpr${LIBRARY_SUFFIX})
+
+    set_target_properties(
+      libgrpc PROPERTIES
+      IMPORTED_LOCATION ${GRPC_ROOT}-build/libgrpc${GRPC_UNSECURE}${LIBRARY_SUFFIX})
+
+    set_target_properties(
+      libgrpc++ PROPERTIES
+      IMPORTED_LOCATION ${GRPC_ROOT}-build/libgrpc++${GRPC_UNSECURE}${LIBRARY_SUFFIX})
+
+    set_target_properties(
+      grpc_cpp_plugin PROPERTIES
+      IMPORTED_LOCATION ${GRPC_ROOT}-build/grpc_cpp_plugin)
+  endif ()
+
+  MAKE_INCLUDE_DIR(grpc)
+  GET_BYPRODUCTS(libgpr)
+  GET_BYPRODUCTS(libgrpc)
+  GET_BYPRODUCTS(libgrpc++)
+  GET_BYPRODUCTS(grpc_cpp_plugin)
+
+  ExternalProject_Add(
+    ${GRPC_TARGET}
+    DEPENDS          protobuf protoc zlib
+    PREFIX           ${GRPC_CMAKE_ROOT}
+    PATCH_COMMAND    ${GRPC_PATCH_CMD}
+    BUILD_BYPRODUCTS ${LIBGPR_BYPRODUCTS};${LIBGRPC_BYPRODUCTS};${LIBGRPC++_BYPRODUCTS};${GRPC_CPP_PLUGIN_BYPRODUCTS}
+    CMAKE_ARGS       ${GRPC_CMAKE_ARGS}
+    BUILD_COMMAND    ${GRPC_BUILD_CMD}
+    INSTALL_COMMAND  ${CMAKE_NOOP}
+    URL              ${GRPC_URL}
+    URL_HASH         ${GRPC_HASH})
+endif ()
+
+
 # Jemalloc: General-purpose malloc implementation.
 # http://jemalloc.net
 ##################################################

http://git-wip-us.apache.org/repos/asf/mesos/blob/a2ee950f/3rdparty/cmake/Versions.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
index 33577cc..2828acd 100644
--- a/3rdparty/cmake/Versions.cmake
+++ b/3rdparty/cmake/Versions.cmake
@@ -10,6 +10,8 @@ set(ELFIO_VERSION           "3.2")
 set(ELFIO_HASH              "SHA256=964BE1D401F98FA7A1242BCF048DF32B7D56DBAAAE5D02834900499073AC2E95")
 set(GOOGLETEST_VERSION      "1.8.0")
 set(GOOGLETEST_HASH         "SHA256=58A6F4277CA2BC8565222B3BBD58A177609E9C488E8A72649359BA51450DB7D8")
+set(GRPC_VERSION            "1.10.0")
+set(GRPC_HASH               "SHA256=F52F979FA8EB8D4F74E192D32C97915D124D6531B6D1300A158CDFBABBACA04A")
 set(HTTP_PARSER_VERSION     "2.6.2")
 set(HTTP_PARSER_HASH        "SHA256=80FFFC3B64EF6968CECDD4B299A96986007DFF4BD12AE6C58CBCB506959B90AD")
 set(JEMALLOC_VERSION        "5.0.1")

http://git-wip-us.apache.org/repos/asf/mesos/blob/a2ee950f/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 173089a..6a218e2 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -75,6 +75,11 @@ option(
   TRUE)
 
 option(
+  ENABLE_GRPC
+  "Build libprocess with gRPC support."
+  FALSE)
+
+option(
   ENABLE_LIBEVENT
   "Use libevent instead of libev as the core event loop implementation."
   FALSE)

http://git-wip-us.apache.org/repos/asf/mesos/blob/a2ee950f/src/cmake/MesosProtobuf.cmake
----------------------------------------------------------------------
diff --git a/src/cmake/MesosProtobuf.cmake b/src/cmake/MesosProtobuf.cmake
index dde034f..9fadc9f 100644
--- a/src/cmake/MesosProtobuf.cmake
+++ b/src/cmake/MesosProtobuf.cmake
@@ -127,20 +127,22 @@ function(PROTOC_GENERATE)
     list(APPEND PROTOC_OPTIONS -I${INTERNAL_PROTO_PATH})
   endif ()
 
-  if (PROTOC_GRPC AND HAS_GRPC)
-    # TODO(chhsiao): Add the gRPC plugin.
-    list(APPEND PROTOC_OPTIONS --grpc_out=${CPP_OUT})
+  if (PROTOC_GRPC AND ENABLE_GRPC)
+    list(APPEND PROTOC_OPTIONS
+      --grpc_out=${CPP_OUT}
+      --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin>)
   endif ()
 
   if (JAVA_OUT)
-    list(APPEND PROTOC_OPTIONS --java_out=${JAVA_OUT})
+    list(APPEND PROTOC_OPTIONS
+      --java_out=${JAVA_OUT})
   endif ()
 
   # Fully qualified paths for the output .pb.h and .pb.cc files.
   set(CC ${CPP_OUT}/${PROTOC_TARGET}.pb.cc)
   set(H ${CPP_OUT}/${PROTOC_TARGET}.pb.h)
 
-  if (PROTOC_GRPC AND HAS_GRPC)
+  if (PROTOC_GRPC AND ENABLE_GRPC)
     set(GRPC_CC ${CPP_OUT}/${PROTOC_TARGET}.grpc.pb.cc)
     set(GRPC_H ${CPP_OUT}/${PROTOC_TARGET}.grpc.pb.h)
   endif ()
@@ -208,8 +210,12 @@ function(PROTOC_GENERATE)
     endif ()
   endif ()
 
+  # Make sure that the gRPC plugin is built.
+  if (PROTOC_GRPC AND ENABLE_GRPC)
+    list(APPEND PROTOC_DEPENDS grpc_cpp_plugin)
+  endif ()
+
   # Compile the .proto file.
-  # TODO(chhsiao): Add a gRPC dependency.
   add_custom_command(
     OUTPUT ${CC} ${H} ${GRPC_CC} ${GRPC_H} ${JAVA}
     COMMAND protoc ${PROTOC_OPTIONS} ${PROTO}


[7/7] mesos git commit: Windows: Fixed build with OpenSSL due to missing header.

Posted by ch...@apache.org.
Windows: Fixed build with OpenSSL due to missing header.

When `-DENABLE_SSL=TRUE`, then `USE_SSL_SOCKET` is defined, and in
this `src/local/local.cpp` in a section guarded by said definition,
the construct `os::Permissions` is used. However, this is defined in
`stout/os/permissions.hpp`, which is implicitly included on POSIX, but
not on Windows. The fix is to IWYU and explicitly include it.

Review: https://reviews.apache.org/r/66753/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/654e5984
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/654e5984
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/654e5984

Branch: refs/heads/master
Commit: 654e5984f100ab8b52c87506a66eea9630e54a8f
Parents: 12a907b
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Fri Apr 20 18:39:35 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri Apr 20 18:39:35 2018 -0700

----------------------------------------------------------------------
 src/local/local.cpp | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/654e5984/src/local/local.cpp
----------------------------------------------------------------------
diff --git a/src/local/local.cpp b/src/local/local.cpp
index 9c5b45b..afff546 100644
--- a/src/local/local.cpp
+++ b/src/local/local.cpp
@@ -57,6 +57,10 @@
 #include <stout/strings.hpp>
 
 #ifdef USE_SSL_SOCKET
+#include <stout/os/permissions.hpp>
+#endif // USE_SSL_SOCKET
+
+#ifdef USE_SSL_SOCKET
 #include "authentication/executor/jwt_secret_generator.hpp"
 #endif // USE_SSL_SOCKET
 


[3/7] mesos git commit: Cherry-picked gRPC PR #15128 for Windows compilation.

Posted by ch...@apache.org.
Cherry-picked gRPC PR #15128 for Windows compilation.

We added a gRPC patch file that includes
https://github.com/grpc/grpc/pull/15128 to fix Windows compilation, and
updated `grpc.md` to match the format of `protobuf.md`.

Review: https://reviews.apache.org/r/66727/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e06f3ec0
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e06f3ec0
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e06f3ec0

Branch: refs/heads/master
Commit: e06f3ec093dc255a9236caebd42331471a7f1863
Parents: f905166
Author: Chun-Hung Hsiao <ch...@apache.org>
Authored: Fri Apr 20 18:17:46 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri Apr 20 18:17:46 2018 -0700

----------------------------------------------------------------------
 3rdparty/grpc-1.10.0.patch  | 22 ++++++++++++++++++++++
 3rdparty/grpc-1.10.0.readme |  7 -------
 3rdparty/grpc.md            | 21 +++++++++++++++++++++
 3 files changed, 43 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e06f3ec0/3rdparty/grpc-1.10.0.patch
----------------------------------------------------------------------
diff --git a/3rdparty/grpc-1.10.0.patch b/3rdparty/grpc-1.10.0.patch
new file mode 100644
index 0000000..98ae6af
--- /dev/null
+++ b/3rdparty/grpc-1.10.0.patch
@@ -0,0 +1,22 @@
+diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h
+index bf1bf3df6a..85704e6559 100644
+--- a/include/grpc/impl/codegen/port_platform.h
++++ b/include/grpc/impl/codegen/port_platform.h
+@@ -39,6 +39,8 @@
+ #define NOMINMAX
+ #endif /* NOMINMAX */
+ 
++#include <windows.h>
++
+ #ifndef _WIN32_WINNT
+ #error \
+     "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
+@@ -49,8 +51,6 @@
+ #endif /* _WIN32_WINNT < 0x0600 */
+ #endif /* defined(_WIN32_WINNT) */
+ 
+-#include <windows.h>
+-
+ #ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
+ #undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
+ #undef WIN32_LEAN_AND_MEAN

http://git-wip-us.apache.org/repos/asf/mesos/blob/e06f3ec0/3rdparty/grpc-1.10.0.readme
----------------------------------------------------------------------
diff --git a/3rdparty/grpc-1.10.0.readme b/3rdparty/grpc-1.10.0.readme
deleted file mode 100644
index d33a808..0000000
--- a/3rdparty/grpc-1.10.0.readme
+++ /dev/null
@@ -1,7 +0,0 @@
-The bundled `grpc-1.10.0.tar.gz` package is generated with the following command:
-
-```sh
-git clone -b v1.10.0 https://github.com/grpc/grpc.git grpc-1.10.0
-(cd grpc-1.10.0 && git submodule update --init third_party/cares)
-tar zcvf grpc-1.10.0.tar.gz --exclude .git grpc-1.10.0
-```

http://git-wip-us.apache.org/repos/asf/mesos/blob/e06f3ec0/3rdparty/grpc.md
----------------------------------------------------------------------
diff --git a/3rdparty/grpc.md b/3rdparty/grpc.md
new file mode 100644
index 0000000..8d0e189
--- /dev/null
+++ b/3rdparty/grpc.md
@@ -0,0 +1,21 @@
+# gRPC
+
+## Project website
+
+https://github.com/grpc/grpc
+
+## How To Bundle
+
+```sh
+git clone -b v<version> https://github.com/grpc/grpc.git grpc-<version>
+(cd grpc-<version> && git submodule update --init third_party/cares)
+tar zcvf grpc-<version>.tar.gz --exclude .git grpc-<version>
+```
+
+## Bundled Version
+
+We bundle 1.10.0 for better CMake build support.
+
+## Cherry Picks
+
+- [Fixed undefined `_WIN32_WINNT` for generated files on Windows.](https://github.com/grpc/grpc/pull/15128)


[2/7] mesos git commit: Made CMake's `FindZLIB` module be able to find Zlib on Windows.

Posted by ch...@apache.org.
Made CMake's `FindZLIB` module be able to find Zlib on Windows.

This patch "install" ZLib in
`build/3rdparty/zlib-1.2.8/src/zlib-1.2.8-lib`, so we can set
`ZLIB_ROOT` to the directory to make `FindZLIB` be able to find the
include directory containing both `zlib.h` and `zconf.h`, as well as to
find the library directory containing the library files.

Review: https://reviews.apache.org/r/66726/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f9051664
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f9051664
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f9051664

Branch: refs/heads/master
Commit: f905166465010306e21651a0d7fb0c75e9a597fb
Parents: 2adbfdc
Author: Chun-Hung Hsiao <ch...@apache.org>
Authored: Fri Apr 20 18:17:45 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri Apr 20 18:17:45 2018 -0700

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f9051664/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index e6bb407..2f768b3 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -769,17 +769,23 @@ if (WIN32)
     set(ZLIB_SHARED 1)
   endif ()
 
+  # NOTE: We install Zlib under `${ZLIB_ROOT}-lib` so CMake's `FindZLIB` module
+  # can find all required headers and library files.
+  set(ZLIB_CMAKE_ARGS
+    ${CMAKE_C_FORWARD_ARGS}
+    -DCMAKE_INSTALL_PREFIX=${ZLIB_ROOT}-lib)
+
   set_target_properties(
     zlib PROPERTIES
-    INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_ROOT};${ZLIB_ROOT}-build")
+    INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_ROOT}-lib/include)
 
   if (CMAKE_GENERATOR MATCHES "Visual Studio")
     set_target_properties(
       zlib PROPERTIES
-      IMPORTED_LOCATION_DEBUG ${ZLIB_ROOT}-build/Debug/zlib${ZLIB_STATIC}d${ZLIB_SHARED}${LIBRARY_SUFFIX}
-      IMPORTED_LOCATION_RELEASE ${ZLIB_ROOT}-build/Release/zlib${ZLIB_STATIC}${ZLIB_SHARED}${LIBRARY_SUFFIX}
-      IMPORTED_IMPLIB_DEBUG ${ZLIB_ROOT}-build/Debug/zlib${ZLIB_STATIC}d${CMAKE_IMPORT_LIBRARY_SUFFIX}
-      IMPORTED_IMPLIB_RELEASE ${ZLIB_ROOT}-build/Release/zlib${ZLIB_STATIC}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+      IMPORTED_LOCATION_DEBUG ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}d${ZLIB_SHARED}${LIBRARY_SUFFIX}
+      IMPORTED_LOCATION_RELEASE ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}${ZLIB_SHARED}${LIBRARY_SUFFIX}
+      IMPORTED_IMPLIB_DEBUG ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}d${CMAKE_IMPORT_LIBRARY_SUFFIX}
+      IMPORTED_IMPLIB_RELEASE ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}${CMAKE_IMPORT_LIBRARY_SUFFIX})
   else ()
     # This is for single-configuration generators such as Ninja.
     if (CMAKE_BUILD_TYPE MATCHES Debug)
@@ -788,8 +794,8 @@ if (WIN32)
 
     set_target_properties(
       zlib PROPERTIES
-      IMPORTED_LOCATION ${ZLIB_ROOT}-build/zlib${ZLIB_STATIC}${ZLIB_SUFFIX}${ZLIB_SHARED}${LIBRARY_SUFFIX}
-      IMPORTED_IMPLIB ${ZLIB_ROOT}-build/zlib${ZLIB_STATIC}${ZLIB_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+      IMPORTED_LOCATION ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}${ZLIB_SUFFIX}${ZLIB_SHARED}${LIBRARY_SUFFIX}
+      IMPORTED_IMPLIB ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}${ZLIB_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX})
   endif ()
 
   MAKE_INCLUDE_DIR(zlib)
@@ -799,8 +805,8 @@ if (WIN32)
     ${ZLIB_TARGET}
     PREFIX            ${ZLIB_CMAKE_ROOT}
     BUILD_BYPRODUCTS  ${ZLIB_BYPRODUCTS}
-    CMAKE_ARGS        ${CMAKE_C_FORWARD_ARGS}
-    INSTALL_COMMAND   ${CMAKE_NOOP}
+    CMAKE_ARGS        ${ZLIB_CMAKE_ARGS}
+    INSTALL_DIR       ${ZLIB_ROOT}-lib
     URL               ${ZLIB_URL}
     URL_HASH          ${ZLIB_HASH})
 else ()


[5/7] mesos git commit: Building gRPC support in libprocess with CMake.

Posted by ch...@apache.org.
Building gRPC support in libprocess with CMake.

This patch enables CMake to build code for gRPC support in libprocess
along with tests.

Review: https://reviews.apache.org/r/61118/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8021e293
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8021e293
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8021e293

Branch: refs/heads/master
Commit: 8021e29381dedf4dd8082f6f889e2f4e67505d2a
Parents: a2ee950
Author: Chun-Hung Hsiao <ch...@apache.org>
Authored: Fri Apr 20 18:17:50 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri Apr 20 18:17:50 2018 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/CMakeLists.txt       |  6 ++++++
 3rdparty/libprocess/src/tests/CMakeLists.txt | 25 +++++++++++++++++++++++
 2 files changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8021e293/3rdparty/libprocess/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/CMakeLists.txt b/3rdparty/libprocess/src/CMakeLists.txt
index 1eca50a..cf443df 100644
--- a/3rdparty/libprocess/src/CMakeLists.txt
+++ b/3rdparty/libprocess/src/CMakeLists.txt
@@ -71,6 +71,11 @@ else ()
     subprocess_posix.cpp)
 endif ()
 
+if (ENABLE_GRPC)
+  list(APPEND PROCESS_SRC
+    grpc.cpp)
+endif ()
+
 if (ENABLE_LIBEVENT)
   list(APPEND PROCESS_SRC
     libevent.hpp
@@ -102,6 +107,7 @@ target_link_libraries(
   process PUBLIC
   stout
   http_parser
+  $<$<BOOL:${ENABLE_GRPC}>:grpc>
   $<$<BOOL:${ENABLE_SSL}>:OpenSSL::SSL>
   $<$<BOOL:${ENABLE_SSL}>:OpenSSL::Crypto>)
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/8021e293/3rdparty/libprocess/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/CMakeLists.txt b/3rdparty/libprocess/src/tests/CMakeLists.txt
index d624402..1b2d75d 100644
--- a/3rdparty/libprocess/src/tests/CMakeLists.txt
+++ b/3rdparty/libprocess/src/tests/CMakeLists.txt
@@ -49,6 +49,28 @@ if (NOT WIN32)
     reap_tests.cpp)
 endif ()
 
+if (ENABLE_GRPC)
+  set(GRPC_TESTS_PROTOS
+    grpc_tests.grpc.pb.cc
+    grpc_tests.grpc.pb.h
+    grpc_tests.pb.cc
+    grpc_tests.pb.h)
+
+  list(APPEND PROCESS_TESTS_SRC
+    grpc_tests.cpp
+    ${GRPC_TESTS_PROTOS})
+
+  add_custom_command(
+    OUTPUT ${GRPC_TESTS_PROTOS}
+    COMMAND protoc
+      -I${CMAKE_CURRENT_SOURCE_DIR}
+      --cpp_out=${CMAKE_CURRENT_BINARY_DIR}
+      --grpc_out=${CMAKE_CURRENT_BINARY_DIR}
+      --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin>
+      ${CMAKE_CURRENT_SOURCE_DIR}/grpc_tests.proto
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/grpc_tests.proto)
+endif ()
+
 if (ENABLE_SSL)
   list(APPEND PROCESS_TESTS_SRC
     jwt_tests.cpp
@@ -62,6 +84,9 @@ target_include_directories(process-interface INTERFACE ..)
 add_executable(libprocess-tests EXCLUDE_FROM_ALL ${PROCESS_TESTS_SRC})
 target_link_libraries(libprocess-tests PRIVATE process-interface)
 
+# NOTE: This is for the generated gRPC headers.
+target_include_directories(libprocess-tests PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+
 target_compile_definitions(
   libprocess-tests PRIVATE
   BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}")