This repository has been archived by the owner on Nov 15, 2021. It is now read-only.
forked from mark-moseley/ruby-debug
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Rakefile
130 lines (113 loc) · 3.11 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# -*- Ruby -*-
require 'rubygems/package_task'
require 'rake/testtask'
require 'rake/extensiontask'
Rake::ExtensionTask.new('ruby_debug')
SO_NAME = "ruby_debug.so"
COMMON_FILES = FileList[
'AUTHORS',
'CHANGES',
'LICENSE',
'README',
'Rakefile',
]
CLI_TEST_FILE_LIST = FileList['test/lib/commands/unit/*.rb',
'test/lib/commands/*_test.rb',
'test/lib/**/*_test.rb',
'test/test-remote.rb']
# disabled until requires fixed and tests pass
# 'test/test-*.rb']
CLI_FILES = COMMON_FILES + FileList[
"lib/**/*",
'ChangeLog',
'bin/*',
'doc/rdebug.1',
'test/**/data/*.cmd',
'test/**/data/*.right',
'test/**/*.rb',
'rdbg.rb',
CLI_TEST_FILE_LIST
]
BASE_TEST_FILE_LIST = %w(
test/base/base.rb
test/base/binding.rb
test/base/catchpoint.rb)
BASE_FILES = COMMON_FILES + FileList[
'ext/ruby_debug/breakpoint.c',
'ext/ruby_debug/extconf.rb',
'ext/ruby_debug/ruby_debug.c',
'ext/ruby_debug/ruby_debug.h',
'ext/win32/*',
'lib/**/*',
BASE_TEST_FILE_LIST,
]
desc "Test everything."
task :test => :test_base do
Rake::TestTask.new(:test) do |t|
t.libs << './ext'
t.libs << './lib'
t.test_files = CLI_TEST_FILE_LIST
t.verbose = true
end
end
desc "Test ruby-debug-base."
task :test_base => :lib do
Rake::TestTask.new(:test_base) do |t|
t.libs << './ext'
t.libs << './lib'
t.test_files = FileList[BASE_TEST_FILE_LIST]
t.verbose = true
end
end
desc "Test everything - same as test."
task :check => :test
desc "Create the core ruby-debug shared library extension"
task :lib do
Dir.chdir("ext") do
system("#{Gem.ruby} extconf.rb && make")
end
end
desc "Compile Emacs code"
task :emacs => "emacs/rdebug.elc"
file "emacs/rdebug.elc" => ["emacs/elisp-comp", "emacs/rdebug.el"] do
Dir.chdir("emacs") do
system("./elisp-comp ./rdebug.el")
end
end
base_spec = eval(File.read('debugger.gemspec'), binding, 'debugger.gemspec')
# Rake task to build the default package
Gem::PackageTask.new(base_spec) do |pkg|
pkg.need_tar = true
end
# Windows specification
win_spec = base_spec.clone
win_spec.extensions = []
## win_spec.platform = Gem::Platform::WIN32 # deprecated
win_spec.platform = 'mswin32'
win_spec.files += ["lib/#{SO_NAME}"]
desc "Create Windows Gem"
task :win32_gem do
# Copy the win32 extension the top level directory
current_dir = File.expand_path(File.dirname(__FILE__))
source = File.join(current_dir, "ext", "win32", SO_NAME)
target = File.join(current_dir, "lib", SO_NAME)
cp(source, target)
# Create the gem, then move it to pkg.
Gem::Builder.new(win_spec).build
gem_file = "#{win_spec.name}-#{win_spec.version}-#{win_spec.platform}.gem"
mv(gem_file, "pkg/#{gem_file}")
# Remove win extension from top level directory.
rm(target)
end
desc "Remove built files"
task :clean do
cd "ext" do
if File.exists?("Makefile")
sh "make clean"
rm "Makefile"
end
derived_files = Dir.glob(".o") + Dir.glob("*.so")
rm derived_files unless derived_files.empty?
end
end
task :default => :test