mirror of https://github.com/grpc/grpc.git
The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)
https://grpc.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.1 KiB
64 lines
2.1 KiB
10 years ago
|
# -*- ruby -*-
|
||
|
require 'rake/extensiontask'
|
||
|
require 'rspec/core/rake_task'
|
||
10 years ago
|
require 'rubocop/rake_task'
|
||
10 years ago
|
require 'bundler/gem_tasks'
|
||
10 years ago
|
|
||
10 years ago
|
# Add rubocop style checking tasks
|
||
9 years ago
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
||
|
task.options = ['-c', 'src/ruby/.rubocop.yml']
|
||
|
task.patterns = ['src/ruby/{lib,spec}/**/*.rb']
|
||
|
end
|
||
10 years ago
|
|
||
10 years ago
|
# Add the extension compiler task
|
||
10 years ago
|
Rake::ExtensionTask.new 'grpc' do |ext|
|
||
9 years ago
|
ext.source_pattern = '**/*.{c,h}'
|
||
|
ext.ext_dir = File.join('src', 'ruby', 'ext', 'grpc')
|
||
|
ext.lib_dir = File.join('src', 'ruby', 'lib', 'grpc')
|
||
10 years ago
|
end
|
||
|
|
||
10 years ago
|
# Define the test suites
|
||
10 years ago
|
SPEC_SUITES = [
|
||
9 years ago
|
{ id: :wrapper, title: 'wrapper layer', files: %w(src/ruby/spec/*.rb) },
|
||
|
{ id: :idiomatic, title: 'idiomatic layer', dir: %w(src/ruby/spec/generic),
|
||
10 years ago
|
tags: ['~bidi', '~server'] },
|
||
9 years ago
|
{ id: :bidi, title: 'bidi tests', dir: %w(src/ruby/spec/generic),
|
||
10 years ago
|
tag: 'bidi' },
|
||
9 years ago
|
{ id: :server, title: 'rpc server thread tests', dir: %w(src/ruby/spec/generic),
|
||
9 years ago
|
tag: 'server' },
|
||
9 years ago
|
{ id: :pb, title: 'protobuf service tests', dir: %w(src/ruby/spec/pb) }
|
||
10 years ago
|
]
|
||
10 years ago
|
namespace :suite do
|
||
|
SPEC_SUITES.each do |suite|
|
||
|
desc "Run all specs in the #{suite[:title]} spec suite"
|
||
|
RSpec::Core::RakeTask.new(suite[:id]) do |t|
|
||
10 years ago
|
ENV['COVERAGE_NAME'] = suite[:id].to_s
|
||
10 years ago
|
spec_files = []
|
||
|
suite[:files].each { |f| spec_files += Dir[f] } if suite[:files]
|
||
|
|
||
|
if suite[:dir]
|
||
|
suite[:dir].each { |f| spec_files += Dir["#{f}/**/*_spec.rb"] }
|
||
|
end
|
||
9 years ago
|
helper = 'src/ruby/spec/spec_helper.rb'
|
||
10 years ago
|
spec_files << helper unless spec_files.include?(helper)
|
||
10 years ago
|
|
||
10 years ago
|
t.pattern = spec_files
|
||
|
t.rspec_opts = "--tag #{suite[:tag]}" if suite[:tag]
|
||
|
if suite[:tags]
|
||
|
t.rspec_opts = suite[:tags].map { |x| "--tag #{x}" }.join(' ')
|
||
10 years ago
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
10 years ago
|
# Define dependencies between the suites.
|
||
|
task 'suite:wrapper' => [:compile, :rubocop]
|
||
|
task 'suite:idiomatic' => 'suite:wrapper'
|
||
|
task 'suite:bidi' => 'suite:wrapper'
|
||
|
task 'suite:server' => 'suite:wrapper'
|
||
9 years ago
|
task 'suite:pb' => 'suite:server'
|
||
10 years ago
|
|
||
10 years ago
|
desc 'Compiles the gRPC extension then runs all the tests'
|
||
9 years ago
|
task all: ['suite:idiomatic', 'suite:bidi', 'suite:pb', 'suite:server']
|
||
10 years ago
|
task default: :all
|