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 2017/08/22 22:27:50 UTC

[6/6] mesos git commit: Added Autotools rules to build the CSI client module in Mesos.

Added Autotools rules to build the CSI client module in Mesos.

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


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

Branch: refs/heads/master
Commit: 38a889cb28b52eff67e642ac346281a3f10195d2
Parents: 4073428
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Tue Aug 22 14:32:24 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Aug 22 15:20:47 2017 -0700

----------------------------------------------------------------------
 3rdparty/Makefile.am |  7 ++++++
 3rdparty/versions.am |  1 +
 src/Makefile.am      | 63 ++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 59 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/38a889cb/3rdparty/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/Makefile.am b/3rdparty/Makefile.am
index 2182837..687f52d 100644
--- a/3rdparty/Makefile.am
+++ b/3rdparty/Makefile.am
@@ -50,6 +50,7 @@ include versions.am
 
 BOOST = boost-$(BOOST_VERSION)
 CONCURRENTQUEUE = concurrentqueue-$(CONCURRENTQUEUE_VERSION)
+CSI = csi-$(CSI_VERSION)
 ELFIO = elfio-$(ELFIO_VERSION)
 GLOG = glog-$(GLOG_VERSION)
 GOOGLETEST = googletest-release-$(GOOGLETEST_VERSION)
@@ -71,6 +72,7 @@ ZOOKEEPER = zookeeper-$(ZOOKEEPER_VERSION)
 EXTRA_DIST =			\
   $(BOOST).tar.gz		\
   $(CONCURRENTQUEUE).tar.gz	\
+  $(CSI).tar.gz			\
   $(ELFIO).tar.gz		\
   $(GLOG).tar.gz		\
   $(GOOGLETEST).tar.gz		\
@@ -112,6 +114,7 @@ EXTRA_DIST +=		\
 CLEAN_EXTRACTED =		\
   $(BOOST)			\
   $(CONCURRENTQUEUE)		\
+  $(CSI)			\
   $(ELFIO)			\
   $(GLOG)			\
   $(GOOGLETEST)			\
@@ -332,6 +335,10 @@ $(GRPC)-build-stamp:
 endif
 endif
 
+if ENABLE_GRPC
+ALL_LOCAL += $(CSI)-stamp
+endif
+
 # Convenience library for gmock/gtest.
 check_LTLIBRARIES = libgmock.la
 nodist_libgmock_la_SOURCES = gmock_sources.cc

http://git-wip-us.apache.org/repos/asf/mesos/blob/38a889cb/3rdparty/versions.am
----------------------------------------------------------------------
diff --git a/3rdparty/versions.am b/3rdparty/versions.am
index 82d66be..cbab26d 100644
--- a/3rdparty/versions.am
+++ b/3rdparty/versions.am
@@ -21,6 +21,7 @@
 
 BOOST_VERSION = 1.53.0
 CONCURRENTQUEUE_VERSION = 1.0.0-beta
+CSI_VERSION = 0.1.0
 ELFIO_VERSION = 3.2
 GLOG_VERSION = 0.3.3
 GOOGLETEST_VERSION = 1.8.0

http://git-wip-us.apache.org/repos/asf/mesos/blob/38a889cb/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 87cc395..dffa608 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,7 @@ include ../3rdparty/versions.am
 
 # TODO(charles): Move these into an included automakefile and have
 # them include $(top_builddir) as appropriate.
+CSI = 3rdparty/csi-$(CSI_VERSION)
 LEVELDB = 3rdparty/leveldb-$(LEVELDB_VERSION)
 PIP = 3rdparty/pip-$(PIP_VERSION)
 SETUPTOOLS = 3rdparty/setuptools-$(SETUPTOOLS_VERSION)
@@ -58,15 +59,6 @@ testlibexecdir = $(pkglibexecdir)/tests
 pkgmoduledir = $(pkglibdir)/modules
 relative_pkgmoduledir = $(PACKAGE)/modules
 
-if WITH_BUNDLED_PROTOBUF
-# Protocol buffer compiler.
-PROTOC = ../$(PROTOBUF)/src/protoc
-else
-PROTOC = @PROTOCOMPILER@
-endif
-
-PROTOCFLAGS = -I$(top_srcdir)/include -I$(srcdir)
-
 # Initialize variables here so we can use += operator everywhere else.
 lib_LTLIBRARIES =
 pkgmodule_LTLIBRARIES =
@@ -176,6 +168,7 @@ endif
 
 if ENABLE_GRPC
 if WITH_BUNDLED_GRPC
+MESOS_CPPFLAGS += -I../$(GRPC)/include
 LIB_GRPC = ../$(GRPC)/libs/opt/libgrpc++.a	\
            ../$(GRPC)/libs/opt/libgrpc.a	\
            ../$(GRPC)/libs/opt/libgpr.a		\
@@ -218,9 +211,11 @@ endif
 if WITH_BUNDLED_PROTOBUF
 MESOS_CPPFLAGS += -I../$(PROTOBUF)/src
 LIB_PROTOBUF = ../$(PROTOBUF)/src/libprotobuf.la
+PROTOC = ../$(PROTOBUF)/src/protoc
 else
 LIB_PROTOBUF = -lprotobuf
 LDADD += -lprotobuf
+PROTOC = @PROTOCOMPILER@
 endif
 
 if WITH_BUNDLED_STOUT
@@ -238,6 +233,12 @@ endif
 
 MESOS_CPPFLAGS += -DHAS_AUTHENTICATION=1
 
