forked from ruby/psych
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
103 lines (84 loc) · 2.78 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# -*- ruby -*-
require 'psych'
require 'rubygems'
require 'hoe'
def java?
RUBY_PLATFORM =~ /java/
end
class Hoe
remove_const :RUBY_FLAGS
flags = "-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
flags = "--1.9 " + flags if java?
RUBY_FLAGS = flags
end
gem 'rake-compiler', '>= 0.4.1'
gem 'minitest', '~> 4.0'
require "rake/extensiontask"
Hoe.plugin :doofus, :git, :gemspec
$hoe = Hoe.spec 'psych' do
license 'MIT'
developer 'Aaron Patterson', 'aaron@tenderlovemaking.com'
self.extra_rdoc_files = Dir['*.rdoc']
self.history_file = 'CHANGELOG.rdoc'
self.readme_file = 'README.rdoc'
self.testlib = :minitest
extra_dev_deps << ['rake-compiler', '>= 0.4.1']
extra_dev_deps << ['minitest', '~> 4.0']
self.spec_extras = {
:extensions => ["ext/psych/extconf.rb"],
:required_ruby_version => '>= 1.9.2'
}
if java?
load 'lib/psych_jars.rb'
extra_deps << ['jar-dependencies', '>= 0.1.7']
# the jar declaration for jar-dependencies
self.spec_extras[ 'requirements' ] = 'jar org.yaml:snakeyaml:#{Psych::SNAKEYAML_VERSION}'
self.spec_extras[ 'platform' ] = 'java'
# TODO: clean this section up.
require "rake/javaextensiontask"
Rake::JavaExtensionTask.new("psych", spec) do |ext|
require 'maven/ruby/maven'
# tell maven via system properties the snakeyaml version
ENV_JAVA['snakeyaml.version'] = Psych::SNAKEYAML_VERSION
# uses Mavenfile to write classpath into pkg/classpath
Maven::Ruby::Maven.new.exec( 'dependency:build-classpath', '--quiet' )
ext.source_version = '1.7'
ext.target_version = '1.7'
ext.classpath = File.read('pkg/classpath')
ext.ext_dir = 'ext/java'
end
else
Rake::ExtensionTask.new "psych", spec do |ext|
ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
end
end
end
Hoe.add_include_dirs('.:lib/psych')
task :test => :compile
task :hack_spec do
$hoe.spec.extra_rdoc_files.clear
end
task 'core:spec' => [:hack_spec, 'gem:spec']
desc "merge psych in to ruby trunk"
namespace :merge do
basedir = File.expand_path File.dirname __FILE__
rubydir = File.join ENV['HOME'], 'git', 'ruby'
mergedirs = {
# From # To
[basedir, 'ext', 'psych/'] => [rubydir, 'ext', 'psych/'],
[basedir, 'lib/'] => [rubydir, 'ext', 'psych', 'lib/'],
[basedir, 'test', 'psych/'] => [rubydir, 'test', 'psych/'],
}
rsync = 'rsync -av --exclude lib --exclude ".*" --exclude "*.o" --exclude Makefile --exclude mkmf.log --delete'
task :to_ruby do
mergedirs.each do |from, to|
sh "#{rsync} #{File.join(*from)} #{File.join(*to)}"
end
end
task :from_ruby do
mergedirs.each do |from, to|
sh "#{rsync} #{File.join(*to)} #{File.join(*from)}"
end
end
end
# vim: syntax=ruby