Permalink
Browse files

tweak Rakefile

add types.conf generation stuff to main Rakefile
  • Loading branch information...
1 parent c60a190 commit 198f3ac484f2df4e33eba2707b384c9a2d4b4614 @tduehr tduehr committed Jul 7, 2015
Showing with 28 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +4 −0 Gemfile
  3. +23 −2 Rakefile
View
@@ -18,3 +18,4 @@ lib/ffi_c.so
vendor
.bundle
Gemfile.lock
+types_log
View
@@ -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
View
@@ -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

0 comments on commit 198f3ac

Please sign in to comment.