summaryrefslogtreecommitdiffhomepage
path: root/tasks/mrbgems.rake
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2021-01-08 20:32:08 +0900
committerKOBAYASHI Shuji <[email protected]>2021-01-08 20:36:54 +0900
commit3a8d7bdf82dddb8d5e54330503d9ed11b4f68ad0 (patch)
treee5c1e9c5f62a9bd4e495593c59b0d035a1d193ff /tasks/mrbgems.rake
parent04561cd999431264e10bb96915a26049cff29d92 (diff)
downloadmruby-3a8d7bdf82dddb8d5e54330503d9ed11b4f68ad0.tar.gz
mruby-3a8d7bdf82dddb8d5e54330503d9ed11b4f68ad0.zip
Delay test code build until `rake test`
With this change, the test code will not be built unless `rake test` is run, so there will be almost no side effects even if `enable_test` is always set (but, gems specified by `add_test_dependency` are included in `libmruby.a`). Also added are `test: build` task, which only builds the test code (including the main code), and `test: run` task, which only runs tests independent of build. Therefore, the idiom for building in parallel and not running tests in parallel is `rake -m test:build && rake test:run`.
Diffstat (limited to 'tasks/mrbgems.rake')
-rw-r--r--tasks/mrbgems.rake20
1 files changed, 11 insertions, 9 deletions
diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake
index 0a3ae652d..ad98f7356 100644
--- a/tasks/mrbgems.rake
+++ b/tasks/mrbgems.rake
@@ -1,11 +1,12 @@
MRuby.each_target do
+ active_gems_txt = "#{build_dir}/mrbgems/active_gems.txt"
+
if enable_gems?
# set up all gems
gems.each(&:setup)
gems.check self
# loader all gems
- active_gems_txt = "#{build_dir}/mrbgems/active_gems.txt"
self.libmruby_objs << objfile("#{build_dir}/mrbgems/gem_init")
file objfile("#{build_dir}/mrbgems/gem_init") => ["#{build_dir}/mrbgems/gem_init.c", "#{build_dir}/LEGAL"]
file "#{build_dir}/mrbgems/gem_init.c" => [active_gems_txt, MRUBY_CONFIG, __FILE__] do |t|
@@ -50,14 +51,15 @@ MRuby.each_target do
f.puts %Q[}]
end
end
- file active_gems_txt => :generate_active_gems_txt
- task :generate_active_gems_txt do |t|
- def t.timestamp; Time.at(0) end
- active_gems = gems.sort_by(&:name).inject(""){|s, g| s << "#{g.name}\n"}
- if !File.exist?(active_gems_txt) || File.read(active_gems_txt) != active_gems
- mkdir_p File.dirname(active_gems_txt)
- File.write(active_gems_txt, active_gems)
- end
+ end
+
+ file active_gems_txt => :generate_active_gems_txt
+ task :generate_active_gems_txt do |t|
+ def t.timestamp; Time.at(0) end
+ active_gems = gems.sort_by(&:name).inject(""){|s, g| s << "#{g.name}\n"}
+ if !File.exist?(active_gems_txt) || File.read(active_gems_txt) != active_gems
+ mkdir_p File.dirname(active_gems_txt)
+ File.write(active_gems_txt, active_gems)
end
end