File: Rakefile

package info (click to toggle)
ruby-msgpack 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 868 kB
  • sloc: ansic: 4,030; ruby: 3,481; java: 1,738; sh: 45; makefile: 2
file content (74 lines) | stat: -rw-r--r-- 2,054 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

require 'bundler'
Bundler::GemHelper.install_tasks

require 'fileutils'

require 'rspec/core'
require 'rspec/core/rake_task'
require 'yard'

task :spec => :compile

desc 'Run RSpec code examples and measure coverage'
task :coverage do |t|
  ENV['SIMPLE_COV'] = '1'
  Rake::Task["spec"].invoke
end

desc 'Generate YARD document'
YARD::Rake::YardocTask.new(:doc) do |t|
  t.files   = ['lib/msgpack/version.rb','doclib/**/*.rb']
  t.options = []
  t.options << '--debug' << '--verbose' if $trace
end

spec = eval File.read("msgpack.gemspec")

if RUBY_PLATFORM =~ /java/
  require 'rake/javaextensiontask'

  Rake::JavaExtensionTask.new('msgpack', spec) do |ext|
    ext.ext_dir = 'ext/java'
    jruby_home = RbConfig::CONFIG['prefix']
    jars = ["#{jruby_home}/lib/jruby.jar"]
    ext.classpath = jars.map { |x| File.expand_path(x) }.join(':')
    ext.lib_dir = File.join(*['lib', 'msgpack', ENV['FAT_DIR']].compact)
    ext.source_version = '1.6'
    ext.target_version = '1.6'
  end
else
  require 'rake/extensiontask'

  Rake::ExtensionTask.new('msgpack', spec) do |ext|
    ext.ext_dir = 'ext/msgpack'
    ext.cross_compile = true
    ext.lib_dir = File.join(*['lib', 'msgpack', ENV['FAT_DIR']].compact)
    # cross_platform names are of MRI's platform name
    ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
  end
end

test_pattern = case
               when RUBY_PLATFORM =~ /java/ then 'spec/{,jruby/}*_spec.rb'
               when RUBY_ENGINE =~ /rbx/ then 'spec/*_spec.rb'
               else 'spec/{,cruby/}*_spec.rb' # MRI
               end
RSpec::Core::RakeTask.new(:spec) do |t|
  t.rspec_opts = ["-c", "-f progress"]
  t.rspec_opts << "-Ilib"
  t.pattern = test_pattern
  t.verbose = true
end

namespace :build do
  desc 'Build gems for Windows per rake-compiler-dock'
  task :windows do
    require 'rake_compiler_dock'
    RakeCompilerDock.sh 'bundle && gem i json && rake cross native gem RUBY_CC_VERSION=1.9.3:2.0.0:2.1.6:2.2.2:2.3.0:2.4.0'
  end
end

CLEAN.include('lib/msgpack/msgpack.*')

task :default => [:spec, :build, :doc]