Permalink
Browse files

fix development tasks:

  • Loading branch information...
1 parent f7c12db commit 1173feb3e3d7a67aff669570cff35a6643ce9278 @ibc committed Apr 2, 2013
Showing with 17 additions and 19 deletions.
  1. +17 −19 rakelib/package.rake
View
@@ -1,4 +1,6 @@
+require 'rubygems'
require 'rubygems/package_task'
+
begin
require 'rake/extensiontask'
require 'rake/javaextensiontask'
@@ -24,24 +26,32 @@ else
unless RUBY_PLATFORM =~ /mswin|mingw/
ext.cross_compile = true
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
-
- # inject 1.8/1.9 pure-ruby entry point
- ext.cross_compiling do |spec|
- spec.files += ["lib/#{ext.name}.rb"]
+ end
+ end
+ def hack_cross_compilation(ext)
+ # inject 1.8/1.9 pure-ruby entry point
+ # HACK: add these dependencies to the task instead of using cross_compiling
+ ext.cross_platform.each do |platform|
+ task = "native:#{GEMSPEC.name}:#{platform}"
+ if Rake::Task.task_defined?(task)
+ Rake::Task[task].prerequisites.unshift "lib/#{ext.name}.rb"
end
end
end
- Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
+ em = Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
ext.ext_dir = 'ext'
ext.source_pattern = '*.{h,c,cpp}'
setup_cross_compilation(ext)
end
- Rake::ExtensionTask.new("fastfilereaderext", GEMSPEC) do |ext|
+ hack_cross_compilation em
+
+ ff = Rake::ExtensionTask.new("fastfilereaderext", GEMSPEC) do |ext|
ext.ext_dir = 'ext/fastfilereader'
ext.source_pattern = '*.{h,c,cpp}'
setup_cross_compilation(ext)
end
+ hack_cross_compilation ff
end
# Setup shim files that require 1.8 vs 1.9 extensions in win32 bin gems
@@ -83,16 +93,4 @@ def gem_cmd(action, name, *args)
sudo "#{rb} -r rubygems -e 'require %{rubygems/gem_runner}; Gem::GemRunner.new.run(%w{#{action} #{name} #{args.join(' ')}})'"
end
-Rake::Task[:clean].enhance [:clobber_package]
-
-namespace :gem do
- desc 'Install gem (and sudo if required)'
- task :install => :package do
- gem_cmd(:install, "pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem")
- end
-
- desc 'Uninstall gem (and sudo if required)'
- task :uninstall do
- gem_cmd(:uninstall, "#{GEMSPEC.name}", "-v=#{GEMSPEC.version}")
- end
-end
+Rake::Task[:clean].enhance [:clobber_package]

0 comments on commit 1173feb

Please sign in to comment.