Permalink
Newer
Older
100644 139 lines (119 sloc) 3.28 KB
Jul 22, 2009
1
# -*- Ruby -*-
2
require 'rubygems/package_task'
Jul 22, 2009
3
require 'rake/testtask'
4
require 'rake/extensiontask'
5
6
Rake::ExtensionTask.new('ruby_debug')
Jul 22, 2009
7
8
SO_NAME = "ruby_debug.so"
9
10
# ------- Default Package ----------
11
RUBY_DEBUG_VERSION = open("ext/ruby_debug/ruby_debug.c") do |f|
Jul 22, 2009
12
f.grep(/^#define DEBUG_VERSION/).first[/"(.+)"/,1]
13
end
14
15
RUBY_DEBUG_TEENY = ".0"
16
RUBY_DEBUG_BASE_TEENY = ".0"
17
Jul 22, 2009
18
COMMON_FILES = FileList[
19
'AUTHORS',
20
'CHANGES',
21
'LICENSE',
22
'README',
23
'Rakefile',
Jul 22, 2009
25
26
CLI_TEST_FILE_LIST = FileList['test/cli/commands/unit/*.rb',
27
'test/cli/commands/*_test.rb',
28
'test/cli/**/*_test.rb']
29
# disabled until requires fixed and tests pass
30
# 'test/test-*.rb']
Jul 22, 2009
31
CLI_FILES = COMMON_FILES + FileList[
32
"cli/**/*",
33
'ChangeLog',
34
'bin/*',
35
'doc/rdebug.1',
36
'test/**/data/*.cmd',
37
'test/**/data/*.right',
38
'test/**/*.rb',
39
'rdbg.rb',
40
CLI_TEST_FILE_LIST
41
]
42
43
BASE_TEST_FILE_LIST = %w(
44
test/base/base.rb
45
test/base/binding.rb
Jul 22, 2009
46
test/base/catchpoint.rb)
47
BASE_FILES = COMMON_FILES + FileList[
48
'ext/ruby_debug/breakpoint.c',
49
'ext/ruby_debug/extconf.rb',
50
'ext/ruby_debug/ruby_debug.c',
51
'ext/ruby_debug/ruby_debug.h',
Jul 22, 2009
52
'ext/win32/*',
53
'lib/**/*',
54
BASE_TEST_FILE_LIST,
55
]
56
57
desc "Test everything."
58
task :test => :test_base do
Jul 22, 2009
59
Rake::TestTask.new(:test) do |t|
Jul 27, 2009
60
t.libs << './ext'
61
t.libs << './lib'
62
t.libs << './cli'
Jul 22, 2009
63
t.test_files = CLI_TEST_FILE_LIST
64
t.verbose = true
65
end
66
end
67
68
desc "Test ruby-debug-base."
69
task :test_base => :lib do
Jul 22, 2009
70
Rake::TestTask.new(:test_base) do |t|
Jul 27, 2009
71
t.libs << './ext'
72
t.libs << './lib'
Jul 22, 2009
73
t.test_files = FileList[BASE_TEST_FILE_LIST]
74
t.verbose = true
75
end
76
end
77
78
desc "Test everything - same as test."
79
task :check => :test
80
81
desc "Create the core ruby-debug shared library extension"
82
task :lib do
83
Dir.chdir("ext") do
84
system("#{Gem.ruby} extconf.rb && make")
85
end
86
end
87
88
desc "Compile Emacs code"
89
task :emacs => "emacs/rdebug.elc"
90
file "emacs/rdebug.elc" => ["emacs/elisp-comp", "emacs/rdebug.el"] do
91
Dir.chdir("emacs") do
92
system("./elisp-comp ./rdebug.el")
93
end
94
end
95
96
base_spec = eval(File.read('debugger.gemspec'), binding, 'debugger.gemspec')
Jul 22, 2009
97
# Rake task to build the default package
98
Gem::PackageTask.new(base_spec) do |pkg|
Jul 22, 2009
99
pkg.need_tar = true
100
end
101
102
# Windows specification
103
win_spec = base_spec.clone
104
win_spec.extensions = []
105
## win_spec.platform = Gem::Platform::WIN32 # deprecated
106
win_spec.platform = 'mswin32'
107
win_spec.files += ["lib/#{SO_NAME}"]
108
109
desc "Create Windows Gem"
110
task :win32_gem do
111
# Copy the win32 extension the top level directory
112
current_dir = File.expand_path(File.dirname(__FILE__))
113
source = File.join(current_dir, "ext", "win32", SO_NAME)
114
target = File.join(current_dir, "lib", SO_NAME)
115
cp(source, target)
116
117
# Create the gem, then move it to pkg.
118
Gem::Builder.new(win_spec).build
119
gem_file = "#{win_spec.name}-#{win_spec.version}-#{win_spec.platform}.gem"
120
mv(gem_file, "pkg/#{gem_file}")
121
122
# Remove win extension from top level directory.
123
rm(target)
124
end
125
126
desc "Remove built files"
127
task :clean do
128
cd "ext" do
129
if File.exists?("Makefile")
130
sh "make clean"
131
rm "Makefile"
132
end
133
derived_files = Dir.glob(".o") + Dir.glob("*.so")
134
rm derived_files unless derived_files.empty?
135
end
136
end
137
138
task :default => :test