Skip to content
Newer
Older
100644 246 lines (184 sloc) 5.91 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 Add mspec and spec rakelib files from master.
Brian Ford 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 Removed rake spec commands. See rake spec for details.
Brian Ford 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 Removed rake spec commands. See rake spec for details.
Brian Ford 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."
68 task :build => "build:normal"
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 …
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 Reworked compiling C extensions.
Brian Ford 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 …
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
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
88 def install_bin
89 File.join RBX_BINPATH, 'rbx'
90 end
91
92 desc "Uninstall Rubinius"
93 task :uninstall do
94 rm_rf install_bin
95 rm_rf RBX_BASE_PATH
b428a87 Fixed rake install. Issues on your platform?--File a ticket.
Brian Ford authored
96 sh "rake -q clean"
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
97 end
98
99 desc "Install Rubinius"
b428a87 Fixed rake install. Issues on your platform?--File a ticket.
Brian Ford authored
100 task :install => %w[
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
101 clean
102 install:build
103 install:files
104 ] do
b428a87 Fixed rake install. Issues on your platform?--File a ticket.
Brian Ford authored
105 sh "rake -q clean"
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
106 puts "Install complete."
107 puts "The install versions of files have been cleaned."
108 puts "Run 'rake build' to rebuild development versions."
109 end
110
111 namespace :install do
112 # Internal task, not documented with desc. Shells out
113 # to perform the build. See reason in doc/build_system.txt.
114 task :build do
cc4a888 Really fix (un)install tasks.
Brian Ford authored
115 ENV['RBX_PREFIX'] = ENV['PREFIX'] || "/usr/local"
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
116 ENV['RBX_RUNTIME'] = File.join(Dir.pwd, 'runtime')
b428a87 Fixed rake install. Issues on your platform?--File a ticket.
Brian Ford authored
117 sh "rake -q build"
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
118 end
119
120 # Internal task, not documented with desc. Performs the
121 # actual file installation enabling the :install task
122 # to clean up after itself.
123 task :files do
124 mkdir_p RBX_BASE_PATH, :verbose => true
125 mkdir_p RBX_RBA_PATH, :verbose => true
126 mkdir_p RBX_EXT_PATH, :verbose => true
127 mkdir_p RBX_BIN_PATH, :verbose => true
128 mkdir_p RBX_LIB_PATH, :verbose => true
129
130
b428a87 Fixed rake install. Issues on your platform?--File a ticket.
Brian Ford authored
131 capi_header_files = Rake::FileList.new "vm/capi/*.h"
132 install_files capi_header_files, RBX_EXT_PATH
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
133
134 File.open File.join(RBX_EXT_PATH, "missing.h"), "w" do |f|
135 f.puts "// This file left empty"
136 end
137
138 core_files = Rake::FileList.new('runtime/index',
139 'runtime/platform.conf',
140 'runtime/**/*.rb{a,c}',
05763b0 Fixed rake install.
Brian Ford authored
141 'runtime/**/load_order.txt')
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
142 install_files core_files, RBX_RBA_PATH
143
144 lib_files = Rake::FileList.new 'lib/**/*'
145 install_files lib_files, RBX_LIB_PATH
146
147 Rake::FileList.new("#{RBX_LIB_PATH}/**/*.rb").sort.each do |rb|
b428a87 Fixed rake install. Issues on your platform?--File a ticket.
Brian Ford authored
148 begin
149 compile_ruby rb, "#{rb}c"
150 rescue Object => e
151 puts "Error compiling #{rb}!"
152 puts e.backtrace
153 puts "Install continuing but please file a ticket"
154 end
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
155 end
156
157 install 'vm/vm', install_bin, :mode => 0755, :verbose => true
158 end
159 end
160
5c51236 @seydar added task :compare to the Rakefile on cpp branch
seydar authored
161 def rbx_compile(from)
162 sh "bin/rbx compile -f #{from}"
163 end
164
165 desc 'Compare an rbc file made by MRI with one made by rbx'
166 task :compare, :file do |task, args|
167 file = args[:file]
168 raise "Please supply something that exists" unless File.exist? file
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
169
5c51236 @seydar added task :compare to the Rakefile on cpp branch
seydar authored
170 mri_compile file, file + 'c.mri'
171 rbx_compile file
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
172
5c51236 @seydar added task :compare to the Rakefile on cpp branch
seydar authored
173 File.open(file + 'c.mri') do |mri|
174 File.open(file + 'c') do |rbx|
175 while m = mri.gets and r = rbx.gets
176 puts "Line of Failure: #{rbx.lineno}" and break unless m === r
177 end
178 end
179 end
0e1df2f Added rake install and rake uninstall tasks.
Brian Ford authored
180
5c51236 @seydar added task :compare to the Rakefile on cpp branch
seydar authored
181 end
182
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
183 namespace :clean do
184 desc "Cleans up editor files and other misc crap"
185 task :crap do
186 files = (Dir["*~"] + Dir["**/*~"]).uniq
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
187
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
188 rm_f files, :verbose => $verbose unless files.empty?
189 end
190 end
2e737d7 Removed rake spec commands. See rake spec for details.
Brian Ford authored
191
192 desc "Documents why no spec tasks exist"
193 task :spec do
194 puts <<-EOM
195
196 The spec and spec:xxx commands are deprecated (and removed).
ea5bf64 @mernen s/psuedo/pseudo/
mernen authored
197 Use bin/mspec directly. MSpec provides 'pseudo-directories',
2e737d7 Removed rake spec commands. See rake spec for details.
Brian Ford authored
198 which are labels that refer to sets of specs to run. Refer
199 to spec/default.mspec, spec/full.mspec and the MSpec docs
200 for full details.
201
202 The following are likely scenarios for running the specs.
203 Unless -t <target> is passed to mspec, bin/rbx is run.
204
205 Run the CI specs that are run with the default 'rake' command
206
207 bin/mspec ci
208
209 Run _all_ the CI spec:
210
211 bin/mspec ci -B full
212
213 Run all the frozen specs:
214
215 bin/mspec
216
217 Run all the frozen Array specs:
218
219 bin/mspec core/array
220 OR
221 bin/mspec spec/frozen/core/array
222
223 Run spec/frozen/core/array/append_spec.rb:
224
225 bin/mspec core/array/append
226 OR
227 bin/mspec spec/frozen/core/array/append_spec.rb
228
229 Run all the compiler specs:
230
231 bin/mspec :compiler
232
233 Run all the [language, core, library, capi] specs:
234
235 bin/mspec :language
236 bin/mspec :core
237 ...
238
239 Run all the spec/ruby specs using the MRI on your path
240 (assuming you have run 'rake rubyspec:update'):
241
242 bin/mspec -tr :ruby
243
244 EOM
245 end
Something went wrong with that request. Please try again.