aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-03-26 00:20:13 +0100
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-03-26 00:20:13 +0100
commit714cf6982ad1073a6377f6ced625122cb5a1872c (patch)
tree77641f5dc5d192cab580600e5c884164b63b0a8d
parent96e32aa0a59dde18db2e010a3c84641933e2d8d3 (diff)
Moving all of the codegens into a temporary static library.
This will allow us to re-use code generators in other kind of protoc plugins.
-rw-r--r--Makefile50
-rw-r--r--build.json32
2 files changed, 49 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 0742994982..700b56adaa 100644
--- a/Makefile
+++ b/Makefile
@@ -3585,30 +3585,40 @@ $(OBJDIR)/$(CONFIG)/src/cpp/util/status.o:
$(OBJDIR)/$(CONFIG)/src/cpp/util/time.o:
-LIBGRPC_PYTHON_PLUGIN_SUPPORT_SRC = \
+LIBGRPC_PLUGIN_SUPPORT_SRC = \
+ src/compiler/cpp_generator.cc \
src/compiler/python_generator.cc \
+ src/compiler/ruby_generator.cc \
PUBLIC_HEADERS_CXX += \
+ src/compiler/config.h \
+ src/compiler/cpp_generator.h \
+ src/compiler/cpp_generator_helpers.h \
+ src/compiler/generator_helpers.h \
src/compiler/python_generator.h \
+ src/compiler/ruby_generator.h \
+ src/compiler/ruby_generator_helpers-inl.h \
+ src/compiler/ruby_generator_map-inl.h \
+ src/compiler/ruby_generator_string-inl.h \
-LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_SRC))))
+LIBGRPC_PLUGIN_SUPPORT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_PLUGIN_SUPPORT_SRC))))
ifeq ($(NO_PROTOBUF),true)
# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay.
-$(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a: protobuf_dep_error
+$(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a: protobuf_dep_error
else
-$(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS)
+$(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBGRPC_PLUGIN_SUPPORT_OBJS)
$(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@`
- $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a
- $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS)
+ $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
+ $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(LIBGRPC_PLUGIN_SUPPORT_OBJS)
ifeq ($(SYSTEM),Darwin)
- $(Q) ranlib $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a
+ $(Q) ranlib $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
endif
@@ -3617,10 +3627,12 @@ endif
endif
ifneq ($(NO_DEPS),true)
--include $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS:.o=.dep)
+-include $(LIBGRPC_PLUGIN_SUPPORT_OBJS:.o=.dep)
endif
+$(OBJDIR)/$(CONFIG)/src/compiler/cpp_generator.o:
$(OBJDIR)/$(CONFIG)/src/compiler/python_generator.o:
+$(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o:
LIBPUBSUB_CLIENT_LIB_SRC = \
@@ -8188,7 +8200,6 @@ endif
GRPC_CPP_PLUGIN_SRC = \
- src/compiler/cpp_generator.cc \
src/compiler/cpp_plugin.cc \
GRPC_CPP_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_CPP_PLUGIN_SRC))))
@@ -8202,15 +8213,14 @@ $(BINDIR)/$(CONFIG)/grpc_cpp_plugin: protobuf_dep_error
else
-$(BINDIR)/$(CONFIG)/grpc_cpp_plugin: $(PROTOBUF_DEP) $(GRPC_CPP_PLUGIN_OBJS)
+$(BINDIR)/$(CONFIG)/grpc_cpp_plugin: $(PROTOBUF_DEP) $(GRPC_CPP_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
$(E) "[HOSTLD] Linking $@"
$(Q) mkdir -p `dirname $@`
- $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_CPP_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_cpp_plugin
+ $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_CPP_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_cpp_plugin
endif
-$(OBJDIR)/$(CONFIG)/src/compiler/cpp_generator.o:
-$(OBJDIR)/$(CONFIG)/src/compiler/cpp_plugin.o:
+$(OBJDIR)/$(CONFIG)/src/compiler/cpp_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
deps_grpc_cpp_plugin: $(GRPC_CPP_PLUGIN_OBJS:.o=.dep)
@@ -8233,14 +8243,14 @@ $(BINDIR)/$(CONFIG)/grpc_python_plugin: protobuf_dep_error
else
-$(BINDIR)/$(CONFIG)/grpc_python_plugin: $(PROTOBUF_DEP) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a
+$(BINDIR)/$(CONFIG)/grpc_python_plugin: $(PROTOBUF_DEP) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
$(E) "[HOSTLD] Linking $@"
$(Q) mkdir -p `dirname $@`
- $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_python_plugin
+ $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_python_plugin
endif
-$(OBJDIR)/$(CONFIG)/src/compiler/python_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a
+$(OBJDIR)/$(CONFIG)/src/compiler/python_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
deps_grpc_python_plugin: $(GRPC_PYTHON_PLUGIN_OBJS:.o=.dep)
@@ -8250,7 +8260,6 @@ endif
GRPC_RUBY_PLUGIN_SRC = \
- src/compiler/ruby_generator.cc \
src/compiler/ruby_plugin.cc \
GRPC_RUBY_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_RUBY_PLUGIN_SRC))))
@@ -8264,15 +8273,14 @@ $(BINDIR)/$(CONFIG)/grpc_ruby_plugin: protobuf_dep_error
else
-$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: $(PROTOBUF_DEP) $(GRPC_RUBY_PLUGIN_OBJS)
+$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: $(PROTOBUF_DEP) $(GRPC_RUBY_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
$(E) "[HOSTLD] Linking $@"
$(Q) mkdir -p `dirname $@`
- $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
+ $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_RUBY_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
endif
-$(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o:
-$(OBJDIR)/$(CONFIG)/src/compiler/ruby_plugin.o:
+$(OBJDIR)/$(CONFIG)/src/compiler/ruby_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
deps_grpc_ruby_plugin: $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep)
diff --git a/build.json b/build.json
index a46866263f..2b56dc6e87 100644
--- a/build.json
+++ b/build.json
@@ -498,14 +498,24 @@
"secure": "no"
},
{
- "name": "grpc_python_plugin_support",
+ "name": "grpc_plugin_support",
"build": "protoc",
"language": "c++",
"public_headers": [
- "src/compiler/python_generator.h"
+ "src/compiler/config.h",
+ "src/compiler/cpp_generator.h",
+ "src/compiler/cpp_generator_helpers.h",
+ "src/compiler/generator_helpers.h",
+ "src/compiler/python_generator.h",
+ "src/compiler/ruby_generator.h",
+ "src/compiler/ruby_generator_helpers-inl.h",
+ "src/compiler/ruby_generator_map-inl.h",
+ "src/compiler/ruby_generator_string-inl.h"
],
"src": [
- "src/compiler/python_generator.cc"
+ "src/compiler/cpp_generator.cc",
+ "src/compiler/python_generator.cc",
+ "src/compiler/ruby_generator.cc"
],
"deps": [],
"secure": "no"
@@ -1758,15 +1768,12 @@
"name": "grpc_cpp_plugin",
"build": "protoc",
"language": "c++",
- "headers": [
- "src/compiler/cpp_generator.h",
- "src/compiler/cpp_generator_helpers.h"
- ],
"src": [
- "src/compiler/cpp_generator.cc",
"src/compiler/cpp_plugin.cc"
],
- "deps": [],
+ "deps": [
+ "grpc_plugin_support"
+ ],
"secure": "no"
},
{
@@ -1777,7 +1784,7 @@
"src/compiler/python_plugin.cc"
],
"deps": [
- "grpc_python_plugin_support"
+ "grpc_plugin_support"
],
"secure": "no"
},
@@ -1786,10 +1793,11 @@
"build": "protoc",
"language": "c++",
"src": [
- "src/compiler/ruby_generator.cc",
"src/compiler/ruby_plugin.cc"
],
- "deps": [],
+ "deps": [
+ "grpc_plugin_support"
+ ],
"secure": "no"
},
{