#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rspec/core/rake_task'

THRIFT = '../../compiler/cpp/thrift'

task :default => [:gem]
task :spec => [:'gen-rb', :build_ext, :realspec]

RSpec::Core::RakeTask.new(:realspec) do |t|
  t.rspec_opts = ['--color', '--format d']
end

RSpec::Core::RakeTask.new(:'spec:rcov') do |t|
  t.rspec_opts = ['--color', '--format d']
  t.rcov = true
  t.rcov_opts = ['--exclude', '^spec,/gems/']
end

desc 'Compile the .thrift files for the specs'
task :'gen-rb' => [:'gen-rb:spec', :'gen-rb:namespaced_spec', :'gen-rb:flat_spec', :'gen-rb:benchmark', :'gen-rb:debug_proto']
namespace :'gen-rb' do
  task :'spec' do
    dir = File.dirname(__FILE__) + '/spec'
    sh THRIFT, '--gen', 'rb', '-o', dir, "#{dir}/ThriftSpec.thrift"
  end

  task :'namespaced_spec' do
    dir = File.dirname(__FILE__) + '/spec'
    sh THRIFT, '--gen', 'rb:namespaced', '--recurse', '-o', dir, "#{dir}/ThriftNamespacedSpec.thrift"
    sh THRIFT, '--gen', 'rb:namespaced', '--recurse', '-o', dir, "#{dir}/BaseService.thrift"
    sh THRIFT, '--gen', 'rb:namespaced', '--recurse', '-o', dir, "#{dir}/ExtendedService.thrift"
  end

  task :'flat_spec' do
    dir = File.dirname(__FILE__) + '/spec'
    mkdir_p("#{dir}/gen-rb/flat")
    sh THRIFT, '--gen', 'rb', '--recurse', '-out', "#{dir}/gen-rb/flat", "#{dir}/ThriftNamespacedSpec.thrift"
  end

  task :'benchmark' do
    dir = File.dirname(__FILE__) + '/benchmark'
    sh THRIFT, '--gen', 'rb', '-o', dir, "#{dir}/Benchmark.thrift"
  end
  
  task :'debug_proto' do
    sh "mkdir", "-p", "test/debug_proto"
    sh THRIFT, '--gen', 'rb', "-o", "test/debug_proto", "../../test/DebugProtoTest.thrift"
  end
end

desc "Build the native library"
task :build_ext => :'gen-rb' do
   next if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
   Dir::chdir(File::dirname('ext/extconf.rb')) do
      unless sh "ruby #{File::basename('ext/extconf.rb')}"
        $stderr.puts "Failed to run extconf"
          break
      end
      unless sh "make"
        $stderr.puts "make failed"
        break
      end
    end
end

desc 'Run the compiler tests (requires full thrift checkout)'
task :test do
  # ensure this is a full thrift checkout and not a tarball of the ruby libs
  cmd = 'head -1 ../../README.md 2>/dev/null | grep Thrift >/dev/null 2>/dev/null'
  system(cmd) or fail "rake test requires a full thrift checkout"
  sh 'make', '-C', File.dirname(__FILE__) + "/../../test/rb", "check"
end

desc 'Run benchmarking of NonblockingServer'
task :benchmark do
  ruby 'benchmark/benchmark.rb'
end

desc 'Builds the thrift gem'
task :gem => [:spec, :build_ext] do
  unless sh 'gem', 'build', 'thrift.gemspec'
    $stderr.puts "Failed to build thrift gem"
    break
  end
end

desc 'Install the thrift gem'
task :install => [:gem] do
  unless sh 'gem', 'install', Dir.glob('thrift-*.gem').last
    $stderr.puts "Failed to install thrift gem"
    break
  end
end

CLEAN.include [
  '.bundle', 'benchmark/gen-rb', 'coverage', 'ext/*.{o,bundle,so,dll}', 'ext/mkmf.log',
  'ext/Makefile', 'ext/conftest.dSYM', 'Gemfile.lock', 'mkmf.log', 'pkg',  'spec/gen-rb',
  'test', 'thrift-*.gem'
]
