Skip to content

Commit

Permalink
Workaround Gem::Specification limitation. Closes rake-compiler#43
Browse files Browse the repository at this point in the history
Since Rake::ExtensionTask reuses the gem specification, we fall into
the memoization issue described in RubyGems bug:

http://github.com/rubygems/rubygems/issues/78

Applied a workaround until that issue is sorted out.
  • Loading branch information
luislavena committed Jun 8, 2011
1 parent b2229a7 commit bd99231
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rake/extensiontask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ def define_native_tasks(for_platform = nil, ruby_ver = RUBY_VERSION, callback =
# create 'native:gem_name' and chain it to 'native' task
unless Rake::Task.task_defined?("native:#{@gem_spec.name}:#{platf}")
task "native:#{@gem_spec.name}:#{platf}" do |t|
# FIXME: truly duplicate the Gem::Specification
# workaround the lack of #dup for Gem::Specification
# FIXME: workaround Gem::Specification limitation around cache_file:
# http://github.com/rubygems/rubygems/issues/78
spec = gem_spec.dup
spec.instance_variable_set(:"@cache_file", nil) if spec.respond_to?(:cache_file)

# adjust to specified platform
spec.platform = Gem::Platform.new(platf)
Expand Down

0 comments on commit bd99231

Please sign in to comment.