+# Set up include paths for the protocol buffer compiler.
+PROTOCFLAGS = -I$(top_srcdir)/include -I$(srcdir)
+if ENABLE_GRPC
+PROTOCFLAGS += -I../$(CSI)
+endif
+
 # README: we build the Mesos library out of a collection of
 # convenience libraries (that is, libraries that do not get installed
 # but we can use as building blocks to vary compile flags as necessary
@@ -363,6 +364,14 @@ CXX_PROTOS +=								\
   slave/containerizer/mesos/isolators/network/cni/spec.pb.cc		\
   slave/containerizer/mesos/isolators/network/cni/spec.pb.h
 
+if ENABLE_GRPC
+CXX_CSI_PROTOS =							\
+  csi/csi.grpc.pb.cc							\
+  csi/csi.grpc.pb.h							\
+  csi/csi.pb.cc								\
+  csi/csi.pb.h
+endif
+
 CXX_LOG_PROTOS =							\
   messages/log.pb.cc							\
   messages/log.pb.h
@@ -402,6 +411,7 @@ V1_PYTHON_PROTOS =                                                      \
   python/interface/src/mesos/v1/interface/scheduler_pb2.py
 
 BUILT_SOURCES +=							\
+  $(CXX_CSI_PROTOS)							\
   $(CXX_LOG_PROTOS)							\
   $(CXX_PROTOS)								\
   $(CXX_STATE_PROTOS)							\
@@ -411,6 +421,7 @@ BUILT_SOURCES +=							\
   $(V1_PYTHON_PROTOS)
 
 CLEANFILES +=								\
+  $(CXX_CSI_PROTOS)							\
   $(CXX_LOG_PROTOS)							\
   $(CXX_PROTOS)								\
   $(CXX_STATE_PROTOS)							\
@@ -420,13 +431,19 @@ CLEANFILES +=								\
   $(V1_PYTHON_PROTOS)
 
 
-# Targets for generating C++ protocol buffer code.
+# Targets for generating C++ protocol buffer and gRPC code.
 ../include/mesos/%.pb.cc ../include/mesos/%.pb.h: $(top_srcdir)/include/mesos/%.proto
 	$(PROTOC) $(PROTOCFLAGS) --cpp_out=../include $^
 
+csi/%.pb.cc csi/%.pb.h: ../$(CSI)/%.proto
+	$(PROTOC) $(PROTOCFLAGS) --cpp_out=csi $^
+
 %.pb.cc %.pb.h: %.proto
 	$(PROTOC) $(PROTOCFLAGS) --cpp_out=. $^
 
+csi/%.grpc.pb.cc csi/%.grpc.pb.h: ../$(CSI)/%.proto
+	$(PROTOC) $(PROTOCFLAGS) --grpc_out=csi $^		\
+	          --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN)
 
 # Targets for generating Java protocol buffer code.
 java/generated/org/apache/mesos/executor/Protos.java: $(EXECUTOR_PROTO)
@@ -1374,7 +1391,7 @@ endif
 
 if ENABLE_SSL
 libmesos_no_3rdparty_la_SOURCES +=					\
-  authentication/executor/jwt_secret_generator.cpp				\
+  authentication/executor/jwt_secret_generator.cpp			\
   authentication/executor/jwt_secret_generator.hpp
 endif
 
@@ -1421,6 +1438,21 @@ libbuild_la_CPPFLAGS += -DBUILD_FLAGS="\"$$BUILD_FLAGS\""
 libmesos_no_3rdparty_la_LIBADD += libbuild.la
 
 
+if ENABLE_GRPC
+# Convenience library for build the CSI client.
+noinst_LTLIBRARIES += libcsi.la
+libcsi_la_SOURCES =							\
+  csi/client.cpp
+libcsi_la_SOURCES +=							\
+  csi/client.hpp							\
+  csi/spec.hpp
+nodist_libcsi_la_SOURCES = $(CXX_CSI_PROTOS)
+libcsi_la_CPPFLAGS = $(MESOS_CPPFLAGS)
+
+libmesos_no_3rdparty_la_LIBADD += libcsi.la
+endif
+
+
 # Convenience library for building the replicated log in order to
 # include the leveldb headers.
 noinst_LTLIBRARIES += liblog.la
@@ -2446,7 +2478,7 @@ mesos_tests_CPPFLAGS += -isystem ../$(GMOCK)/include
 mesos_tests_CPPFLAGS += -DTESTLIBEXECDIR=\"$(testlibexecdir)\"
 mesos_tests_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
 
-mesos_tests_LDADD = ../3rdparty/libgmock.la libmesos.la $(LDADD)
+mesos_tests_LDADD = ../3rdparty/libgmock.la libmesos.la $(LIB_GRPC) $(LDADD)
 
 if !OS_FREEBSD
   mesos_tests_LDADD += -ldl # FreeBSD includes dynamic lib utils in libc.
@@ -2489,6 +2521,13 @@ mesos_tests_SOURCES +=						\
   tests/containerizer/routing_tests.cpp
 endif
 
+if ENABLE_GRPC
+mesos_tests_SOURCES +=						\
+  tests/csi_client_tests.cpp					\
+  tests/mock_csi_plugin.cpp					\
+  tests/mock_csi_plugin.hpp
+endif
+
 if ENABLE_SSL
 mesos_tests_SOURCES +=						\
   tests/secret_generator_tests.cpp