tasks/distribution.rake in gecoder-0.7.1 vs tasks/distribution.rake in gecoder-0.8.0
- old
+ new
@@ -1,10 +1,14 @@
require 'lib/gecoder/version'
-PKG_NAME = 'gecoder'
+PROJECT_NAME = PKG_NAME = 'gecoder'
+PKG_NAME_WITH_GECODE = 'gecoder-with-gecode'
PKG_VERSION = GecodeR::VERSION
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
+PKG_FILE_NAME_WITH_GECODE = "#{PKG_NAME_WITH_GECODE}-#{PKG_VERSION}"
+# The location where the precompiled DLL should be placed.
+DLL_LOCATION = 'lib/gecode.dll'
desc 'Generate RDoc'
rd = Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'doc/output/rdoc'
rdoc.options << '--title' << 'Gecode/R' << '--line-numbers' <<
@@ -46,18 +50,20 @@
s.files = FileList[
'[A-Z]*',
'lib/**/*.rb',
'example/**/*',
'src/**/*',
- 'vendor/**/*',
+ 'vendor/rust/**/*',
'tasks/**/*',
'specs/**/*',
- 'ext/*'
+ 'ext/*.cpp',
+ 'ext/*.h',
+ 'ext/extconf.rb'
].to_a
s.require_path = 'lib'
s.extensions << 'ext/extconf.rb'
- s.requirements << 'Gecode 1.3.1'
+ s.requirements << 'Gecode 2.1.1'
s.has_rdoc = true
s.rdoc_options = rd.options
s.extra_rdoc_files = rd.rdoc_files
s.test_files = FileList['specs/**/*.rb']
@@ -67,27 +73,94 @@
s.email = "gecoder-users@rubyforge.org"
s.homepage = "http://gecoder.rubyforge.org"
s.rubyforge_project = "gecoder"
end
-desc 'Generate Gem'
+# Create a clone of the gem spec with the precompiled binaries for Windows.
+spec_windows_binary_with_gecode = spec.dup
+spec_windows_binary_with_gecode.name = PKG_NAME_WITH_GECODE
+spec_windows_binary_with_gecode.extensions = []
+spec_windows_binary_with_gecode.requirements = []
+# Add the precompiled Gecode DLLs and precompiled bindings.
+spec_windows_binary_with_gecode.files = spec.files.dup -
+ FileList['ext/**/*'].to_a +
+ FileList['vendor/gecode/win32/lib/*'].to_a << 'lib/gecode.dll'
+spec_windows_binary_with_gecode.platform = Gem::Platform::WIN32
+
+# Create a clone of the gem spec that includes Gecode.
+spec_with_gecode = spec.dup
+spec_with_gecode.name = PKG_NAME_WITH_GECODE
+spec_with_gecode.extensions =
+ spec_with_gecode.extensions.dup.unshift 'ext/gecode-2.1.1/configure'
+spec_with_gecode.requirements = []
+spec_with_gecode.files = spec.files.dup + FileList['ext/gecode-*/**/*'].to_a
+
+desc 'Generate Gecode/R Gem'
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
-desc "Publish packages on RubyForge"
-task :publish_packages => [:verify_user, :package] do
+desc 'Generate Gecode/R + Gecode Gem'
+Rake::GemPackageTask.new(spec_with_gecode) do |pkg|
+ pkg.need_zip = true
+ pkg.need_tar = true
+end
+
+desc 'Generate Gecode/R + Gecode Gem (windows binary)'
+Rake::GemPackageTask.new(spec_windows_binary_with_gecode) do |pkg|
+end
+
+desc 'Precompiles the Gecode/R bindings for Windows platforms'
+file 'lib/gecode.dll' do
+ cd 'ext' do
+ sh 'ruby -Iwin32 extconf-win32.rb'
+ sh 'make'
+ mv 'gecode.so', "../#{DLL_LOCATION}"
+ end
+end
+
+desc 'Removes generated distribution files'
+task :clobber do
+ rm DLL_LOCATION if File.exists? DLL_LOCATION
+end
+
+desc 'Publish packages on RubyForge'
+task :publish_packages => [:publish_gecoder_packages,
+ :publish_gecoder_with_gecode_packages]
+
+desc 'Publish Gecode/R packages on RubyForge'
+task :publish_gecoder_packages => [:verify_user, :package] do
release_files = FileList[
"pkg/#{PKG_FILE_NAME}.gem",
"pkg/#{PKG_FILE_NAME}.tgz",
"pkg/#{PKG_FILE_NAME}.zip"
]
require 'meta_project'
require 'rake/contrib/xforge'
- Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |xf|
+ Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PROJECT_NAME)) do |xf|
xf.user_name = ENV['RUBYFORGE_USER']
xf.files = release_files.to_a
xf.release_name = "Gecode/R #{PKG_VERSION}"
+ xf.package_name = PKG_NAME
+ end
+end
+
+desc 'Publish Gecode/R with Gecode packages on RubyForge'
+task :publish_gecoder_with_gecode_packages => [:verify_user, :package] do
+ release_files = FileList[
+ "pkg/#{PKG_FILE_NAME_WITH_GECODE}*.gem",
+ "pkg/#{PKG_FILE_NAME_WITH_GECODE}*.tgz",
+ "pkg/#{PKG_FILE_NAME_WITH_GECODE}*.zip"
+ ]
+
+ require 'meta_project'
+ require 'rake/contrib/xforge'
+
+ Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PROJECT_NAME)) do |xf|
+ xf.user_name = ENV['RUBYFORGE_USER']
+ xf.files = release_files.to_a
+ xf.release_name = "Gecode/R with Gecode #{PKG_VERSION}"
+ xf.package_name = PKG_NAME_WITH_GECODE
end
end