Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 334 lines (281 sloc) 8.401 kB
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
1 require 'tsort'
2
d630d96 Rakefile now supports rake report:all which runs all of the reports. …
Ryantm authored
3 task :default => :tasks
4
5 task :tasks do
6 puts `rake -T`
7 end
8dd2b6b @evanphx r43@vatu: evan | 2006-08-24 16:34:21 -0700
evanphx authored
8
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
9 class Hash
10 include TSort
11
12 alias tsort_each_node each_key
13
14 def tsort_each_child(node, &block)
15 fetch(node).each(&block)
16 end
17 end
18
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
19 def newer?(file, cmp)
20 File.exists?(cmp) and File.mtime(cmp) >= File.mtime(file)
21 end
939f9ac @evanphx Revert array changes back to r1088. r1089 is busted bigtime.
evanphx authored
22
329ec45 @evanphx Loading directly from directory structure
evanphx authored
23 def setup_stable
24 @pb = "runtime/stable/bootstrap.rba"
25 @pp = "runtime/stable/platform.rba"
26 @pc = "runtime/stable/core.rba"
27 @pl = "runtime/stable/loader.rbc"
28 @pr = "runtime/stable/compiler.rba"
29
30 if ENV['USE_CURRENT']
31 puts "Use current versions, not stable."
32 else
33 ENV['BOOTSTRAP'] = @pb
34 ENV['CORE'] = @pc
35 ENV['LOADER'] = @pl
36 ENV['PLATFORM'] = @pp
37 ENV['COMPILER'] = @pr
38 end
54cae11 @evanphx Added more IO stuff and platform methods.
evanphx authored
39
329ec45 @evanphx Loading directly from directory structure
evanphx authored
40 @compiler = ENV['COMPILER']
be1a8ed @wilson Include compiler archive in list of files managed by 'dev:setup'
wilson authored
41 end
42
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
43 def source_name(compiled)
44 File.basename(compiled, '.*') + '.rb'
45 end
46
47 def compiled_name(source, dir)
48 File.join(dir, File.basename(source, '.*') + '.rbc')
49 end
50
51 # Some files have load order dependencies. To specify a load order
52 # dependency, include a comment in the file that has the dependency.
53 # For example, assume files a.rb and b.rb, where a.rb requires that
54 # b.rb is loaded first. In a.rb, include a comment
55 # # depends on: b.rb
56 #
57 # The 'depends on:' declaration takes a space separated list of file.
58 # When the '.load_order.txt' file is created, a topological sort
59 # (see name caveat in TSort) of the dependencies is performed
60 # so files that are depended on are loaded first.
61 #
62 # If there is a 'depends on:' declarations for a non-existent file,
63 # or if there are cyclic dependencies, this method will not create
64 # the '.load_order.txt' file.
65
66 def create_load_order(files)
67 d = Hash.new { |h,k| h[k] = [] }
68
69 # assume all the files are in the same directory
70 dir = File.dirname(files.first)
71 files.each do |fname|
72 name = source_name(fname)
73 d[name]
74 File.open(File.join(dir, name), "r") do |f|
75 f.each do |line|
76 if m = /#\s*depends on:\s*(.*)/.match(line)
77 m[1].split.each { |dep| d[name] << dep }
78 end
79 end
80 end
81 end
82
83 File.open(".load_order.txt", "w") do |f|
84 begin
85 f.puts d.tsort.collect { |n| compiled_name(n, dir) }.join("\n")
86 rescue IndexError
87 puts "Unable to generate '.load_order.txt'"
88 puts "Most likely, a file includes a 'depends on:' declaration for a non-existent file"
89 exit 1
90 rescue TSort::Cyclic => e
91 puts "Unable to generate '.load_order.txt' due to a cyclic dependency\n (#{e.message})"
92 exit 1
93 end
94 end
95 end
96
329ec45 @evanphx Loading directly from directory structure
evanphx authored
97 def update_dir(files, dir, deps=true)
98 dir = File.expand_path(ENV['OUTPUT'] || dir)
99 clean = ENV['CLEAN']
100
101 files.each do |file|
102 cmp = File.join(dir, "#{file}c")
103 if clean or !newer?(file, cmp)
104 if @compiler
105 system "shotgun/rubinius -I#{@compiler} compile #{file} #{cmp}"
106 else
107 system "shotgun/rubinius compile #{file} #{cmp}"
108 end
109 end
110 file << "c"
111 end
112
113 if deps
114 create_load_order(files)
115 else
116 File.open(".load_order.txt","w") { |f| f.puts files.join("\n") }
117 end
118 end
119
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
120 def update_archive(files, archive, deps=true, dir=nil)
939f9ac @evanphx Revert array changes back to r1088. r1089 is busted bigtime.
evanphx authored
121 archive = File.expand_path(ENV['OUTPUT'] || archive)
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
122
329ec45 @evanphx Loading directly from directory structure
evanphx authored
123 clean = ENV['CLEAN']
124
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
125 changed = []
126 files.each do |file|
127 cmp = "#{file}c"
329ec45 @evanphx Loading directly from directory structure
evanphx authored
128 if clean or !newer?(file, cmp)
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
129 changed << cmp
567d4f7 @evanphx Stack allocated lvars, GC fixes, compiler changes, oh my!
evanphx authored
130 if @compiler
131 system "shotgun/rubinius -I#{@compiler} compile #{file}"
132 else
133 system "shotgun/rubinius compile #{file}"
134 end
939f9ac @evanphx Revert array changes back to r1088. r1089 is busted bigtime.
evanphx authored
135 elsif !File.exists?(archive)
136 changed << cmp
6b9c27b Complete rspec coverage of subtend string compat to date.
Kev authored
137 end
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
138 file << "c"
e1683f8 @brixen updated rake task doc:contrib:easy. Added spec:setup:code_cache to cl…
brixen authored
139 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
140
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
141 curdir = Dir.getwd
142 if dir
939f9ac @evanphx Revert array changes back to r1088. r1089 is busted bigtime.
evanphx authored
143 Dir.chdir(dir)
144 changed.map! { |f| f.gsub(%r!^#{dir}/!, "") }
cdfdc27 Added my idea of a sanity check against MRI for compatibility purposes
Mae authored
145 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
146
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
147 if deps
148 create_load_order(files)
149 else
150 File.open(".load_order.txt","w") { |f| f.puts files.join("\n") }
086f889 * bin/specrunner is a small bash kludge for running mini_rspec over
Eero Saynatkari authored
151 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
152
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
153 if File.exists? archive
154 if changed.empty?
155 puts "No files to update."
156 else
157 system "zip -u #{archive} .load_order.txt #{changed.join(' ')}"
086f889 * bin/specrunner is a small bash kludge for running mini_rspec over
Eero Saynatkari authored
158 end
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
159 else
939f9ac @evanphx Revert array changes back to r1088. r1089 is busted bigtime.
evanphx authored
160 system "zip #{archive} .load_order.txt #{changed.join(' ')}"
086f889 * bin/specrunner is a small bash kludge for running mini_rspec over
Eero Saynatkari authored
161 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
162
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
163 Dir.chdir(curdir) if dir
4d4f6fa @brixen Added namespaces to the Rakefile with aliases to the old tasks.
brixen authored
164 end
165
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
166 # spec tasks
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
167 desc "Run all 'known good' specs (task alias for spec:ci)"
8b118bf Removed legacy rake tasks
Brian Ford authored
168 task :spec => 'spec:ci'
d0e6b65 @brixen changes to support better CI specs
brixen authored
169
03dfae6 @brixen Added rake task spec:ci. added svn:executable for bin/mspec. enhanced…
brixen authored
170 namespace :spec do
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
171 namespace :setup do
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
172 # Setup for 'Subtend' specs. No need to call this yourself.
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
173 task :subtend do
ed682b8 @mkhl Fix rake spec:subtend:setup.
mkhl authored
174 Dir["spec/subtend/**/Rakefile"].each do |rakefile|
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
175 sh "rake -f #{rakefile}"
176 end
177 end
178 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
179
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
180 desc "Run continuous integration examples"
03dfae6 @brixen Added rake task spec:ci. added svn:executable for bin/mspec. enhanced…
brixen authored
181 task :ci do
c7d623e @brixen enhanced spec:ci to take a target on the command line, invoke like: S…
brixen authored
182 target = ENV['SPEC_TARGET'] || 'rbx'
183 system %(shotgun/rubinius -e 'puts "rbx build: \#{Rubinius::BUILDREV}"') if target == 'rbx'
4ef0b9f @brixen Updated exclusion list for CI specs.
brixen authored
184 sh "bin/ci -t #{target}"
03dfae6 @brixen Added rake task spec:ci. added svn:executable for bin/mspec. enhanced…
brixen authored
185 end
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
186
8b118bf Removed legacy rake tasks
Brian Ford authored
187 spec_targets = %w(compiler core language library parser rubinius)
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
188 # Build a spec:<task_name> for each group of Rubinius specs
189 spec_targets.each do |group|
190 desc "Run #{group} examples"
d08e789 @brixen fixed typo. bad typo. that's a no.
brixen authored
191 task group do
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
192 sh "bin/mspec spec/#{group}"
193 end
194 end
195
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
196 desc "Run subtend (Rubinius C API) examples"
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
197 task :subtend => "spec:setup:subtend" do
d0e6b65 @brixen changes to support better CI specs
brixen authored
198 sh "bin/mspec spec/rubinius/subtend"
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
199 end
200
201 # Specdiffs to make it easier to see what your changes have affected :)
202 desc 'Run specs and produce a diff against current base'
203 task :diff => 'diff:run'
204
205 namespace :diff do
206 desc 'Run specs and produce a diff against current base'
207 task :run do
d0e6b65 @brixen changes to support better CI specs
brixen authored
208 system 'bin/mspec -f ci -o spec/reports/specdiff.txt spec'
209 system 'diff -u spec/reports/base.txt spec/reports/specdiff.txt'
210 system 'rm spec/reports/specdiff.txt'
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
211 end
212
213 desc 'Replace the base spec file with a new one'
214 task :replace do
d0e6b65 @brixen changes to support better CI specs
brixen authored
215 system 'bin/mspec -f ci -o spec/reports/base.txt spec'
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
216 end
217 end
d630d96 Rakefile now supports rake report:all which runs all of the reports. …
Ryantm authored
218
219 task :r2r do
220 puts ARGV.inspect
221 end
03dfae6 @brixen Added rake task spec:ci. added svn:executable for bin/mspec. enhanced…
brixen authored
222 end
223
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
224 desc "Build Shotgun (task alias for build:shotgun)"
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
225 task :build => ['build:shotgun']
226
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
227 desc "Removes build by-products for Rubinius runtime components"
fe0357b @brixen Commited patch from gotascii for #174 and #175.
brixen authored
228 task :clean => ['clean:compiler', 'clean:bootstrap', 'clean:core', 'clean:platform']
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
229
230 namespace :clean do
231 desc "Removes build by-products for compiler"
232 task :compiler do
40ee994 @brixen Fix clean:compiler and clean:platform Rake tasks.
brixen authored
233 FileList['compiler/**/*.rbc', '/tmp/*.rbc'].each do |fn|
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
234 FileUtils.rm fn rescue nil
4d4f6fa @brixen Added namespaces to the Rakefile with aliases to the old tasks.
brixen authored
235 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
236 end
237
fe0357b @brixen Commited patch from gotascii for #174 and #175.
brixen authored
238 desc "Removes build by-products for platform"
239 task :platform do
40ee994 @brixen Fix clean:compiler and clean:platform Rake tasks.
brixen authored
240 FileList['kernel/platform/**/*.rbc'].each do |fn|
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
241 FileUtils.rm fn rescue nil
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
242 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
243 end
5468980 @evanphx kernel/ reorg! New functionality goes in kernel/core only. kernel.rba…
evanphx authored
244
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
245 desc "Removes build by-products for bootstrap"
246 task :bootstrap do
247 FileList['kernel/bootstrap/**/*.rbc'].each do |fn|
248 FileUtils.rm fn rescue nil
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
249 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
250 end
5468980 @evanphx kernel/ reorg! New functionality goes in kernel/core only. kernel.rba…
evanphx authored
251
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
252 desc "Removes build by-products for core"
253 task :core do
254 FileList['kernel/core/**/*.rbc'].each do |fn|
255 FileUtils.rm fn rescue nil
5468980 @evanphx kernel/ reorg! New functionality goes in kernel/core only. kernel.rba…
evanphx authored
256 end
257 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
258 end
404f8ab Don't call configure on build:shotgun everytime.
Tilman authored
259
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
260 namespace :build do
404f8ab Don't call configure on build:shotgun everytime.
Tilman authored
261 file "shotgun/config.h" do
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
262 sh "./configure"
263 raise 'Failed to configure Rubinius' unless $?.success?
3751f33 @evanphx * Reworked the Rakefile to build the compiler by detection, like boot…
evanphx authored
264 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
265
404f8ab Don't call configure on build:shotgun everytime.
Tilman authored
266 task :configure => ["shotgun/config.h"] do
267 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
268
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
269 desc "Compiles shotgun (the C-code VM)"
270 task :shotgun => :configure do
685576c Ticket #80: Respect environment variables that influence the build pr…
Tilman authored
271 sh "make"
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
272 raise 'Failed to build shotgun' unless $?.success?
34ad791 * Disabled Lightning's dissembler on amd64
Eero Saynatkari authored
273 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
274
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
275 desc "Compiles the Rubinius bootstrap archive"
276 task :bootstrap do
329ec45 @evanphx Loading directly from directory structure
evanphx authored
277 setup_stable
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
278 files = Dir["kernel/bootstrap/*.rb"].sort
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
279 update_archive files, 'runtime/bootstrap.rba', false
9463145 @brixen Updates to Rakefile, added rbx namespace to compile with rbx instead …
brixen authored
280 end
34ad791 * Disabled Lightning's dissembler on amd64
Eero Saynatkari authored
281
329ec45 @evanphx Loading directly from directory structure
evanphx authored
282 desc "Compiles the Rubinius core directory"
3751f33 @evanphx * Reworked the Rakefile to build the compiler by detection, like boot…
evanphx authored
283 task :core do
329ec45 @evanphx Loading directly from directory structure
evanphx authored
284 setup_stable
285 puts "Updating compiled files in runtime/core/"
34ad791 * Disabled Lightning's dissembler on amd64
Eero Saynatkari authored
286 files = Dir["kernel/core/*.rb"].sort
329ec45 @evanphx Loading directly from directory structure
evanphx authored
287 update_dir files, 'runtime/core'
34ad791 * Disabled Lightning's dissembler on amd64
Eero Saynatkari authored
288 end
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
289
6001be6 @evanphx loader.rb is now seperated from bootstrap and core.
evanphx authored
290 task :loader do
329ec45 @evanphx Loading directly from directory structure
evanphx authored
291 setup_stable
6001be6 @evanphx loader.rb is now seperated from bootstrap and core.
evanphx authored
292 i = "kernel/loader.rb"
b8728ab @evanphx Switched to intcode (each opcode is 32bits now)
evanphx authored
293 o = ENV['OUTPUT'] || "runtime/loader.rbc"
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
294
6001be6 @evanphx loader.rb is now seperated from bootstrap and core.
evanphx authored
295 if @compiler
296 system "shotgun/rubinius -I#{@compiler} compile #{i} #{o}"
297 else
298 system "shotgun/rubinius compile #{i} #{o}"
299 end
300 end
301
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
302 desc "Compiles the Rubinius compiler archive"
3751f33 @evanphx * Reworked the Rakefile to build the compiler by detection, like boot…
evanphx authored
303 task :compiler do
329ec45 @evanphx Loading directly from directory structure
evanphx authored
304 setup_stable
fc54f03 @evanphx Cleaned up compiler layout
evanphx authored
305 files = Dir["compiler/**/*.rb"].sort
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
306 update_archive files, 'runtime/compiler.rba', false, "compiler"
e8b73c6 @wilson * Added build:delete_rbc task to clean up all rbc files, everywhere.
wilson authored
307 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
308
541bcb5 @evanphx Complete reorganization of bootstrap. Addition of kernel/platform. FF…
evanphx authored
309 desc "Compiles the Rubinius platform archive"
310 task :platform do
329ec45 @evanphx Loading directly from directory structure
evanphx authored
311 setup_stable
312 puts "Updating compiled files in runtime/platform/"
541bcb5 @evanphx Complete reorganization of bootstrap. Addition of kernel/platform. FF…
evanphx authored
313 files = Dir["kernel/platform/*.rb"].sort
329ec45 @evanphx Loading directly from directory structure
evanphx authored
314 update_dir files, 'runtime/platform'
541bcb5 @evanphx Complete reorganization of bootstrap. Addition of kernel/platform. FF…
evanphx authored
315 end
baae928 big updates to reporting stuff
Mae authored
316 end
b7db3df Further fixes to the completeness report raking
Cabo authored
317
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
318 desc "Remove all compiled Ruby files"
9e24421 @wilson * Use a random pivot point for better worst-case Array#sort performance
wilson authored
319 task :pristine do
320 FileList['**/*.rbc'].each do |fn|
329ec45 @evanphx Loading directly from directory structure
evanphx authored
321 next if /^runtime/.match(fn)
9e24421 @wilson * Use a random pivot point for better worst-case Array#sort performance
wilson authored
322 FileUtils.rm fn rescue nil
323 end
324 end
325
121d2bb @evanphx A little magic for a more bulletproof process. Run rake dev:setup aft…
evanphx authored
326 # dev tasks
327 namespace :dev do
b4e6651 @wilson Give rake dev:setup a better description
wilson authored
328 desc "Make a snapshot of the runtime files for your own safety"
121d2bb @evanphx A little magic for a more bulletproof process. Run rake dev:setup aft…
evanphx authored
329 task :setup do
329ec45 @evanphx Loading directly from directory structure
evanphx authored
330 puts "OBSOLETE. You no longer need to do this."
121d2bb @evanphx A little magic for a more bulletproof process. Run rake dev:setup aft…
evanphx authored
331 end
332 end
333
Something went wrong with that request. Please try again.