Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow simultaneous versions of Ruby to compile extensions.

  • Loading branch information...
commit ee46024f82a5ea9fe128e69eb471c162e71f35cb 1 parent 78fe303
@luislavena luislavena authored
View
9 History.txt
@@ -1,3 +1,12 @@
+=== 0.5.1 (in Git)
+
+* Enhancements
+ * Allow simultaneous versions of Ruby to compile extensions.
+ This change allow 1.8.x compiles co-exist with 1.9.x ones
+ and don't override each other.
+
+ Please perform <tt>rake clobber</tt> prior compiling again.
+
=== 0.5.0 / 2009-04-25
* Enhancements
View
2  features/step_definitions/folders.rb
@@ -28,5 +28,5 @@
end
Then /^no left over from '(.*)' remains in '(.*)'$/ do |name, folder|
- Dir.glob("#{folder}/**/#{name}").should be_empty
+ Dir.glob("#{folder}/**/#{name}/#{RUBY_VERSION}").should be_empty
end
View
14 lib/rake/extensiontask.rb
@@ -72,12 +72,12 @@ def define
end
private
- def define_compile_tasks(for_platform = nil)
+ def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
# platform usage
platf = for_platform || platform
# tmp_path
- tmp_path = "#{@tmp_dir}/#{platf}/#{@name}"
+ tmp_path = "#{@tmp_dir}/#{platf}/#{@name}/#{ruby_ver}"
# cleanup and clobbering
CLEAN.include(tmp_path)
@@ -161,11 +161,11 @@ def define_compile_tasks(for_platform = nil)
end
end
- def define_native_tasks(for_platform = nil)
+ def define_native_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
platf = for_platform || platform
# tmp_path
- tmp_path = "#{@tmp_dir}/#{platf}/#{@name}"
+ tmp_path = "#{@tmp_dir}/#{platf}/#{@name}/#{ruby_ver}"
# create 'native:gem_name' and chain it to 'native' task
unless Rake::Task.task_defined?("native:#{@gem_spec.name}:#{platf}")
@@ -236,7 +236,7 @@ def define_cross_platform_tasks(for_platform)
config_file = YAML.load_file(config_path)
# tmp_path
- tmp_path = "#{@tmp_dir}/#{for_platform}/#{@name}"
+ tmp_path = "#{@tmp_dir}/#{for_platform}/#{@name}/#{ruby_ver}"
unless rbconfig_file = config_file["rbconfig-#{ruby_ver}"] then
warn "no configuration section for specified version of Ruby (rbconfig-#{ruby_ver})"
@@ -244,7 +244,7 @@ def define_cross_platform_tasks(for_platform)
end
# define compilation tasks for cross platfrom!
- define_compile_tasks(for_platform)
+ define_compile_tasks(for_platform, ruby_ver)
# chain fake.rb and rbconfig.rb to Makefile generation
file "#{tmp_path}/Makefile" => ["#{tmp_path}/fake.rb", "#{tmp_path}/rbconfig.rb"]
@@ -262,7 +262,7 @@ def define_cross_platform_tasks(for_platform)
end
# now define native tasks for cross compiled files
- define_native_tasks(for_platform) if @gem_spec && @gem_spec.platform == 'ruby'
+ define_native_tasks(for_platform, ruby_ver) if @gem_spec && @gem_spec.platform == 'ruby'
# create cross task
task 'cross' do
View
41 spec/lib/rake/extensiontask_spec.rb
@@ -110,6 +110,7 @@
@ext = Rake::ExtensionTask.new('extension_one')
@ext_bin = ext_bin('extension_one')
@platform = RUBY_PLATFORM
+ @ruby_ver = RUBY_VERSION
end
context 'compile' do
@@ -142,41 +143,41 @@
end
end
- context 'tmp/{platform}/extension_one/extension_one.{so,bundle}' do
+ context 'tmp/{platform}/extension_one/{ruby_ver}/extension_one.{so,bundle}' do
it 'should define as task' do
- Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ext_bin}").should be_true
+ Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}").should be_true
end
- it "should depend on 'tmp/{platform}/extension_one/Makefile'" do
- Rake::Task["tmp/#{@platform}/extension_one/#{@ext_bin}"].prerequisites.should include("tmp/#{@platform}/extension_one/Makefile")
+ it "should depend on 'tmp/{platform}/extension_one/{ruby_ver}/Makefile'" do
+ Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites.should include("tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile")
end
it "should depend on 'ext/extension_one/source.c'" do
- Rake::Task["tmp/#{@platform}/extension_one/#{@ext_bin}"].prerequisites.should include("ext/extension_one/source.c")
+ Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites.should include("ext/extension_one/source.c")
end
it "should not depend on 'ext/extension_one/source.h'" do
- Rake::Task["tmp/#{@platform}/extension_one/#{@ext_bin}"].prerequisites.should_not include("ext/extension_one/source.h")
+ Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites.should_not include("ext/extension_one/source.h")
end
end
- context 'tmp/{platform}/extension_one/Makefile' do
+ context 'tmp/{platform}/extension_one/{ruby_ver}/Makefile' do
it 'should define as task' do
- Rake::Task.task_defined?("tmp/#{@platform}/extension_one/Makefile").should be_true
+ Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile").should be_true
end
- it "should depend on 'tmp/{platform}/extension_one'" do
- Rake::Task["tmp/#{@platform}/extension_one/Makefile"].prerequisites.should include("tmp/#{@platform}/extension_one")
+ it "should depend on 'tmp/{platform}/extension_one/{ruby_ver}'" do
+ Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/#{@platform}/extension_one/#{@ruby_ver}")
end
it "should depend on 'ext/extension_one/extconf.rb'" do
- Rake::Task["tmp/#{@platform}/extension_one/Makefile"].prerequisites.should include("ext/extension_one/extconf.rb")
+ Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("ext/extension_one/extconf.rb")
end
end
context 'clean' do
- it "should include 'tmp/{platform}/extension_one' in the pattern" do
- CLEAN.should include("tmp/#{@platform}/extension_one")
+ it "should include 'tmp/{platform}/extension_one/{ruby_ver}' in the pattern" do
+ CLEAN.should include("tmp/#{@platform}/extension_one/#{@ruby_ver}")
end
end
@@ -199,11 +200,12 @@
end
@ext_bin = ext_bin('extension_one')
@platform = RUBY_PLATFORM
+ @ruby_ver = RUBY_VERSION
end
- context 'tmp/{platform}/extension_one/Makefile' do
+ context 'tmp/{platform}/extension_one/{ruby_ver}/Makefile' do
it "should depend on 'custom/ext/foo/extconf.rb'" do
- Rake::Task["tmp/#{@platform}/extension_one/Makefile"].prerequisites.should include("custom/ext/foo/extconf.rb")
+ Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("custom/ext/foo/extconf.rb")
end
end
end
@@ -214,6 +216,7 @@
@spec = mock_gem_spec
@ext_bin = ext_bin('extension_one')
@platform = RUBY_PLATFORM
+ @ruby_ver = RUBY_VERSION
end
context 'native' do
@@ -246,7 +249,7 @@
context 'native:my_gem:{platform}' do
it 'should depend on binary extension' do
Rake::ExtensionTask.new('extension_one', @spec)
- Rake::Task["native:my_gem:#{@platform}"].prerequisites.should include("tmp/#{@platform}/extension_one/#{@ext_bin}")
+ Rake::Task["native:my_gem:#{@platform}"].prerequisites.should include("tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}")
end
end
end
@@ -321,17 +324,17 @@
context 'fake' do
it 'should chain fake task to Makefile generation' do
- Rake::Task['tmp/universal-unknown/extension_one/Makefile'].prerequisites.should include('tmp/universal-unknown/extension_one/fake.rb')
+ Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/universal-unknown/extension_one/#{@ruby_ver}/fake.rb")
end
end
context 'rbconfig' do
it 'should chain rbconfig tasks to Makefile generation' do
- Rake::Task['tmp/universal-unknown/extension_one/Makefile'].prerequisites.should include('tmp/universal-unknown/extension_one/rbconfig.rb')
+ Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/universal-unknown/extension_one/#{@ruby_ver}/rbconfig.rb")
end
it 'should take rbconfig from rake-compiler configuration' do
- Rake::Task['tmp/universal-unknown/extension_one/rbconfig.rb'].prerequisites.should include(@config_path)
+ Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/rbconfig.rb"].prerequisites.should include(@config_path)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.