Skip to content
This repository
Browse code

* Near-total rewrite of the Rakefile. Tasks that use rcompile are in …

…the 'legacy' namespace
  • Loading branch information...
commit dc16b49be52d33371f7d940206bbbf184265402e 1 parent b062a13
Wilson Bilkovich wilson authored

Showing 3 changed files with 311 additions and 601 deletions. Show diff stats Hide diff stats

  1. +81 601 Rakefile
  2. +95 0 rake/legacy_tasks.rb
  3. +135 0 rake/rubinius_spec_tasks.rb
682 Rakefile
... ... @@ -1,438 +1,124 @@
1   -ROOT = File.expand_path(File.dirname(__FILE__))
2   -
3   -def require_files(files)
4   - files.each do |path|
5   - begin
6   - require(path)
7   - rescue Object => e
8   - STDERR.puts "Unable to load #{path}. #{e.message} (#{e.class})"
9   - end
10   - end
11   -end
12   -
13   -begin
14   - require 'spec/rake/spectask'
15   -rescue LoadError
16   - raise <<-EOM
17   - Unable to load spec/rake/spectask. RSpec is a requirement to build Rubinius.
18   - Please install RSpec before building (http://rspec.rubyforge.org).
19   -EOM
20   -end
21   -
22   -# specify the compiler to use
23   -COMPILER="../bin/obsolete.rcompile"
24   -# COMPILER="../shotgun/rubinius -c"
25   -
26   -# require local rake libs
27   -# doesn't do anything gracefully on load error (yet)
28   -paths = Dir[ File.join(File.dirname(__FILE__), 'rake/*') ]
29   -require_files(paths)
30   -
31   -# By default, run all the specs and tests
  1 +require 'rake/rubinius_spec_tasks'
  2 +require 'rake/legacy_tasks'
32 3 task :default => :spec
33 4
34   -desc 'Run all specs'
35   -task :spec => 'spec:new'
36   -#desc "Run all specs and tests."
37   -#task :spec do
38   -# Rake::Task['spec:all'].invoke rescue got_error = true
39   -#
40   -# raise "Spec or test failures." if got_error
41   -#end
42   -
43   -namespace :spec do
44   - desc "Run all specs and tests."
45   - task :all do
46   - Rake::Task['spec:only'].invoke rescue got_error = true
47   - Rake::Task['test:all'].invoke rescue got_error = true
48   -
49   - raise "Spec or test failures." if got_error
50   - end
51   -
52   - desc "Setup code-cache directory"
53   - task :setup => 'setup:code_cache'
  5 +def newer?(file, cmp)
  6 + File.exists?(cmp) and File.mtime(cmp) >= File.mtime(file)
  7 +end
  8 +def update_archive(files, archive, dir=nil)
  9 + archive = File.expand_path archive
54 10
55   - namespace :setup do
56   - desc "Setup code-cache directory"
57   - task :code_cache do
58   - Dir.mkdir "code-cache" unless File.exists?("code-cache")
59   - FileUtils.rm Dir.glob("code-cache/*")
60   - end
61   -
62   - task :subtend do
63   - Dir[File.join(File.dirname(__FILE__),"spec/subtend/**/Rakefile")].each do |rakefile|
64   - sh "rake -f #{rakefile}"
65   - end
  11 + changed = []
  12 + files.each do |file|
  13 + cmp = "#{file}c"
  14 + unless newer?(file, cmp)
  15 + changed << cmp
  16 + system "shotgun/rubinius compile #{file}"
66 17 end
  18 + file << "c"
67 19 end
68 20
69   - desc "Run only specs but not any tests."
70   - spec_targets = %w(language shotgun library core targets primitives)
71   -
72   - # Convenience method to run a single spec test
73   - spec_targets.each do |group|
74   - spec_files = Dir[ File.join(File.dirname(__FILE__),"spec/#{group}/*_spec.rb") ]
75   - GroupSpecTask.new(group)
76   - namespace group do
77   - spec_files.each do |file|
78   - SpecificGroupSpecTask.new(File.basename(file, '_spec.rb'), :core)
79   - end
80   - end
81   - end
82   -
83   -
84   - task :only => spec_targets.collect! { |g| 'spec:' << g }
85   -
86   - # experimental -- need to adjust exclusions depending on what your testing
87   - namespace :coverage do
88   - desc "Generate a coverage report for the library specs."
89   - GroupCoverageReport.new(:library)
90   -
91   - desc "Generate a coverage report for the core specs."
92   - GroupCoverageReport.new(:core)
  21 + curdir = Dir.getwd
  22 + if dir
  23 + Dir.chdir(dir)
  24 + changed.map! { |f| f.gsub!(%r!^#{dir}/!, "") }
93 25 end
94 26
95   - # New runner
96   - desc 'Run all specs'
97   - task :new do
98   - system 'bin/specrunner spec'
  27 + File.open(".load_order.txt","w") do |f|
  28 + f.puts files.join("\n")
99 29 end
100 30
101   - # Specdiffs to make it easier to see what your changes have affected :)
102   - desc 'Run specs and produce a diff against current base'
103   - task :diff => 'diff:run'
104   -
105   - namespace :diff do
106   - desc 'Run specs and produce a diff against current base'
107   - task :run do
108   - system 'bin/specrunner spec > /tmp/rbs_specdiff'
109   - system 'diff -u spec/diffs/base.txt /tmp/rbs_specdiff'
110   - system 'rm /tmp/rbs_specdiff'
111   - end
112   -
113   - desc 'Replace the base spec file with a new one'
114   - task :replace do
115   - system 'bin/specrunner spec > spec/diffs/base.txt'
  31 + if File.exists? archive
  32 + if changed.empty?
  33 + puts "No files to update."
  34 + else
  35 + system "zip -u #{archive} .load_order.txt #{changed.join(' ')}"
116 36 end
  37 + else
  38 + system "zip #{archive} .load_order.txt #{files.join(' ')}"
117 39 end
118   -end
119   -
120   -desc "Alias for test:all"
121   -task :test => 'test:all'
122   -
123   -namespace :test do
124   - desc "Run all tests."
125   - task :all do
126   - Rake::Task['test:core'].invoke rescue got_error = true
127   - Rake::Task['test:shotgun'].invoke rescue got_error = true
128   -
129   - raise "Test failures." if got_error
130   - end
131   -
132   - desc "Runs BFTS on Ruby 1.8.*."
133   - task :bfts do
134   - system("ruby -Inative -Ibfts/overlay bfts/overlay/tc_all.rb")
135   - end
136   -
137   - desc "Runs part of BFTS under Rubinius natively."
138   - task :nativebfts => ['test:setup:code_cache'] do
139   - system("ruby -Ibfts/overlay bfts/overlay/test_stuff.rb")
140   - end
141   -
142   - desc "Run rubinius's 1.8.* tests."
143   - task :core do
144   - system("ruby -Ilib test/tc_all.rb")
145   - end
146   -
147   - desc "Run shotgun's core tests."
148   - task :shotgun => ['test:setup:code_cache'] do
149   - system("ruby test/tc_all.rb shotgun-tests")
150   - end
151   -
152   - namespace :setup do
153   - desc "Prepare the code-cache directory"
154   - task :code_cache => 'spec:setup:code_cache'
155   - end
  40 +
  41 + Dir.chdir(curdir) if dir
156 42 end
157 43
158   -desc "Build the whole project"
159   -task :build => 'build:all'
  44 +desc "Completely rebuild everything"
  45 +task :rebuild => ['build:clean', 'build:shotgun', 'build:compiler', 'build:bootstrap', 'build:core', 'build:library']
160 46
161   -desc "Rebuild all parts and archives from scratch."
162   -task :rebuild => ['build:clean', 'build:delete_rbc', 'build:delete_rba', 'build:setup:syd',
163   - 'build:shotgun', 'build:bootstrap', 'build:core', 'build:library', 'build:compiler']
  47 +desc "Build shotgun (the C-code VM)"
  48 +task :build => ['build:shotgun']
164 49
165 50 namespace :build do
166 51
167   - desc "Build rubinius (shotgun)."
168   - task :all => ['build:clean', 'build:shotgun']
  52 + desc "Removes build by-products for shotgun, compiler, and library"
  53 + task :clean => ['clean:shotgun', 'clean:compiler', 'clean:bootstrap', 'clean:core', 'clean:library']
169 54
170   - desc "Cleanup build files."
171   - task :clean do
172   - FileUtils.rm_rf 'code-cache'
173   - FileUtils.rm Dir.glob('lib/kernel.rb*')
174   - sh "(find native -name '*.rbc' | xargs rm) || true"
175   - Dir.chdir('shotgun') do
176   - sh 'make -e clean || true'
  55 + namespace :clean do
  56 + desc "Removes build by-products for shotgun"
  57 + task :shotgun do
  58 + sh "make -e -C shotgun clean || true"
177 59 end
178   - end
179   -
180   - desc "Rebuild librubinius"
181   - task :relib do
182   - sh 'make -C shotgun/lib clean'
183   - sh 'make'
184   - end
185   -
186   - task :configure do
187   - system('./configure')
188   - raise 'Failed to configure shotgun components' if $?.exitstatus != 0
189   - end
190   -
191   - task :setup do
192   - sh "ruby bin/rcc"
193   - end
194   -
195   - namespace :setup do
196   - desc "Ensure that the correct version of the sydparse gem is installed."
197   - task :syd do
198   - require 'rubygems'
199   - begin
200   - gem 'sydparse', '>= 1.2.1'
201   - rescue Gem::LoadError
202   - puts "\nYour system does not have the required sysparse gem installed...\n"
203   - Rake::Task['syd'].invoke
204   - raise "Gem 'sydparse' must be installed from externals/syd-parser/pkg directory. Then re-run 'rake build'."
205   - end
206   - end
207   - end
208   -
209   - desc "Build the kernel/hints file that is used to generate auto.c and auto.h"
210   - task :fields => ['setup:syd'] do
211   - $:.unshift "lib"
212   - require 'types'
213   - hfd = File.open("kernel/hints", "w")
214   - # Process types in alphabetical order to avoid file modifications
215   - types = Rubinius::Types.keys.sort_by {|k| k.to_s}
216   - types.each do |name|
217   - mod = Rubinius::Types[name]
218   - next if mod::TotalFields.size == 0
219   - sname = mod.name.split("::").last
220   - hfd.puts sname
221   - mod::TotalFields.each do |fel|
222   - if fel == :instance_variables
223   - fel = :__ivars__
224   - end
225   - hfd.puts fel
  60 +
  61 + desc "Removes build by-products for compiler"
  62 + task :compiler do
  63 + FileList['native/**/*.rbc', '/tmp/*.rbc'].each do |fn|
  64 + FileUtils.rm fn rescue nil
226 65 end
227   - hfd.puts "!"
228 66 end
229   - hfd.close
230   - end
231   -
232   - desc "Build shotgun C components."
233   - task :shotgun => ['build:setup', 'spec:setup:code_cache', 'build:configure'] do
234   - system("make -e -C shotgun rubinius")
235   - raise 'Failed to build shotgun components' if $?.exitstatus != 0
236   - end
237   -
238   - desc "Install rubinius"
239   - task :install => 'build:shotgun' do
240   - system("#{ENV['SUDO']} make install")
241   - raise 'Failed to install rubinius' if $?.exitstatus != 0
242   - end
243   -
244   - #FileList['lib/types/*.rb'].each do |src|
245   - # file 'kernel/hints' => src
246   - #end
247 67
248   - file 'kernel/hints' do
249   - puts "Building hints and fields..."
250   - Rake::Task['build:fields'].invoke
251   - end
252   -
253   - def newer?(file, cmp)
254   - File.exists?(cmp) and File.mtime(cmp) >= File.mtime(file)
255   - end
256   -
257   - desc "Build the VM bootstrap archive."
258   - task :rcompile_bootstrap => 'kernel/hints' do
259   - Dir.chdir "kernel" do
260   - files = Dir["bootstrap/*.rb"].sort
261   -
262   - changed = []
263   - files.each do |file|
264   - cmp = "#{file}c"
265   - unless newer?(file, cmp) # File.exists?(cmp) and File.mtime(cmp) >= File.mtime(file)
266   - changed << cmp
267   - system "#{COMPILER} #{file}"
268   - raise "Failed to compile #{file}" if $?.exitstatus != 0
269   - end
270   - file << "c"
  68 + desc "Removes build by-products for library"
  69 + task :library do
  70 + FileList['library/**/*.rbc'].each do |fn|
  71 + FileUtils.rm fn rescue nil
271 72 end
  73 + end
272 74
273   - File.open(".load_order.txt","w") do |f|
274   - f.puts files.join("\n")
  75 + desc "Removes build by-products for bootstrap"
  76 + task :bootstrap do
  77 + FileList['kernel/bootstrap/**/*.rbc'].each do |fn|
  78 + FileUtils.rm fn rescue nil
275 79 end
276   -
277   - archive = "../runtime/bootstrap.rba"
  80 + end
278 81
279   - if File.exists? archive
280   - if changed.empty?
281   - puts "No kernel/bootstrap files to update."
282   - else
283   - system "zip -u #{archive} .load_order.txt #{changed.join(' ')}"
284   - end
285   - else
286   - system "zip #{archive} .load_order.txt #{files.join(' ')}"
  82 + desc "Removes build by-products for core"
  83 + task :core do
  84 + FileList['kernel/core/**/*.rbc'].each do |fn|
  85 + FileUtils.rm fn rescue nil
287 86 end
288 87 end
289 88 end
290 89
291   - def update_archive(files, archive, dir=nil, path_truc=false)
292   - archive = File.expand_path archive
293   -
294   - changed = []
295   - files.each do |file|
296   - cmp = "#{file}c"
297   - unless newer?(file, cmp)
298   - changed << cmp
299   - system "shotgun/rubinius compile #{file}"
300   - end
301   - file << "c"
302   - end
303   -
304   - curdir = Dir.getwd
305   - if dir
306   - Dir.chdir(dir)
307   - changed.map! { |f| f.gsub!(%r!^#{dir}/!, "") } if path_truc
308   - end
309   -
310   - File.open(".load_order.txt","w") do |f|
311   - f.puts files.join("\n")
312   - end
313   -
314   - if File.exists? archive
315   - if changed.empty?
316   - puts "No files to update."
317   - else
318   - system "zip -u #{archive} .load_order.txt #{changed.join(' ')}"
319   - end
320   - else
321   - system "zip #{archive} .load_order.txt #{files.join(' ')}"
322   - end
323   -
324   - Dir.chdir(curdir) if dir
  90 + task :configure do
  91 + sh "./configure"
  92 + raise 'Failed to configure Rubinius' unless $?.success?
325 93 end
326   -
327   - task :rba => [:bootstrap, :core, :compiler]
328 94
329   - desc "Build the VM bootstrap archive with rubinius."
330   - task :bootstrap do
331   - archive = ENV['OUTPUT'] || "runtime/bootstrap.rba"
332   - files = Dir["kernel/bootstrap/*.rb"].sort
333   - temp_bs = "runtime/bootstrap.rba.old"
334   - system "cp runtime/bootstrap.rba #{temp_bs}"
335   - ENV['BOOTSTRAP'] = temp_bs
336   - update_archive files, archive # , "kernel"
337   - system "rm #{temp_bs}"
  95 + desc "Compiles shotgun (the C-code VM)"
  96 + task :shotgun => :configure do
  97 + sh "make -e"
  98 + raise 'Failed to build shotgun' unless $?.success?
338 99 end
339   -
340   - desc "Build the core classes and methods archive."
341   - task :rcompile_core => 'kernel/hints' do
342   - files = nil
343   - Dir.chdir("kernel") do
344   - files = Dir["core/*.rb"].sort
345   - files.delete "core/__loader.rb"
346   -
347   - files << "core/__loader.rb"
348   -
349   - changed = []
350   - files.each do |file|
351   - cmp = "#{file}c"
352   - unless newer?(file, cmp) # File.exists?(cmp) and File.mtime(cmp) >= File.mtime(file)
353   - changed << cmp
354   - system "#{COMPILER} #{file}"
355   - raise "Failed to compile #{file}" if $?.exitstatus != 0
356   - end
357   - file << "c"
358   - end
359   -
360   - File.open(".load_order.txt","w") do |f|
361   - f.puts files.join("\n")
362   - end
363   -
364   - archive = "../runtime/core.rba"
365   -
366   - if File.exists? archive
367   - if changed.empty?
368   - puts "No kernel/core files to update."
369   - else
370   - system "zip -u #{archive} .load_order.txt #{changed.join(' ')}"
371   - end
372   - else
373   - system "zip #{archive} .load_order.txt #{files.join(' ')}"
374   - end
375   - end
  100 +
  101 + desc "Compiles the Rubinius bootstrap archive"
  102 + task :bootstrap do
  103 + files = Dir["kernel/bootstrap/*.rb"].sort
  104 + update_archive files, 'runtime/bootstrap.rba'
376 105 end
377 106
378   - desc "Build the core classes and methods archive."
  107 + desc "Compiles the Rubinius core archive"
379 108 task :core do
380   - files = nil
381 109 files = Dir["kernel/core/*.rb"].sort
382   - files.delete "kernel/core/__loader.rb"
383   -
  110 + files.delete("kernel/core/__loader.rb")
384 111 files << "kernel/core/__loader.rb"
385   -
386   - temp_bs = "runtime/core.rba.old"
387   - system "cp runtime/core.rba #{temp_bs}"
388   - ENV['CORE'] = temp_bs
389   -
390   - archive = ENV['OUTPUT'] || "runtime/core.rba"
391   -
392   - update_archive files, archive # , "kernel"
393   -
394   - system "rm #{temp_bs}"
  112 + update_archive files, 'runtime/core.rba'
395 113 end
396   -
397   - desc "Build the standard library."
  114 +
  115 + desc "Compiles the Rubinius library archive"
398 116 task :library do
399   - Dir.chdir('library') do
400   - files = Dir['**/*.rb']
401   - changed = []
402   - files.each do |file|
403   - cmp = "#{file}c"
404   - unless newer?(file, cmp)
405   - changed << cmp
406   - system "#{COMPILER} #{file}"
407   - raise "Failed to compile #{file}" if $?.exitstatus != 0
408   - end
409   - file << 'c'
410   - end
411   -
412   - archive = "../runtime/library.rba"
413   -
414   - if File.exists? archive
415   - if changed.empty?
416   - puts "No library files to update."
417   - else
418   - system "zip -u #{archive} #{changed.join(' ')}"
419   - end
420   - else
421   - system "zip #{archive} #{files.join(' ')}"
422   - end
423   - end
424   - end
425   -
426   - desc "Build syd-parser."
427   - task :syd do
428   - puts "Building externals/syd-parser gem...\n"
429   - Dir.chdir('externals/syd-parser')
430   - system("rake gem")
431   - raise 'Failed to build externals/syd-parser gem' if $?.exitstatus != 0
432   - puts "\nNow do 'gem install externals/syd-parser/pkg/*.gem' as your gem superuser.\n\n"
  117 + files = Dir["library/**/*.rb"].sort
  118 + update_archive files, 'runtime/library.rba'
433 119 end
434 120
435   - desc "Package up the compiler"
  121 + desc "Compiles the Rubinius compiler archive"
436 122 task :compiler do
437 123 files = %w! bytecode/compiler bytecode/assembler bytecode/encoder
438 124 sexp/simple_processor translation/normalize translation/local_scoping
@@ -455,223 +141,17 @@ namespace :build do
455 141
456 142 paths += %w!native/bytecode/rubinius.rb native/bytecode/system_hints.rb!
457 143
458   - update_archive paths, "runtime/compiler.rba", "native", true
459   - end
460   -
461   - desc "Builds shotgun, kernel, and bootstraps the compiler"
462   - task :rubinius => ['build:shotgun', 'build:bootstrap', 'build:core', 'build:library', 'build:compiler']
463   -
464   - desc "Delete all cached .rbc files"
465   - task :delete_rbc do
466   - FileList['**/*.rbc', '*.rbc', '/tmp/*.rbc'].each do |fn|
467   - FileUtils.rm fn rescue nil
468   - end
469   - end
470   -
471   - desc "Delete all compiled ruby archives"
472   - task :delete_rba do
473   - FileList['runtime/*.rba'].each do |fn|
474   - FileUtils.rm fn rescue nil
475   - end
  144 + update_archive paths, "runtime/compiler.rba", "native"
476 145 end
477 146 end
478 147
479   -namespace :rbx do
480   - desc "Clean build products and all compiled ruby files"
481   - task :clean => ['build:clean', 'build:delete_rbc', 'build:delete_rba']
482   -
483   - desc "Build all components that need it, but don't clean first"
484   - task :build do
485   - ::COMPILER = 'rbx -c'
486   - Rake::Task['build:all'].invoke
487   - end
488   -
489   - desc "Rebuilds everything after clean"
490   - task :rebuild => ['rbx:clean', 'rbx:build', 'build:bootstrap',
491   - 'build:core', 'build:library', 'build:compiler']
492   -
493   - task :install => ['rbx:build', 'build:install']
494   -end
495   -
496 148 desc "Remove runtime/*.rba then svn up"
497 149 task :svn => 'svn:up'
498 150 namespace :svn do
499   - desc "Remove runtime/*.rba then svn up"
  151 + desc "Revert runtime/*.rba then svn up"
500 152 task :up do
501   - FileList['runtime/*.rba'].each do |f|
502   - FileUtils.rm f
503   - end
  153 + sh "svn revert runtime/*.rba"
504 154 puts `svn up`
505   -
506   - end
507   -end
508   -
509   -task :report => 'report:all' # default
510   -namespace :report do
511   - desc "Build all reports"
512   - task :all => [:completeness, :rspec_errors]
513   -
514   - desc "Build completeness report"
515   - task :completeness do
516   - run_report(:completeness)
517   - end
518   -
519   - desc "Build rspec errors report"
520   - task :rspec_errors do
521   - run_report(:rspec_errors)
522   - end
523   -
524   - desc "Build self-hosting errors report"
525   - task :self_hosting_errors do
526   - run_report(:self_hosting_errors)
527   - end
528   -
529   - def run_report(name)
530   - report = "#{ROOT}/bin/reports/#{name}.rb"
531   - dest = "#{ROOT}/reports/#{name}.html"
532   - File.open("#{ROOT}/reports/#{name}.html", 'w') do |f|
533   - f.write `RUBYOPT='' ruby #{report}`
534   - end
535   - puts "ruby #{report} > #{dest}"
536 155 end
537 156 end
538 157
539   -desc "Run Ruby 1.9.x benchmark suite"
540   -task :bm do
541   - sh "rbx benchmark/run.rb"
542   -end
543   -desc "Run Ruby 1.9.x benchmark suite"
544   -task :benchmark => :bm
545   -
546   -namespace :doc do
547   - desc "Learn how to contribute."
548   - task :contrib => 'doc:contrib:easy'
549   -
550   - namespace :contrib do
551   - desc "Find out about easy ways to contribute."
552   - task :easy do
553   - puts <<-EOM
554   -
555   - The Rubinius team welcomes contributions, bug reports, test cases, and monetary support.
556   - One possible way to help is:
557   - 1. Visit the wiki at http://rubini.us
558   - 2. Read up on writing RSpec specs for Rubinius.
559   - 3. Read up on implementing the Ruby core library.
560   - 4. Check if a spec exists for the method you are adding.
561   - 5. Red, green, refactor.
562   - 6. Submit a nice diff to the mailing list: http://groups.google.com/group/rubinius-devel
563   - 7. When your patch is accepted, ask Evan for a commit bit.
564   -
565   - The 'ri' command is a rich source of examples and test cases.
566   -
567   - There are a lot of folks working, so pop into #rubinius channel on freenode and ask
568   - questions. Try to follow the conventions in the code and restrain impulses to go
569   - mad refactoring and reorganizing until you are well familiar with the code and have
570   - asked other's opinions. In the words of the venerable cabo: 'Primum non nocere'
571   -
572   - Thanks for helping to spread good will among all beings. Go on, start coding!
573   -
574   - EOM
575   - end
576   -
577   - desc "Find out about ways to contribute that may require a lot of knowledge or work."
578   - task :hard do
579   - puts "More to come. For now, just make everything work faster than anything else in the world."
580   - end
581   - end
582   -end
583   -
584   -namespace :svk do
585   - task :push do
586   - sh 'svk push --verbatim'
587   - end
588   -end
589   -
590   -# Deprecated rake tasks
591   -def deprecate(msg)
592   - puts "Deprecated. Please use #{msg}."
593   -end
594   -
595   -desc "DEPRECATED: Run shotgun's core tests"
596   -task :test_shotgun do
597   - deprecate 'test:shotgun'
598   - Rake::Task['test:shotgun'].invoke
599   -end
600   -
601   -desc "DEPRECATED: Run all the tests"
602   -task :test_all do
603   - deprecate 'test:all'
604   - Rake::Task['test:all'].invoke
605   -end
606   -
607   -# This forces ruby inline to build everything in the
608   -# right place.
609   -task :setup do
610   - deprecate 'build:setup'
611   - Rake::Task['build:setup'].invoke
612   -end
613   -
614   -desc "DEPRECATED: Build shotgun C components"
615   -task :shotgun do
616   - deprecate 'build:shotgun'
617   - Rake::Task['build:shotgun'].invoke
618   -end
619   -
620   -desc "DEPRECATED: Prepare the code-cache directory"
621   -task :code_cache do
622   - deprecate 'test:setup:code_cache'
623   - Rake::Task['test:setup:code_cache'].invoke
624   -end
625   -
626   -desc "DEPRECATED: Ensure that the correct version of the sydparse gem is installed."
627   -task :ensure_syd do
628   - deprecate 'build:setup:syd'
629   - Rake::Task['build:setup:syd'].invoke
630   -end
631   -
632   -desc "DEPRECATED: Build syd-parser."
633   -task :syd do
634   - deprecate 'build:syd'
635   - Rake::Task['build:syd'].invoke
636   -end
637   -
638   -task :fields do
639   - deprecate 'build:fields'
640   - Rake::Task['build:fields'].invoke
641   -end
642   -
643   -# Combine the separate .rb files in lib into a single kernel.rb
644   -task :kernel do
645   - deprecate 'build:setup:core'
646   - Rake::Task['build:core'].invoke
647   -end
648   -
649   -# Build the kernel
650   -task :bk do
651   - deprecate 'build:core'
652   - Rake::Task['build:core'].invoke
653   -end
654   -
655   -# Build rubinius vm (i.e. shotgun, kernel, compiler bootstrap)
656   -task :br do
657   - deprecate 'build:rubinius'
658   - Rake::Task['build:rubinius'].invoke
659   -end
660   -
661   -task :clean do
662   - deprecate 'build:clean'
663   - Rake::Task['build:clean'].invoke
664   -end
665   -
666   -task :push do
667   - deprecate 'svk:push'
668   - Rake::Task['svk:push'].invoke
669   -end
670   -
671   -desc "DEPRECATED: Alias for doc:contrib:easy."
672   -task :find_low_hanging_fruit do
673   - deprecate 'doc:contrib:easy'
674   - Rake::Task['doc:contrib:easy'].invoke
675   -end
676   -
677   -# vim: syntax=ruby shiftwidth=2
95 rake/legacy_tasks.rb
... ... @@ -0,0 +1,95 @@
  1 +namespace :legacy do
  2 + desc "Ensure that the correct version of the sydparse gem is installed."
  3 + task :check_syd do
  4 + require 'rubygems'
  5 + begin
  6 + gem 'sydparse', '>= 1.2.1'
  7 + rescue Gem::LoadError
  8 + puts "\nYour system does not have the required sysparse gem installed...\n"
  9 + Rake::Task['build_syd'].invoke
  10 + raise "Gem 'sydparse' must be installed from externals/syd-parser/pkg directory."
  11 + end
  12 + end
  13 +
  14 + desc "Build sydparse gem."
  15 + task :build_syd do
  16 + puts "Building externals/syd-parser gem...\n"
  17 + Dir.chdir('externals/syd-parser')
  18 + system("rake gem")
  19 + raise 'Failed to build externals/syd-parser gem' if $?.exitstatus != 0
  20 + puts "\nNow do 'gem install externals/syd-parser/pkg/*.gem' as your gem superuser.\n\n"
  21 + end
  22 +
  23 + desc "Build the VM bootstrap archive."
  24 + task :rcompile_bootstrap => :check_syd do
  25 + Dir.chdir "kernel" do
  26 + files = Dir["bootstrap/*.rb"].sort
  27 +
  28 + changed = []
  29 + files.each do |file|
  30 + cmp = "#{file}c"
  31 + unless newer?(file, cmp)
  32 + changed << cmp
  33 + system "#{COMPILER} #{file}"
  34 + raise "Failed to compile #{file}" if $?.exitstatus != 0
  35 + end
  36 + file << "c"
  37 + end
  38 +
  39 + File.open(".load_order.txt","w") do |f|
  40 + f.puts files.join("\n")
  41 + end
  42 +
  43 + archive = "../runtime/bootstrap.rba"
  44 +
  45 + if File.exists? archive
  46 + if changed.empty?
  47 + puts "No kernel/bootstrap files to update."
  48 + else
  49 + system "zip -u #{archive} .load_order.txt #{changed.join(' ')}"
  50 + end
  51 + else
  52 + system "zip #{archive} .load_order.txt #{files.join(' ')}"
  53 + end
  54 + end
  55 + end
  56 +
  57 + desc "Build the core classes and methods archive."
  58 + task :rcompile_core => :check_syd do
  59 + files = nil
  60 + Dir.chdir("kernel") do
  61 + files = Dir["core/*.rb"].sort
  62 + files.delete "core/__loader.rb"
  63 +
  64 + files << "core/__loader.rb"
  65 +
  66 + changed = []
  67 + files.each do |file|
  68 + cmp = "#{file}c"
  69 + unless newer?(file, cmp) # File.exists?(cmp) and File.mtime(cmp) >= File.mtime(file)
  70 + changed << cmp
  71 + system "#{COMPILER} #{file}"
  72 + raise "Failed to compile #{file}" if $?.exitstatus != 0
  73 + end
  74 + file << "c"
  75 + end
  76 +
  77 + File.open(".load_order.txt","w") do |f|
  78 + f.puts files.join("\n")
  79 + end
  80 +
  81 + archive = "../runtime/core.rba"
  82 +
  83 + if File.exists? archive
  84 + if changed.empty?
  85 + puts "No kernel/core files to update."
  86 + else
  87 + system "zip -u #{archive} .load_order.txt #{changed.join(' ')}"
  88 + end
  89 + else
  90 + system "zip #{archive} .load_order.txt #{files.join(' ')}"
  91 + end
  92 + end
  93 + end
  94 +end
  95 +
135 rake/rubinius_spec_tasks.rb
... ... @@ -0,0 +1,135 @@
  1 +begin
  2 + require 'spec/rake/spectask'
  3 +rescue LoadError
  4 + raise <<-EOM
  5 + Unable to load spec/rake/spectask. RSpec is a requirement to build Rubinius.
  6 + Please install RSpec before building (http://rspec.rubyforge.org).
  7 +EOM
  8 +end
  9 +
  10 +require File.join(File.dirname(__FILE__),'group_coverage_report')
  11 +require File.join(File.dirname(__FILE__),'group_spec_task')
  12 +require File.join(File.dirname(__FILE__),'specific_group_spec_task')
  13 +
  14 +ROOT = File.expand_path(File.join(File.dirname(__FILE__),'..'))
  15 +def from_root_dir
  16 + dir = Dir.pwd
  17 + Dir.chdir(ROOT)
  18 + yield
  19 + Dir.chdir(dir)
  20 +end
  21 +
  22 +namespace :spec do
  23 + desc "Run all specs and tests."
  24 + task :all do
  25 + Rake::Task['spec:only'].invoke rescue got_error = true
  26 + Rake::Task['test:all'].invoke rescue got_error = true
  27 +
  28 + raise "Spec or test failures." if got_error
  29 + end
  30 +
  31 + desc "Setup code-cache directory"
  32 + task :setup => 'setup:code_cache'
  33 +
  34 + namespace :setup do
  35 + desc "Setup code-cache directory"
  36 + task :code_cache do
  37 + from_root_dir do
  38 + Dir.mkdir "code-cache" unless File.exists?("code-cache")
  39 + FileUtils.rm Dir.glob("code-cache/*")
  40 + end
  41 + end
  42 +
  43 + task :subtend do
  44 + Dir[File.join(ROOT,"spec/subtend/**/Rakefile")].each do |rakefile|
  45 + sh "rake -f #{rakefile}"
  46 + end
  47 + end
  48 + end
  49 +
  50 + desc "Run only specs but not any tests."
  51 + spec_targets = %w(language shotgun library core targets primitives)
  52 +
  53 + # Convenience method to run a single spec test
  54 + spec_targets.each do |group|
  55 + spec_files = Dir[ File.join(ROOT,"spec/#{group}/*_spec.rb") ]
  56 + GroupSpecTask.new(group)
  57 + namespace group do
  58 + spec_files.each do |file|
  59 + SpecificGroupSpecTask.new(File.basename(file, '_spec.rb'), :core)
  60 + end
  61 + end
  62 + end
  63 +
  64 + task :only => spec_targets.collect! { |g| 'spec:' << g }
  65 +
  66 + # experimental -- need to adjust exclusions depending on what your testing
  67 + namespace :coverage do
  68 + desc "Generate a coverage report for the library specs."
  69 + GroupCoverageReport.new(:library)
  70 +
  71 + desc "Generate a coverage report for the core specs."
  72 + GroupCoverageReport.new(:core)
  73 + end
  74 +
  75 + # New runner
  76 + desc 'Run all specs'
  77 + task :new do
  78 + from_root_dir do
  79 + system 'bin/specrunner spec'
  80 + end
  81 + end
  82 +
  83 + # Specdiffs to make it easier to see what your changes have affected :)
  84 + desc 'Run specs and produce a diff against current base'
  85 + task :diff => 'diff:run'
  86 +
  87 + namespace :diff do
  88 + desc 'Run specs and produce a diff against current base'
  89 + task :run do
  90 + from_root_dir do
  91 + system 'bin/specrunner spec > /tmp/rbs_specdiff'
  92 + system 'diff -u spec/diffs/base.txt /tmp/rbs_specdiff'
  93 + system 'rm /tmp/rbs_specdiff'
  94 + end
  95 + end
  96 +
  97 + desc 'Replace the base spec file with a new one'
  98 + task :replace do
  99 + from_root_dir do
  100 + system 'bin/specrunner spec > spec/diffs/base.txt'
  101 + end
  102 + end
  103 + end
  104 +end
  105 +
  106 +task :report => 'report:all' # default
  107 +namespace :report do
  108 + desc "Build all reports"
  109 + task :all => [:completeness, :rspec_errors]
  110 +
  111 + desc "Build completeness report"
  112 + task :completeness do
  113 + run_report(:completeness)
  114 + end
  115 +
  116 + desc "Build rspec errors report"
  117 + task :rspec_errors do
  118 + run_report(:rspec_errors)
  119 + end
  120 +
  121 + desc "Build self-hosting errors report"
  122 + task :self_hosting_errors do
  123 + run_report(:self_hosting_errors)
  124 + end
  125 +
  126 + def run_report(name)
  127 + report = "#{ROOT}/bin/reports/#{name}.rb"
  128 + dest = "#{ROOT}/reports/#{name}.html"
  129 + File.open("#{ROOT}/reports/#{name}.html", 'w') do |f|
  130 + f.write `RUBYOPT='' ruby #{report}`
  131 + end
  132 + puts "ruby #{report} > #{dest}"
  133 + end
  134 +end
  135 +

0 comments on commit dc16b49

Please sign in to comment.
Something went wrong with that request. Please try again.