You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/12/19 03:51:11 UTC

[3/7] mesos git commit: Moved generated CSI code into public directories.

Moved generated CSI code into public directories.

This moves the Container Storage Interface (CSI) code generated from
its protobufs into the `include` directory so that other public
headers can use them.  The `csi/spec.hpp` was moved too, because
we prefer to include a layer of header indirection when adding
generated headers into non-generated headers.

An upcoming module specifically for CSI support will need to return
objects defined in the CSI specification.  And because modules have
public interfaces, we'll need the generated headers to be public too.

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


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

Branch: refs/heads/master
Commit: e5f43c990accf43e1323a78f94f7d22c135061c8
Parents: f811146
Author: Joseph Wu <jo...@apache.org>
Authored: Mon Nov 20 14:49:38 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Dec 18 15:47:46 2017 -0800

----------------------------------------------------------------------
 include/csi/spec.hpp          | 31 +++++++++++++++++++++++++++++++
 src/Makefile.am               | 24 +++++++++++++++---------
 src/csi/client.hpp            |  2 +-
 src/csi/spec.hpp              | 31 -------------------------------
 src/tests/mock_csi_plugin.hpp |  2 +-
 5 files changed, 48 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e5f43c99/include/csi/spec.hpp
----------------------------------------------------------------------
diff --git a/include/csi/spec.hpp b/include/csi/spec.hpp
new file mode 100644
index 0000000..df01f44
--- /dev/null
+++ b/include/csi/spec.hpp
@@ -0,0 +1,31 @@
+// 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.
+
+#ifndef __CSI_SPEC_HPP__
+#define __CSI_SPEC_HPP__
+
+// ONLY USEFUL AFTER RUNNING PROTOC WITH GRPC CPP PLUGIN.
+#include <csi/csi.grpc.pb.h>
+
+namespace mesos {
+namespace csi {
+
+using namespace ::csi;
+
+} // namespace csi {
+} // namespace mesos {
+
+#endif // __CSI_SPEC_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/e5f43c99/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index f5a4edd..95c0a30 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -244,6 +244,12 @@ endif
 PROTOCFLAGS = -I$(top_srcdir)/include -I$(srcdir)
 if ENABLE_GRPC
 PROTOCFLAGS += -I../$(CSI)
+
+# TODO(josephw): This is a temporary include directory which points to the
+# generated CSI protocol buffer code. Derivative protocol buffers need
+# this include in order to build. When the 3rdparty CSI repo builds its own
+# generated code, this can be changed to include that directory instead.
+MESOS_CPPFLAGS += -I../include/csi
 endif
 
 # README: we build the Mesos library out of a collection of
@@ -377,10 +383,10 @@ CXX_PROTOS +=								\
 
 if ENABLE_GRPC
 CXX_CSI_PROTOS =							\
-  csi/csi.grpc.pb.cc							\
-  csi/csi.grpc.pb.h							\
-  csi/csi.pb.cc								\
-  csi/csi.pb.h								\
+  ../include/csi/csi.grpc.pb.cc						\
+  ../include/csi/csi.grpc.pb.h						\
+  ../include/csi/csi.pb.cc						\
+  ../include/csi/csi.pb.h						\
   csi/state.pb.cc							\
   csi/state.pb.h
 endif
@@ -448,14 +454,14 @@ CLEANFILES +=								\
 ../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 $^
+../include/csi/%.pb.cc ../include/csi/%.pb.h: ../$(CSI)/%.proto
+	$(PROTOC) $(PROTOCFLAGS) --cpp_out=../include/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 $^		\
+../include/csi/%.grpc.pb.cc ../include/csi/%.grpc.pb.h: ../$(CSI)/%.proto
+	$(PROTOC) $(PROTOCFLAGS) --grpc_out=../include/csi $^		\
 	          --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN)
 
 # Targets for generating Java protocol buffer code.
@@ -1509,9 +1515,9 @@ libcsi_la_SOURCES =							\
   csi/paths.cpp								\
   csi/utils.cpp
 libcsi_la_SOURCES +=							\
+  ../include/csi/spec.hpp						\
   csi/client.hpp							\
   csi/paths.hpp								\
-  csi/spec.hpp								\
   csi/utils.hpp
 nodist_libcsi_la_SOURCES = $(CXX_CSI_PROTOS)
 libcsi_la_CPPFLAGS = $(MESOS_CPPFLAGS)

http://git-wip-us.apache.org/repos/asf/mesos/blob/e5f43c99/src/csi/client.hpp
----------------------------------------------------------------------
diff --git a/src/csi/client.hpp b/src/csi/client.hpp
index 91dda0d..0ff97ee 100644
--- a/src/csi/client.hpp
+++ b/src/csi/client.hpp
@@ -21,7 +21,7 @@
 
 #include <process/grpc.hpp>
 
-#include "csi/spec.hpp"
+#include <csi/spec.hpp>
 
 namespace mesos {
 namespace csi {

http://git-wip-us.apache.org/repos/asf/mesos/blob/e5f43c99/src/csi/spec.hpp
----------------------------------------------------------------------
diff --git a/src/csi/spec.hpp b/src/csi/spec.hpp
deleted file mode 100644
index c819be3..0000000
--- a/src/csi/spec.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.
-
-#ifndef __CSI_SPEC_HPP__
-#define __CSI_SPEC_HPP__
-
-// ONLY USEFUL AFTER RUNNING PROTOC WITH GRPC CPP PLUGIN.
-#include "csi/csi.grpc.pb.h"
-
-namespace mesos {
-namespace csi {
-
-using namespace ::csi;
-
-} // namespace csi {
-} // namespace mesos {
-
-#endif // __CSI_SPEC_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/e5f43c99/src/tests/mock_csi_plugin.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mock_csi_plugin.hpp b/src/tests/mock_csi_plugin.hpp
index 162dc64..c1a9697 100644
--- a/src/tests/mock_csi_plugin.hpp
+++ b/src/tests/mock_csi_plugin.hpp
@@ -27,7 +27,7 @@
 #include <stout/nothing.hpp>
 #include <stout/try.hpp>
 
-#include "csi/spec.hpp"
+#include <csi/spec.hpp>
 
 namespace mesos {
 namespace internal {