Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 254 lines (191 sloc) 6.26 kb
90c05c1 @drbrain Update INSTALL to latest information.
drbrain authored
1 # NOTE! When updating this file, also update INSTALL, if necessary.
a8bdc6b @evanphx Cleanup / reorganize Rakefile
evanphx authored
2 # NOTE! Please keep your tasks grouped together.
90c05c1 @drbrain Update INSTALL to latest information.
drbrain authored
3
1088784 Silence a rake warning
Jacqui Maher and Wilson Bilkovich authored
4 $trace ||= false
69a6063 Enable warnings for rake.
Tilman Sauerbeck authored
5 $VERBOSE = true
bdcf9cb @rue DEV is gone. See `rake build:help`. vm:test always uses debug flags.
rue authored
6 $verbose = Rake.application.options.trace || ARGV.delete("-v")
7
a352624 Start of new LLVM JIT
Evan Phoenix authored
8 if !$verbose and respond_to?(:verbose)
9 verbose(false) if verbose() == :default
10 end
11
be4319e Don't hardcode extension suffixes to 'bundle'.
Tilman Sauerbeck authored
12 $dlext = Config::CONFIG["DLEXT"]
eda2c1b @evanphx compiler is dead, long live compiler1!
evanphx authored
13 $compiler = nil
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
14
9ebee09 @brixen Add mspec and spec rakelib files from master.
brixen authored
15 RUBINIUS_BASE = File.expand_path(File.dirname(__FILE__))
16
d8e1291 @mernen Move "lib" inclusion to load path into Rakefile
mernen authored
17 $: << "lib"
18
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
19 task :default => %w[build vm:test] do
17da856 Use 'sh' rather than 'system' so that $? is propagated
Evan Phoenix authored
20 sh "bin/mspec ci -B full --background"
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
21 end
8dd2b6b @evanphx r43@vatu: evan | 2006-08-24 16:34:21 -0700
evanphx authored
22
c5b5a97 @drbrain Move run_ruby, compile_ruby to main Rakefile and set RBX_RUNTIME
drbrain authored
23 desc "Compile the given ruby file into a .rbc file"
24 task :compile_ruby, :file do |task, args|
25 file = args[:file]
26 raise ArgumentError, 'compile_ruby requires a file name' if file.nil?
27
28 rbc = file + 'c'
29
30 compile_ruby file, rbc
31 end
32 task :compile_ruby => 'kernel:build' # HACK argument + dependency is broken
33
46b6e4d @drbrain Add precompile task
drbrain authored
34 desc "Run the given ruby file with the vm"
c5b5a97 @drbrain Move run_ruby, compile_ruby to main Rakefile and set RBX_RUNTIME
drbrain authored
35 task :run_ruby, :file do |task, args|
36 file = args[:file]
37 raise ArgumentError, 'compile_ruby requires a file name' if file.nil?
38
39 rbc = file + 'c'
40
41 compile_ruby file, rbc
42
43 ENV['PROBE'] = 'yes' if $verbose
44 ENV['RBX_RUNTIME'] = File.join File.dirname(__FILE__), 'runtime'
45
46 sh 'vm/vm', rbc
47 end
8e08782 @drbrain run_ruby needs vm/vm
drbrain authored
48 task :run_ruby => %w[kernel:build vm/vm] # HACK argument + dependency is broken
c5b5a97 @drbrain Move run_ruby, compile_ruby to main Rakefile and set RBX_RUNTIME
drbrain authored
49
46b6e4d @drbrain Add precompile task
drbrain authored
50 desc "Compile files with MRI because vm takes forever to do it"
51 task :precompile => %w[extensions] do
562a6b1 Expanded precompile dir list
Ryan Davis authored
52 FileList['{mspec,kernel,lib,spec}/**/*.rb'].each do |rb|
46b6e4d @drbrain Add precompile task
drbrain authored
53 next unless File.file? rb
54
55 rbc = "#{rb}c"
56
57 if File.exist? rbc then
58 rbc_mtime = File.mtime rbc
59 next if rbc_mtime >= COMPILER_MTIME or rbc_mtime >= File.mtime(rb)
60 end
61
62 mri_compile rb, rbc
63 end
64 end
65
bdcf9cb @rue DEV is gone. See `rake build:help`. vm:test always uses debug flags.
rue authored
66 # See vm.rake for more information
67 desc "Build everything that needs to be built at default level."
56edbca Add rdoc, rake, and rake-compiler and preinstalled gems
Evan Phoenix authored
68 task :build => ["build:normal", "gem_bootstrap"]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
69
90ffc92 @drbrain Rip out irrelevant parts of the Rakefile
drbrain authored
70 desc "Recompile all ruby system files"
71 task :rebuild => %w[clean build]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
72
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake tas...
drbrain authored
73 desc 'Remove rubinius build files'
af222ee @drbrain Restore generation of ruby_config and rubinius_config, add clean rules
drbrain authored
74 task :clean => %w[
75 vm:clean
76 kernel:clean
77 clean:crap
9ed0630 @brixen Reworked compiling C extensions.
brixen authored
78 extensions:clean
af222ee @drbrain Restore generation of ruby_config and rubinius_config, add clean rules
drbrain authored
79 configure:clean
80 ]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
81
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake tas...
drbrain authored
82 desc 'Remove rubinius build files and external library build files'
af222ee @drbrain Restore generation of ruby_config and rubinius_config, add clean rules
drbrain authored
83 task :distclean => %w[
84 clean
85 vm:distclean
86 ]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
87
56edbca Add rdoc, rake, and rake-compiler and preinstalled gems
Evan Phoenix authored
88 desc 'Move the preinstalled gem setup into place'
89 task :gem_bootstrap do
90 unless File.directory?("gems/rubinius")
91 sh "mkdir gems"
92 sh "cp -r preinstalled-gems gems/rubinius"
93 end
94 end
95
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
96 def install_bin
97 File.join RBX_BINPATH, 'rbx'
98 end
99
100 desc "Uninstall Rubinius"
101 task :uninstall do
102 rm_rf install_bin
103 rm_rf RBX_BASE_PATH
b428a87 @brixen Fixed rake install. Issues on your platform?--File a ticket.
brixen authored
104 sh "rake -q clean"
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
105 end
106
107 desc "Install Rubinius"
b428a87 @brixen Fixed rake install. Issues on your platform?--File a ticket.
brixen authored
108 task :install => %w[
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
109 clean
110 install:build
111 install:files
112 ] do
b428a87 @brixen Fixed rake install. Issues on your platform?--File a ticket.
brixen authored
113 sh "rake -q clean"
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
114 puts "Install complete."
115 puts "The install versions of files have been cleaned."
116 puts "Run 'rake build' to rebuild development versions."
117 end
118
119 namespace :install do
120 # Internal task, not documented with desc. Shells out
121 # to perform the build. See reason in doc/build_system.txt.
122 task :build do
cc4a888 @brixen Really fix (un)install tasks.
brixen authored
123 ENV['RBX_PREFIX'] = ENV['PREFIX'] || "/usr/local"
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
124 ENV['RBX_RUNTIME'] = File.join(Dir.pwd, 'runtime')
b428a87 @brixen Fixed rake install. Issues on your platform?--File a ticket.
brixen authored
125 sh "rake -q build"
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
126 end
127
128 # Internal task, not documented with desc. Performs the
129 # actual file installation enabling the :install task
130 # to clean up after itself.
131 task :files do
132 mkdir_p RBX_BASE_PATH, :verbose => true
133 mkdir_p RBX_RBA_PATH, :verbose => true
134 mkdir_p RBX_EXT_PATH, :verbose => true
135 mkdir_p RBX_BIN_PATH, :verbose => true
136 mkdir_p RBX_LIB_PATH, :verbose => true
137
138
b428a87 @brixen Fixed rake install. Issues on your platform?--File a ticket.
brixen authored
139 capi_header_files = Rake::FileList.new "vm/capi/*.h"
140 install_files capi_header_files, RBX_EXT_PATH
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
141
142 File.open File.join(RBX_EXT_PATH, "missing.h"), "w" do |f|
143 f.puts "// This file left empty"
144 end
145
146 core_files = Rake::FileList.new('runtime/index',
147 'runtime/platform.conf',
148 'runtime/**/*.rb{a,c}',
05763b0 @brixen Fixed rake install.
brixen authored
149 'runtime/**/load_order.txt')
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
150 install_files core_files, RBX_RBA_PATH
151
152 lib_files = Rake::FileList.new 'lib/**/*'
153 install_files lib_files, RBX_LIB_PATH
154
155 Rake::FileList.new("#{RBX_LIB_PATH}/**/*.rb").sort.each do |rb|
b428a87 @brixen Fixed rake install. Issues on your platform?--File a ticket.
brixen authored
156 begin
157 compile_ruby rb, "#{rb}c"
158 rescue Object => e
159 puts "Error compiling #{rb}!"
160 puts e.backtrace
161 puts "Install continuing but please file a ticket"
162 end
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
163 end
164
165 install 'vm/vm', install_bin, :mode => 0755, :verbose => true
166 end
167 end
168
5c51236 @seydar added task :compare to the Rakefile on cpp branch
seydar authored
169 def rbx_compile(from)
170 sh "bin/rbx compile -f #{from}"
171 end
172
173 desc 'Compare an rbc file made by MRI with one made by rbx'
174 task :compare, :file do |task, args|
175 file = args[:file]
176 raise "Please supply something that exists" unless File.exist? file
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
177
5c51236 @seydar added task :compare to the Rakefile on cpp branch
seydar authored
178 mri_compile file, file + 'c.mri'
179 rbx_compile file
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
180
5c51236 @seydar added task :compare to the Rakefile on cpp branch
seydar authored
181 File.open(file + 'c.mri') do |mri|
182 File.open(file + 'c') do |rbx|
183 while m = mri.gets and r = rbx.gets
184 puts "Line of Failure: #{rbx.lineno}" and break unless m === r
185 end
186 end
187 end
0e1df2f @brixen Added rake install and rake uninstall tasks.
brixen authored
188
5c51236 @seydar added task :compare to the Rakefile on cpp branch
seydar authored
189 end
190
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake tas...
drbrain authored
191 namespace :clean do
192 desc "Cleans up editor files and other misc crap"
193 task :crap do
194 files = (Dir["*~"] + Dir["**/*~"]).uniq
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
195
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake tas...
drbrain authored
196 rm_f files, :verbose => $verbose unless files.empty?
197 end
198 end
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
199
200 desc "Documents why no spec tasks exist"
201 task :spec do
202 puts <<-EOM
203
204 The spec and spec:xxx commands are deprecated (and removed).
ea5bf64 @mernen s/psuedo/pseudo/
mernen authored
205 Use bin/mspec directly. MSpec provides 'pseudo-directories',
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
206 which are labels that refer to sets of specs to run. Refer
207 to spec/default.mspec, spec/full.mspec and the MSpec docs
208 for full details.
209
210 The following are likely scenarios for running the specs.
211 Unless -t <target> is passed to mspec, bin/rbx is run.
212
213 Run the CI specs that are run with the default 'rake' command
214
215 bin/mspec ci
216
217 Run _all_ the CI spec:
218
219 bin/mspec ci -B full
220
221 Run all the frozen specs:
222
223 bin/mspec
224
225 Run all the frozen Array specs:
226
227 bin/mspec core/array
228 OR
229 bin/mspec spec/frozen/core/array
230
231 Run spec/frozen/core/array/append_spec.rb:
232
233 bin/mspec core/array/append
234 OR
235 bin/mspec spec/frozen/core/array/append_spec.rb
236
237 Run all the compiler specs:
238
239 bin/mspec :compiler
240
241 Run all the [language, core, library, capi] specs:
242
243 bin/mspec :language
244 bin/mspec :core
245 ...
246
247 Run all the spec/ruby specs using the MRI on your path
248 (assuming you have run 'rake rubyspec:update'):
249
250 bin/mspec -tr :ruby
251
252 EOM
253 end
Something went wrong with that request. Please try again.