Fixing C++ and ruby code generators for the opensource build.

Change on 2014/12/11 by nnoble <nnoble@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81921764
pull/1/merge
nnoble 10 years ago committed by Nicolas Noble
parent 87da1b937d
commit c78b34075d
  1. 13
      Makefile
  2. 2
      build.json
  3. 4
      src/compiler/ruby_generator.cc
  4. 8
      src/compiler/ruby_generator.h
  5. 5
      src/compiler/ruby_generator_map-inl.h
  6. 13
      templates/Makefile.template

File diff suppressed because one or more lines are too long

@ -365,6 +365,7 @@
{
"name": "cpp_plugin",
"build": "protoc",
"c++": true,
"src": [
"src/compiler/cpp_plugin.cpp",
"src/compiler/cpp_generator.cpp"
@ -378,6 +379,7 @@
{
"name": "ruby_plugin",
"build": "protoc",
"c++": true,
"src": [
"src/compiler/ruby_plugin.cpp",
"src/compiler/ruby_generator.cpp"

@ -59,11 +59,11 @@ namespace {
void PrintMethod(const MethodDescriptor* method, const string& package,
Printer* out) {
string input_type = RubyTypeOf(method->input_type()->name(), package);
if (method->options().has_client_streaming()) {
if (method->client_streaming()) {
input_type = "stream(" + input_type + ")";
}
string output_type = RubyTypeOf(method->output_type()->name(), package);
if (method->options().has_server_streaming()) {
if (method->server_streaming()) {
output_type = "stream(" + output_type + ")";
}
map<string, string> method_vars = ListToDict({

@ -36,9 +36,13 @@
#include <string>
namespace proto2 {
using namespace std;
namespace google {
namespace protobuf {
class FileDescriptor;
} // namespace proto2
} // namespace protobuf
} // namespace google
namespace grpc_ruby_generator {

@ -40,7 +40,6 @@
#include <string>
#include <vector>
#include "base/logging.h"
using std::initializer_list;
using std::map;
@ -52,11 +51,11 @@ namespace grpc_ruby_generator {
// into a map of key* to value*. Is merely a readability helper for later code.
inline map<string, string> ListToDict(const initializer_list<string>& values) {
if (values.size() % 2 != 0) {
LOG(FATAL) << "Not every 'key' has a value in `values`.";
// MOE: insert std::cerr << "Not every 'key' has a value in `values`." << std::endl;
}
map<string, string> value_map;
auto value_iter = values.begin();
for (int i = 0; i < values.size()/2; ++i) {
for (unsigned i = 0; i < values.size()/2; ++i) {
string key = *value_iter;
++value_iter;
string value = *value_iter;

@ -86,6 +86,7 @@ INCLUDES = . include gens
LIBS = rt m z event event_pthreads pthread
LIBSXX = protobuf
LIBS_SECURE = ssl crypto dl
LIBS_PROTOC = protoc protobuf
ifneq ($(wildcard /usr/src/gtest/src/gtest-all.cc),)
GTEST_LIB = /usr/src/gtest/src/gtest-all.cc -I/usr/src/gtest
@ -110,6 +111,7 @@ LDFLAGS += $(ARCH_FLAGS)
LDLIBS += $(addprefix -l, $(LIBS))
LDLIBSXX += $(addprefix -l, $(LIBSXX))
LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE))
LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC))
.SECONDARY = %.pb.h %.pb.cc
@ -466,7 +468,7 @@ libs/lib${lib.name}.so.$(VERSION): $(LIB${lib.name.upper()}_OBJS)
% endif
-o libs/lib${lib.name}.so.$(VERSION) $(LIB${lib.name.upper()}_OBJS) $(LDLIBS)\
% if lib.secure:
$(LDLIBS_SECURE)
$(LDLIBS_SECURE)\
% endif
% endif
@ -504,7 +506,11 @@ bins/${tgt.name}: $(${tgt.name.upper()}_OBJS)\
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
% if tgt.get("c++", False):
$(Q) $(LDXX) $(LDFLAGS) $(${tgt.name.upper()}_OBJS) $(GTEST_LIB) -Llibs\
$(Q) $(LDXX) $(LDFLAGS) $(${tgt.name.upper()}_OBJS)\
% if tgt.build == 'test':
$(GTEST_LIB)\
% endif
-Llibs\
% else:
$(Q) $(LD) $(LDFLAGS) $(${tgt.name.upper()}_OBJS) -Llibs\
% endif
@ -517,6 +523,9 @@ bins/${tgt.name}: $(${tgt.name.upper()}_OBJS)\
$(LDLIBS)\
% if tgt.get('secure', True):
$(LDLIBS_SECURE)\
% endif
% if tgt.build == 'protoc':
$(LDLIBS_PROTOC)\
% endif
-o bins/${tgt.name}

Loading…
Cancel
Save