|
|
|
@ -5,23 +5,28 @@ require 'rubocop/rake_task' |
|
|
|
|
require 'bundler/gem_tasks' |
|
|
|
|
|
|
|
|
|
# Add rubocop style checking tasks |
|
|
|
|
RuboCop::RakeTask.new |
|
|
|
|
RuboCop::RakeTask.new(:rubocop) do |task| |
|
|
|
|
task.options = ['-c', 'src/ruby/.rubocop.yml'] |
|
|
|
|
task.patterns = ['src/ruby/{lib,spec}/**/*.rb'] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# Add the extension compiler task |
|
|
|
|
Rake::ExtensionTask.new 'grpc' do |ext| |
|
|
|
|
ext.lib_dir = File.join('lib', 'grpc') |
|
|
|
|
ext.source_pattern = '**/*.{c,h}' |
|
|
|
|
ext.ext_dir = File.join('src', 'ruby', 'ext', 'grpc') |
|
|
|
|
ext.lib_dir = File.join('src', 'ruby', 'lib', 'grpc') |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# Define the test suites |
|
|
|
|
SPEC_SUITES = [ |
|
|
|
|
{ id: :wrapper, title: 'wrapper layer', files: %w(spec/*.rb) }, |
|
|
|
|
{ id: :idiomatic, title: 'idiomatic layer', dir: %w(spec/generic), |
|
|
|
|
{ id: :wrapper, title: 'wrapper layer', files: %w(src/ruby/spec/*.rb) }, |
|
|
|
|
{ id: :idiomatic, title: 'idiomatic layer', dir: %w(src/ruby/spec/generic), |
|
|
|
|
tags: ['~bidi', '~server'] }, |
|
|
|
|
{ id: :bidi, title: 'bidi tests', dir: %w(spec/generic), |
|
|
|
|
{ id: :bidi, title: 'bidi tests', dir: %w(src/ruby/spec/generic), |
|
|
|
|
tag: 'bidi' }, |
|
|
|
|
{ id: :server, title: 'rpc server thread tests', dir: %w(spec/generic), |
|
|
|
|
{ id: :server, title: 'rpc server thread tests', dir: %w(src/ruby/spec/generic), |
|
|
|
|
tag: 'server' }, |
|
|
|
|
{ id: :pb, title: 'protobuf service tests', dir: %w(spec/pb) } |
|
|
|
|
{ id: :pb, title: 'protobuf service tests', dir: %w(src/ruby/spec/pb) } |
|
|
|
|
] |
|
|
|
|
namespace :suite do |
|
|
|
|
SPEC_SUITES.each do |suite| |
|
|
|
@ -34,7 +39,7 @@ namespace :suite do |
|
|
|
|
if suite[:dir] |
|
|
|
|
suite[:dir].each { |f| spec_files += Dir["#{f}/**/*_spec.rb"] } |
|
|
|
|
end |
|
|
|
|
helper = 'spec/spec_helper.rb' |
|
|
|
|
helper = 'src/ruby/spec/spec_helper.rb' |
|
|
|
|
spec_files << helper unless spec_files.include?(helper) |
|
|
|
|
|
|
|
|
|
t.pattern = spec_files |