Skip to content

Commit

Permalink
Add a rake task to precompile anything the compiler/parser needs
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilson Bilkovich committed Sep 18, 2008
1 parent 2edcd15 commit 7fccab8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,23 @@ desc "Build everything that needs to be built"
task :build => %w[
vm
kernel:build
build:compiler
]
# build:rbc
# compiler
# lib/etc.rb
# lib/rbconfig.rb
# extensions

namespace :build do

task :compiler do
files = Dir["lib/compiler/**/*.rb"]
files.concat %w(lib/strscan.rb lib/stringio.rb lib/racc/parser.rb)
files.each do |path|
compile_ruby path, "#{path}c", true
end
end

# task :setup_rbc => :stable_compiler

# task :rbc => ([:setup_rbc] + AllPreCompiled)
Expand Down
6 changes: 5 additions & 1 deletion rakelib/kernel.rake
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def create_load_order(files, output=".load_order.txt")
end
end

def compile_ruby(src, rbc)
def compile_ruby(src, rbc, check_mtime = false)
if check_mtime and File.readable?(rbc)
return if File.mtime(rbc) >= File.mtime(src)
end

dir = File.dirname rbc
FileUtils.mkdir_p dir unless File.directory? dir

Expand Down

0 comments on commit 7fccab8

Please sign in to comment.