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

[mesos] 03/03: Windows: Added CMake logic to download and "install" `wclayer.exe`.

This is an automated email from the ASF dual-hosted git repository.

jieyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 715e58a4001656e39b3386e5ad57965b291b406d
Author: Liangyu Zhao <t-...@microsoft.com>
AuthorDate: Wed Aug 29 12:16:59 2018 -0700

    Windows: Added CMake logic to download and "install" `wclayer.exe`.
    
    Review: https://reviews.apache.org/r/67984/
---
 3rdparty/CMakeLists.txt  | 40 ++++++++++++++++++++++++++++++++++++----
 src/slave/CMakeLists.txt | 12 ++++++++----
 2 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index d083aa5..1a4ed5a 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -51,10 +51,11 @@ if (WIN32)
   # NOTE: These dependencies are only rebundled on Windows because they
   # are available as installable packages on Linux; so they live
   # exclusively in the 3rdparty repo.
-  set(CURL_URL   ${3RDPARTY_DEPENDENCIES}/curl-${CURL_VERSION}.tar.gz)
-  set(LIBAPR_URL ${3RDPARTY_DEPENDENCIES}/libapr-${LIBAPR_VERSION}.tar.gz)
-  set(ZLIB_URL   ${3RDPARTY_DEPENDENCIES}/zlib-${ZLIB_VERSION}.tar.gz)
-  set(SASL2_URL  ${3RDPARTY_DEPENDENCIES}/cyrus-sasl-${SASL2_VERSION}.tar.gz)
+  set(CURL_URL    ${3RDPARTY_DEPENDENCIES}/curl-${CURL_VERSION}.tar.gz)
+  set(LIBAPR_URL  ${3RDPARTY_DEPENDENCIES}/libapr-${LIBAPR_VERSION}.tar.gz)
+  set(ZLIB_URL    ${3RDPARTY_DEPENDENCIES}/zlib-${ZLIB_VERSION}.tar.gz)
+  set(SASL2_URL   ${3RDPARTY_DEPENDENCIES}/cyrus-sasl-${SASL2_VERSION}.tar.gz)
+  set(WCLAYER_URL ${3RDPARTY_DEPENDENCIES}/wclayer.exe)
 
   # NOTE: The Windows version of Glog is patched and only available in the
   # 3rdparty repo, not the local repo.
@@ -791,6 +792,37 @@ else ()
 endif ()
 
 
+# wclayer: Command line tool for manipulating Windows Container
+# storage layers.
+# https://github.com/Microsoft/hcsshim/blob/master/cmd/wclayer/wclayer.go
+#########################################################################
+if (WIN32)
+  EXTERNAL(wclayer WIP ${CMAKE_CURRENT_BINARY_DIR})
+
+  add_executable(wclayer IMPORTED GLOBAL)
+  add_dependencies(wclayer ${WCLAYER_TARGET})
+
+  # TODO(liazha): Change this to wherever you need it placed.
+  set(WCLAYER_PATH ${CMAKE_BINARY_DIR}/src/wclayer.exe)
+  set_target_properties(
+    wclayer PROPERTIES
+    IMPORTED_LOCATION ${WCLAYER_PATH})
+
+  set(WCLAYER_INSTALL_CMD ${CMAKE_COMMAND} -E copy ${WCLAYER_CMAKE_ROOT}/src/wclayer.exe ${WCLAYER_PATH})
+
+  GET_BYPRODUCTS(wclayer)
+
+  ExternalProject_Add(
+    ${WCLAYER_TARGET}
+    PREFIX              ${WCLAYER_CMAKE_ROOT}
+    BUILD_BYPRODUCTS    ${WCLAYER_BYPRODUCTS}
+    CONFIGURE_COMMAND   ${CMAKE_NOOP}
+    BUILD_COMMAND       ${CMAKE_NOOP}
+    INSTALL_COMMAND     ${WCLAYER_INSTALL_CMD}
+    DOWNLOAD_NO_EXTRACT FALSE
+    URL                 ${WCLAYER_URL})
+endif ()
+
 # bzip2: A high-quality data compressor.
 # http://www.bzip.org
 ########################################
diff --git a/src/slave/CMakeLists.txt b/src/slave/CMakeLists.txt
index e5fe32a..f42a4a6 100644
--- a/src/slave/CMakeLists.txt
+++ b/src/slave/CMakeLists.txt
@@ -40,10 +40,14 @@ add_dependencies(
   mesos-usage)
 
 if (WIN32)
-  # NOTE: The agent depends on `curl` on non-Windows platforms too, but not as
-  # part of the build. This is necessary because we use CMake to deploy
-  # `curl.exe` on Windows for use in the HTTP health checks.
-  add_dependencies(mesos-agent curl)
+  # NOTE: The agent depends on `curl` on non-Windows platforms too,
+  # but not as part of the build. This is necessary because we use
+  # CMake to deploy `curl.exe` on Windows for use in the HTTP health
+  # checks. Similarly we depend on `wclayer` to be deployed.
+  add_dependencies(
+    mesos-agent
+    curl
+    wclayer)
 else ()
   add_dependencies(
     mesos-agent