Permalink
Newer
Older
100644 291 lines (222 sloc) 7.44 KB
1
# NOTE! When updating this file, also update INSTALL, if necessary.
2
# NOTE! Please keep your tasks grouped together.
4
$VERBOSE = true
5
$verbose = Rake.application.options.trace
6
$dlext = Config::CONFIG["DLEXT"]
7
$compiler = nil
9
RUBINIUS_BASE = File.expand_path(File.dirname(__FILE__))
10
11
# require 'tsort'
12
# require 'rakelib/rubinius'
14
task :default => %w[build vm:test spec:compiler]
16
desc "Compile the given ruby file into a .rbc file"
17
task :compile_ruby, :file do |task, args|
18
file = args[:file]
19
raise ArgumentError, 'compile_ruby requires a file name' if file.nil?
20
21
rbc = file + 'c'
22
23
compile_ruby file, rbc
24
end
25
task :compile_ruby => 'kernel:build' # HACK argument + dependency is broken
26
27
desc "Run the given ruby file with the vm"
28
task :run_ruby, :file do |task, args|
29
file = args[:file]
30
raise ArgumentError, 'compile_ruby requires a file name' if file.nil?
31
32
rbc = file + 'c'
33
34
compile_ruby file, rbc
35
36
ENV['PROBE'] = 'yes' if $verbose
37
ENV['RBX_RUNTIME'] = File.join File.dirname(__FILE__), 'runtime'
38
39
sh 'vm/vm', rbc
40
end
Aug 28, 2008
41
task :run_ruby => %w[kernel:build vm/vm] # HACK argument + dependency is broken
43
desc "Compile files with MRI because vm takes forever to do it"
44
task :precompile => %w[extensions] do
45
FileList['{mspec,kernel,lib,spec}/**/*.rb'].each do |rb|
46
next unless File.file? rb
47
48
rbc = "#{rb}c"
49
50
if File.exist? rbc then
51
rbc_mtime = File.mtime rbc
52
next if rbc_mtime >= COMPILER_MTIME or rbc_mtime >= File.mtime(rb)
53
end
54
55
mri_compile rb, rbc
56
end
57
end
58
59
# BUILD TASKS
60
61
# task :stable_compiler do
62
# if ENV['USE_CURRENT'] or ENV['SYSTEM']
63
# puts "Use current versions, not stable."
64
# else
65
# ENV['RBX_BOOTSTRAP'] = "runtime/stable/bootstrap.rba"
66
# ENV['RBX_CORE'] = "runtime/stable/core.rba"
67
# ENV['RBX_LOADER'] = "runtime/stable/loader.rbc"
68
# ENV['RBX_PLATFORM'] = "runtime/stable/platform.rba"
69
# end
70
# end
71
72
# files = FileList['kernel/core/*.rb']
73
74
# unless files.include?("kernel/core/dir.rb")
75
# files.add("kernel/core/dir.rb")
76
# end
77
78
# Core = CodeGroup.new(files, 'runtime/core', 'core')
79
80
# Bootstrap = CodeGroup.new 'kernel/bootstrap/*.rb', 'runtime/bootstrap',
81
# 'bootstrap'
82
# PlatformFiles = CodeGroup.new 'kernel/platform/*.rb', 'runtime/platform', 'platform'
83
84
# file 'runtime/loader.rbc' => 'kernel/loader.rb' do
85
# compile 'kernel/loader.rb', 'runtime/loader.rbc'
86
# end
87
88
# file 'runtime/stable/loader.rbc' => 'runtime/loader.rbc' do
89
# cp 'runtime/loader.rbc', 'runtime/stable', :verbose => $verbose
90
# end
91
92
# file 'runtime/stable/compiler.rba' => 'build:compiler' do |t|
93
# #sh "cd lib; zip -r ../runtime/stable/compiler.rba compiler -x \\*.rb"
94
# rm_f t.name
95
# rbc_files = Rake::FileList['compiler/**/*.rbc']
96
97
# Dir.chdir 'lib' do
98
# rbc_files.each do |rbc_file|
99
# ar_add "../#{t.name}", rbc_file
100
# end
101
# end
102
# end
103
104
# AllPreCompiled = Core.output + Bootstrap.output + PlatformFiles.output
105
# AllPreCompiled << "runtime/loader.rbc"
107
desc "Build everything that needs to be built"
108
task :build => %w[
109
vm
110
kernel:build
Sep 30, 2008
111
lib/rbconfig.rb
115
namespace :build do
116
117
# task :setup_rbc => :stable_compiler
118
119
# task :rbc => ([:setup_rbc] + AllPreCompiled)
120
121
# task :compiler => :stable_compiler do
122
# compile_dir "lib/compiler"
123
# end
124
125
# desc "Rebuild runtime/stable/*. If you don't know why you're running this, don't."
126
# task :stable => %w[
127
# build:all
128
# runtime/stable/bootstrap.rba
129
# runtime/stable/core.rba
130
# runtime/stable/compiler.rba
131
# runtime/stable/loader.rbc
132
# runtime/stable/platform.rba
133
# ]
134
135
# desc "Rebuild the .load_order.txt files"
136
# task "load_order" do
137
# # Note: Steps to rebuild load_order were defined above
138
# end
139
140
# namespace :vm do
141
# task "clean" do
142
# sh "cd shotgun/lib; #{make "clean"}"
143
# end
144
145
# task "dev" do
146
# sh "cd shotgun/lib; #{make "DEV=1"}"
147
# end
148
# end
149
152
# # INSTALL TASKS
154
# desc "Install rubinius as rbx"
155
# task :install => :config_env do
156
# sh "cd shotgun; #{make "install"}"
158
# mkdir_p ENV['RBAPATH'], :verbose => true
159
# mkdir_p ENV['CODEPATH'], :verbose => true
161
# rba_files = Rake::FileList.new('runtime/platform.conf',
162
# 'runtime/**/*.rb{a,c}',
163
# 'runtime/**/.load_order.txt')
164
165
# install_files rba_files, ENV['RBAPATH']
166
167
# lib_files = Rake::FileList.new 'lib/**/*'
168
169
# install_files lib_files, ENV['CODEPATH']
170
171
# mkdir_p File.join(ENV['CODEPATH'], 'bin'), :verbose => true
172
173
# Rake::FileList.new("#{ENV['CODEPATH']}/**/*.rb").sort.each do |rb_file|
174
# sh File.join(ENV['BINPATH'], 'rbx'), 'compile', rb_file, :verbose => true
175
# end
176
# end
177
178
# desc "Uninstall rubinius and libraries. Helps with build problems."
179
# task :uninstall => :config_env do
180
# rm Dir[File.join(ENV['BINPATH'], 'rbx*')]
181
# rm_r Dir[File.join(ENV['LIBPATH'], '*rubinius*')]
182
# end
183
184
# task :config_env => 'shotgun/config.mk' do
185
# File.foreach 'shotgun/config.mk' do |line|
186
# next unless line =~ /(.*?)=(.*)/
187
# ENV[$1] = $2
188
# end
189
# end
190
191
# task :compiledir => :stable_compiler do
192
# dir = ENV['DIR']
193
# raise "Use DIR= to set which directory" if !dir or dir.empty?
194
# compile_dir(dir)
195
# end
196
197
# # CLEAN TASKS
198
199
desc "Recompile all ruby system files"
200
task :rebuild => %w[clean build]
202
desc 'Remove rubinius build files'
203
task :clean => %w[
204
vm:clean
205
kernel:clean
206
clean:crap
207
extension:clean
208
configure:clean
209
]
211
desc 'Remove rubinius build files and external library build files'
212
task :distclean => %w[
213
clean
214
vm:distclean
215
]
217
namespace :clean do
218
desc "Cleans up editor files and other misc crap"
219
task :crap do
220
files = (Dir["*~"] + Dir["**/*~"]).uniq
222
rm_f files, :verbose => $verbose unless files.empty?
223
end
224
end
225
226
# # SPEC TASKS
227
# desc "Run all 'known good' specs (task alias for spec:ci)"
228
# task :spec => 'spec:ci'
229
230
# namespace :spec do
231
# namespace :setup do
232
# # Setup for 'Subtend' specs. No need to call this yourself.
233
# task :subtend do
234
# Dir["spec/subtend/**/Rakefile"].each do |rakefile|
235
# sh "rake -f #{rakefile}"
236
# end
237
# end
238
# end
239
240
# desc "Run continuous integration examples"
241
# task :ci => :build do
242
# clear_compiler
243
244
# target = ENV['SPEC_TARGET'] || 'rbx'
245
# system %(shotgun/rubinius -e 'puts "rbx build: \#{Rubinius::BUILDREV}"') if target == 'rbx'
246
# sh "bin/mspec ci -t #{target}"
247
# end
248
249
# spec_targets = %w(compiler core language library parser rubinius)
250
# # Build a spec:<task_name> for each group of Rubinius specs
251
# spec_targets.each do |group|
252
# desc "Run #{group} examples"
253
# task group do
254
# sh "bin/mspec spec/#{group}"
255
# end
256
# end
257
258
# desc "Run subtend (Rubinius C API) examples"
259
# task :subtend => "spec:setup:subtend" do
260
# sh "bin/mspec spec/rubinius/subtend"
261
# end
262
263
# # Specdiffs to make it easier to see what your changes have affected :)
264
# desc 'Run specs and produce a diff against current base'
265
# task :diff => 'diff:run'
266
267
# namespace :diff do
268
# desc 'Run specs and produce a diff against current base'
269
# task :run do
270
# system 'bin/mspec -f ci -o spec/reports/specdiff.txt spec'
271
# system 'diff -u spec/reports/base.txt spec/reports/specdiff.txt'
272
# system 'rm spec/reports/specdiff.txt'
273
# end
274
275
# desc 'Replace the base spec file with a new one'
276
# task :replace do
277
# system 'bin/mspec -f ci -o spec/reports/base.txt spec'
278
# end
279
# end
280
281
# task :r2r do
282
# puts ARGV.inspect
283
# end
284
# end
285
286
# # MISC TASKS
287
288
# desc "Build task for CruiseControl"
289
# task :ccrb => [:build, 'spec:ci']