Permalink
Newer
Older
100644 171 lines (137 sloc) 4.33 KB
1
# NOTE! When updating this file, also update INSTALL, if necessary.
2
# NOTE! Please keep your tasks grouped together.
4
if ENV["RUBYLIB"]
5
STDERR.puts "ERROR: Please unset RUBYLIB to build Rubinius"
6
exit 1
7
end
8
9
$trace ||= false
10
$VERBOSE = true
11
$verbose = Rake.application.options.trace || ARGV.delete("-v")
12
Evan Phoenix
Apr 20, 2009
13
if !$verbose and respond_to?(:verbose)
14
verbose(false) if verbose() == :default
15
end
16
17
$:.unshift File.expand_path("../", __FILE__)
18
19
config_rb = File.expand_path "../config.rb", __FILE__
20
config_h = File.expand_path "../vm/gen/config.h", __FILE__
21
22
unless File.exists?(config_rb) and File.exists?(config_h)
23
STDERR.puts "Please run ./configure first"
24
exit 1
25
end
26
27
require config_rb
28
BUILD_CONFIG = Rubinius::BUILD_CONFIG
30
unless BUILD_CONFIG[:config_version] == 21
31
STDERR.puts "Your configuration is outdated, please run ./configure first"
32
exit 1
33
end
34
35
# Yes, this is duplicated from the configure script for now.
36
unless BUILD_CONFIG[:which_ruby] == :ruby or BUILD_CONFIG[:which_ruby] == :rbx
37
STDERR.puts "Sorry, building Rubinius requires MRI or Rubinius"
41
bin = RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"]
42
bin << (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')
43
build_ruby = File.join(RbConfig::CONFIG['bindir'], bin)
44
45
unless BUILD_CONFIG[:build_ruby] == build_ruby
46
STDERR.puts "Sorry, but you need to build with the same Ruby version it was configured with"
47
STDERR.puts "Please run ./configure again"
48
exit 1
49
end
50
51
# Set the build compiler to the configured compiler unless
52
# the compiler is set via CC environment variable.
53
ENV['CC'] = BUILD_CONFIG[:compiler] unless ENV['CC']
54
ENV['CXX'] = BUILD_CONFIG[:compiler] unless ENV['CXX']
55
56
$dlext = RbConfig::CONFIG["DLEXT"]
58
def run_specs(flags=nil)
59
unless File.directory? BUILD_CONFIG[:runtime]
60
# Setting these enables the specs to run when rbx has been configured
61
# to be installed, but rake install has not been run yet.
62
ENV["RBX_RUNTIME"] = File.expand_path "../runtime", __FILE__
63
ENV["RBX_LIB"] = File.expand_path "../lib", __FILE__
64
ENV["CFLAGS"] = "-Ivm/capi"
65
end
66
67
sh "bin/mspec ci #{ENV['CI_MODE_FLAG'] || flags} --background --agent"
68
end
69
70
task :default => %w[build vm:test] do
71
run_specs
74
# See vm.rake for more information
75
desc "Build everything that needs to be built at default level."
76
task :build => ["build:normal", "gem_bootstrap"]
78
desc "Recompile all ruby system files"
79
task :rebuild => %w[clean build]
81
def run_ci
Evan Phoenix
Jan 1, 2010
82
unless system("rake -q")
83
puts "<< ERROR IN CI, CLEANING AND RERUNNING >>"
84
system "rake -q clean"
85
system "find . -name *.rbc -delete"
86
sh "rake -q"
87
end
88
end
89
90
desc "Run CI in default (configured) mode"
91
task :ci do
92
run_ci
93
end
94
95
# These tasks run the specs in the specified mode regardless of
96
# the default mode with which Rubinius was configured.
97
desc "Run CI in 1.8 mode"
98
task :ci18 do
99
ENV['CI_MODE_FLAG'] = "-T -X19=no"
100
run_ci
101
end
102
103
desc "Run CI in 1.9 mode"
104
task :ci19 do
105
ENV['CI_MODE_FLAG'] = "-T -X19"
106
run_ci
107
end
108
109
desc 'Remove rubinius build files'
110
task :clean => %w[
111
vm:clean
112
kernel:clean
113
clean:crap
114
extensions:clean
117
desc 'Remove rubinius build files and external library build files'
118
task :distclean => %w[
119
clean
120
vm:distclean
121
]
123
namespace :clean do
124
desc "Cleans up editor files and other misc crap"
125
task :crap do
126
files = (Dir["*~"] + Dir["**/*~"]).uniq
128
rm_f files, :verbose => $verbose unless files.empty?
129
end
130
end
132
desc 'Move the preinstalled gem setup into place'
133
task :gem_bootstrap do
134
unless File.directory?("gems/rubinius")
135
sh "mkdir -p gems/rubinius"
136
sh "cp -r preinstalled-gems/bin gems/bin"
137
sh "cp -r preinstalled-gems/data gems/rubinius/preinstalled"
138
end
139
end
140
141
desc "Run the Rubinius documentation website"
142
task :docs do
143
require 'kernel/delta/options'
144
require 'rbconfig'
145
require 'webrick'
146
require 'lib/rubinius/documentation'
147
148
Rubinius::Documentation.main
149
end
150
151
desc "Run the CI specs in 1.8 mode but do not rebuild on failure"
152
task :spec18 do
153
run_specs "-T -X19=no"
154
end
156
desc "Run the CI specs in 1.9 mode but do not rebuild on failure"
157
task :spec19 do
158
run_specs "-T -X19"
159
end
161
desc "Run CI in default (configured) mode but do not rebuild on failure"
162
task :spec do
163
run_specs
165
166
desc "Print list of items marked to-do in kernel/ (@todo|TODO)"
167
task :todos do
168
sh "grep", "-Rn", "@todo", "kernel"
169
sh "grep", "-Rn", "TODO", "kernel"
170
end