summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortduehr <tduehr@gmail.com>2015-07-07 12:21:19 -0500
committertduehr <tduehr@gmail.com>2015-07-07 12:21:19 -0500
commit198f3ac484f2df4e33eba2707b384c9a2d4b4614 (patch)
treeea9fade3a86d657b8dc426e993bcb735ab22df52
parentc60a190d6b05881bdacb8bfda6c88ccea3a2c7e9 (diff)
downloadffi-198f3ac484f2df4e33eba2707b384c9a2d4b4614.tar.gz
tweak Rakefile
add types.conf generation stuff to main Rakefile
-rw-r--r--.gitignore1
-rw-r--r--Gemfile4
-rw-r--r--Rakefile25
3 files changed, 28 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index c1e0bee..cd2a7ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,4 @@ lib/ffi_c.so
vendor
.bundle
Gemfile.lock
+types_log
diff --git a/Gemfile b/Gemfile
index 328184e..80b002a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,3 +8,7 @@ group :development do
gem 'rubygems-tasks', '~> 0.2.4', :require => 'rubygems/tasks'
gem "rubysl", "~> 2.0", :platforms => 'rbx'
end
+
+group :doc do
+ gem 'yard', "~> 0.8.7"
+end
diff --git a/Rakefile b/Rakefile
index d0639e4..e671f91 100644
--- a/Rakefile
+++ b/Rakefile
@@ -93,13 +93,13 @@ task :package => 'gem:package'
CLOBBER.include 'lib/ffi/types.conf'
CLOBBER.include 'pkg'
+CLOBBER.include 'log'
CLEAN.include 'build'
CLEAN.include 'conftest.dSYM'
CLEAN.include 'spec/ffi/fixtures/libtest.{dylib,so,dll}'
CLEAN.include 'spec/ffi/fixtures/*.o'
-CLEAN.include "pkg/ffi-#{FFI::VERSION}-*-mingw32"
-CLEAN.include "pkg/ffi-#{FFI::VERSION}-java"
+CLEAN.include "pkg/ffi-*-{mingw32,java}"
CLEAN.include 'lib/1.*'
CLEAN.include 'lib/2.*'
CLEAN.include 'bin'
@@ -194,6 +194,27 @@ if USE_RAKE_COMPILER
end
end
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
+require 'ffi/platform'
+types_conf = File.expand_path(File.join(FFI::Platform::CONF_DIR, 'types.conf'))
+logfile = File.join(File.dirname(__FILE__), 'types_log')
+
+file types_conf => File.join("lib", "ffi", "version.rb") do |task|
+ require 'fileutils'
+ require 'ffi/tools/types_generator'
+ options = {}
+ FileUtils.mkdir_p(File.dirname(task.name), { :mode => 0755 })
+ File.open(task.name, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
+ f.puts FFI::TypesGenerator.generate(options)
+ end
+ File.open(logfile, 'w') do |log|
+ log.puts(types_conf)
+ end
+end
+
+task :types_conf => types_conf do
+end
+
Gem::Tasks.new do |t|
t.scm.tag.format = '%s'
end