Skip to content

Commit 49ffb91

Browse files
committed
First successful gem build using custom rake-compiler-dev-box.
Removed superflouous lines from gemsepc and Rakefile. Fixed CAtomic load error for Windows cross-compiled extensions.
1 parent 45a7aaf commit 49ffb91

File tree

6 files changed

+40
-29
lines changed

6 files changed

+40
-29
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Gemfile.lock
22
*.gem
3+
lib/1.8
4+
lib/1.9
5+
lib/2.0
36
.rvmrc
47
.ruby-version
58
.ruby-gemset

Rakefile

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@ require 'rake'
22
require 'bundler/gem_tasks'
33
require 'rake/extensiontask'
44
require 'rake/javaextensiontask'
5-
#require 'rspec'
6-
#require 'rspec/core/rake_task'
75

86
GEMSPEC = Gem::Specification.load(File.expand_path('../concurrent-ruby.gemspec', __FILE__))
97

108
$:.push File.join(File.dirname(__FILE__), 'lib')
119
require 'extension_helper'
1210

13-
Bundler::GemHelper.install_tasks
11+
$:.unshift 'tasks'
12+
Dir.glob('tasks/**/*.rake').each do|rakefile|
13+
load rakefile
14+
end
1415

15-
#RSpec::Core::RakeTask.new(:spec)
16-
#$:.unshift 'tasks'
17-
#Dir.glob('tasks/**/*.rake').each do|rakefile|
18-
#load rakefile
19-
#end
16+
Bundler::GemHelper.install_tasks
2017

2118
desc 'Run benchmarks'
2219
task :bench do
@@ -60,17 +57,29 @@ elsif Concurrent.use_c_extensions?
6057
end
6158

6259
Rake::Task[:clean].enhance do
63-
rm_rf 'pkg'
60+
rm_rf 'pkg/classes'
61+
rm_rf 'tmp'
62+
rm_rf 'lib/1.9'
63+
rm_rf 'lib/2.0'
6464
rm_f Dir.glob('./lib/*.jar')
65-
rm_f Dir.glob('./lib/*.bundle')
65+
rm_f Dir.glob('./**/*.bundle')
6666
end
6767

68-
#RSpec::Core::RakeTask.new(:travis_spec) do |t|
69-
#t.rspec_opts = '--tag ~@not_on_travis'
70-
#end
68+
begin
69+
require 'rspec'
70+
require 'rspec/core/rake_task'
71+
72+
RSpec::Core::RakeTask.new(:spec)
7173

72-
#if defined?(EXTENSION_NAME)
73-
#task :default => [:clean, "compile:#{EXTENSION_NAME}", :travis_spec]
74-
#else
75-
#task :default => [:clean, :travis_spec]
76-
#end
74+
RSpec::Core::RakeTask.new(:travis_spec) do |t|
75+
t.rspec_opts = '--tag ~@not_on_travis'
76+
end
77+
78+
if defined?(EXTENSION_NAME)
79+
task :default => [:clean, "compile:#{EXTENSION_NAME}", :travis_spec]
80+
else
81+
task :default => [:clean, :travis_spec]
82+
end
83+
rescue LoadError
84+
puts 'Error loading Rspec rake tasks, probably building the gem...'
85+
end

concurrent-ruby.gemspec

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ Gem::Specification.new do |s|
1818
Inspired by Erlang, Clojure, Go, JavaScript, actors, and classic concurrency patterns.
1919
EOF
2020

21-
s.files = Dir['README*', 'LICENSE*', 'CHANGELOG*']
22-
s.files += Dir['{lib,md,spec}/**/*']
23-
s.test_files = Dir['{spec}/**/*']
24-
s.extra_rdoc_files = ['README.md']
21+
s.files = Dir['lib/**/*']
2522
s.extra_rdoc_files = Dir['README*', 'LICENSE*', 'CHANGELOG*']
2623
s.require_paths = ['lib']
2724

@@ -33,8 +30,4 @@ Gem::Specification.new do |s|
3330
end
3431

3532
s.required_ruby_version = '>= 1.9.3'
36-
37-
s.add_development_dependency 'bundler', '~> 1.6.2'
38-
s.add_development_dependency 'rake', '~> 10.3.2'
39-
s.add_development_dependency 'rake-compiler', '~> 0.9.2'
4033
end

lib/concurrent/atomic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
warn "#{__FILE__}:#{__LINE__}: unsupported Ruby engine `#{RUBY_ENGINE}', using less-efficient Atomic impl"
1515
end
1616

17-
if RUBY_PLATFORM == 'java'
17+
if defined? Concurrent::JavaAtomic
1818

1919
class Concurrent::Atomic < Concurrent::JavaAtomic
2020
end

lib/concurrent/atomic_reference/ruby.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
require 'concurrent_cruby'
1+
begin
2+
require 'concurrent_cruby'
3+
rescue LoadError
4+
# may be a Windows cross-compiled native gem
5+
require "#{RUBY_VERSION[0..2]}/concurrent_cruby"
6+
end
7+
28
require 'concurrent/atomic_reference/direct_update'
39
require 'concurrent/atomic_reference/numeric_cas_wrapper'
410

lib/extension_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ module Concurrent
44
def self.use_c_extensions?
55
host_os = RbConfig::CONFIG['host_os']
66
ruby_name = RbConfig::CONFIG['ruby_install_name']
7-
(ruby_name =~ /^ruby$/i || host_os =~ /mswin32/i || host_os =~ /mingw32/i) #&& RUBY_VERSION >= '2.0'
7+
(ruby_name =~ /^ruby$/i || host_os =~ /mswin32/i || host_os =~ /mingw32/i)
88
end
99
end

0 commit comments

Comments
 (0)