Skip to content
Snippets Groups Projects
Commit 386643e2 authored by Tim Emiola's avatar Tim Emiola
Browse files

Merge pull request #1589 from nicolasnoble/ruby-cleanup

Ruby cleanup
parents 98b4608f cbd9c8bf
Branches
Tags
No related merge requests found
Showing
with 50 additions and 32 deletions
...@@ -34,14 +34,26 @@ INCLUDEDIR = RbConfig::CONFIG['includedir'] ...@@ -34,14 +34,26 @@ INCLUDEDIR = RbConfig::CONFIG['includedir']
if ENV.key? 'GRPC_ROOT' if ENV.key? 'GRPC_ROOT'
GRPC_ROOT = ENV['GRPC_ROOT'] GRPC_ROOT = ENV['GRPC_ROOT']
if ENV.key? 'GRPC_LIB_DIR'
GRPC_LIB_DIR = ENV['GRPC_LIB_DIR']
else else
GRPC_LIB_DIR = 'libs/opt' grpc_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
end if File.exist?(File.join(grpc_root, 'include/grpc/grpc.h'))
GRPC_ROOT = grpc_root
else else
GRPC_ROOT = nil GRPC_ROOT = nil
end end
end
if ENV.key? 'CONFIG'
GRPC_CONFIG = ENV['CONFIG']
else
GRPC_CONFIG = 'opt'
end
if (ENV.key? 'GRPC_LIB_DIR') && (!GRPC_ROOT.nil?)
GRPC_LIB_DIR = File.join(GRPC_ROOT, ENV['GRPC_LIB_DIR'])
else
GRPC_LIB_DIR = File.join(File.join(GRPC_ROOT, 'libs'), GRPC_CONFIG)
end
HEADER_DIRS = [ HEADER_DIRS = [
# Search /opt/local (Mac source install) # Search /opt/local (Mac source install)
...@@ -67,7 +79,10 @@ LIB_DIRS = [ ...@@ -67,7 +79,10 @@ LIB_DIRS = [
unless GRPC_ROOT.nil? unless GRPC_ROOT.nil?
HEADER_DIRS.unshift File.join(GRPC_ROOT, 'include') HEADER_DIRS.unshift File.join(GRPC_ROOT, 'include')
LIB_DIRS.unshift File.join(GRPC_ROOT, GRPC_LIB_DIR) LIB_DIRS.unshift GRPC_LIB_DIR
unless File.exist?(File.join(GRPC_LIB_DIR, 'libgrpc.a'))
system("make -C #{GRPC_ROOT} static_c CONFIG=#{GRPC_CONFIG}")
end
end end
def crash(msg) def crash(msg)
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "rb_byte_buffer.h" #include "rb_byte_buffer.h"
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/support/slice.h> #include <grpc/support/slice.h>
......
...@@ -34,8 +34,9 @@ ...@@ -34,8 +34,9 @@
#ifndef GRPC_RB_BYTE_BUFFER_H_ #ifndef GRPC_RB_BYTE_BUFFER_H_
#define GRPC_RB_BYTE_BUFFER_H_ #define GRPC_RB_BYTE_BUFFER_H_
#include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <ruby.h>
/* Converts a char* with a length to a grpc_byte_buffer */ /* Converts a char* with a length to a grpc_byte_buffer */
grpc_byte_buffer *grpc_rb_s_to_byte_buffer(char *string, size_t length); grpc_byte_buffer *grpc_rb_s_to_byte_buffer(char *string, size_t length);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "rb_call.h" #include "rb_call.h"
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
......
...@@ -34,8 +34,9 @@ ...@@ -34,8 +34,9 @@
#ifndef GRPC_RB_CALL_H_ #ifndef GRPC_RB_CALL_H_
#define GRPC_RB_CALL_H_ #define GRPC_RB_CALL_H_
#include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <ruby.h>
/* Gets the wrapped call from a VALUE. */ /* Gets the wrapped call from a VALUE. */
grpc_call* grpc_rb_get_wrapped_call(VALUE v); grpc_call* grpc_rb_get_wrapped_call(VALUE v);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "rb_channel.h" #include "rb_channel.h"
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
#ifndef GRPC_RB_CHANNEL_H_ #ifndef GRPC_RB_CHANNEL_H_
#define GRPC_RB_CHANNEL_H_ #define GRPC_RB_CHANNEL_H_
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
/* Initializes the Channel class. */ /* Initializes the Channel class. */
......
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
#include "rb_channel_args.h" #include "rb_channel_args.h"
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include "rb_grpc.h" #include "rb_grpc.h"
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
#ifndef GRPC_RB_CHANNEL_ARGS_H_ #ifndef GRPC_RB_CHANNEL_ARGS_H_
#define GRPC_RB_CHANNEL_ARGS_H_ #define GRPC_RB_CHANNEL_ARGS_H_
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
/* Converts a hash object containing channel args to a channel args instance. /* Converts a hash object containing channel args to a channel args instance.
......
...@@ -34,8 +34,9 @@ ...@@ -34,8 +34,9 @@
#ifndef GRPC_RB_COMPLETION_QUEUE_H_ #ifndef GRPC_RB_COMPLETION_QUEUE_H_
#define GRPC_RB_COMPLETION_QUEUE_H_ #define GRPC_RB_COMPLETION_QUEUE_H_
#include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <ruby.h>
/* Gets the wrapped completion queue from the ruby wrapper */ /* Gets the wrapped completion queue from the ruby wrapper */
grpc_completion_queue *grpc_rb_get_wrapped_completion_queue(VALUE v); grpc_completion_queue *grpc_rb_get_wrapped_completion_queue(VALUE v);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "rb_credentials.h" #include "rb_credentials.h"
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
#ifndef GRPC_RB_CREDENTIALS_H_ #ifndef GRPC_RB_CREDENTIALS_H_
#define GRPC_RB_CREDENTIALS_H_ #define GRPC_RB_CREDENTIALS_H_
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
/* Initializes the ruby Credentials class. */ /* Initializes the ruby Credentials class. */
......
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
#define GRPC_RB_H_ #define GRPC_RB_H_
#include <sys/time.h> #include <sys/time.h>
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
/* grpc_rb_mGrpcCore is the module containing the ruby wrapper GRPC classes. */ /* grpc_rb_mGrpcCore is the module containing the ruby wrapper GRPC classes. */
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "rb_server.h" #include "rb_server.h"
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
#ifndef GRPC_RB_SERVER_H_ #ifndef GRPC_RB_SERVER_H_
#define GRPC_RB_SERVER_H_ #define GRPC_RB_SERVER_H_
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
/* Initializes the Server class. */ /* Initializes the Server class. */
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "rb_server_credentials.h" #include "rb_server_credentials.h"
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
#ifndef GRPC_RB_SERVER_CREDENTIALS_H_ #ifndef GRPC_RB_SERVER_CREDENTIALS_H_
#define GRPC_RB_SERVER_CREDENTIALS_H_ #define GRPC_RB_SERVER_CREDENTIALS_H_
#include <ruby.h> #include <ruby/ruby.h>
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
/* Initializes the ruby ServerCredentials class. */ /* Initializes the ruby ServerCredentials class. */
......
...@@ -31,17 +31,10 @@ ...@@ -31,17 +31,10 @@
set -ex set -ex
CONFIG=${CONFIG:-opt} export CONFIG=${CONFIG:-opt}
# change to grpc repo root # change to grpc's ruby directory
cd $(dirname $0)/../.. cd $(dirname $0)/../../src/ruby
# tells npm install to look for files in that directory
export GRPC_ROOT=`pwd`
# tells npm install the subdirectory with library files
export GRPC_LIB_SUBDIR=libs/$CONFIG
cd src/ruby
bundle install bundle install
rake compile:grpc rake compile:grpc
...@@ -214,7 +214,7 @@ class RubyLanguage(object): ...@@ -214,7 +214,7 @@ class RubyLanguage(object):
return [config.job_spec(['tools/run_tests/run_ruby.sh'], None)] return [config.job_spec(['tools/run_tests/run_ruby.sh'], None)]
def make_targets(self): def make_targets(self):
return ['static_c'] return ['run_dep_checks']
def build_steps(self): def build_steps(self):
return [['tools/run_tests/build_ruby.sh']] return [['tools/run_tests/build_ruby.sh']]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment