Skip to content

Commit e199a1b

Browse files
committed
update Rakefile with modified mruby-cli itself
1 parent 247e062 commit e199a1b

1 file changed

Lines changed: 27 additions & 21 deletions

File tree

Rakefile

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ mruby_config=File.expand_path(ENV["MRUBY_CONFIG"] || "build_config.rb")
1616
ENV['MRUBY_ROOT'] = mruby_root
1717
ENV['MRUBY_CONFIG'] = mruby_config
1818
Rake::Task[:mruby].invoke unless Dir.exist?(mruby_root)
19-
Dir.chdir(mruby_root)
2019
load "#{mruby_root}/Rakefile"
2120

2221
load File.join(File.expand_path(File.dirname(__FILE__)), "mrbgem.rake")
@@ -25,27 +24,31 @@ current_gem = MRuby::Gem.current
2524
app_version = MRuby::Gem.current.version
2625
APP_VERSION = (app_version.nil? || app_version.empty?) ? "unknown" : app_version
2726

28-
desc "compile all the binaries"
27+
desc "compile binary"
2928
task :compile => [:all] do
30-
MRuby.each_target do |target|
31-
`#{target.cc.command} --version`
32-
abort("Command #{target.cc.command} for #{target.name} is missing.") unless $?.success?
33-
end
34-
%W(#{mruby_root}/build/x86_64-pc-linux-gnu/bin/#{APP_NAME} #{mruby_root}/build/i686-pc-linux-gnu/#{APP_NAME}").each do |bin|
35-
sh "strip --strip-unneeded #{bin}" if File.exist?(bin)
29+
Dir.chdir(mruby_root) do
30+
MRuby.each_target do |target|
31+
`#{target.cc.command} --version`
32+
abort("Command #{target.cc.command} for #{target.name} is missing.") unless $?.success?
33+
end
34+
%W(#{mruby_root}/build/x86_64-pc-linux-gnu/bin/#{APP_NAME} #{mruby_root}/build/i686-pc-linux-gnu/#{APP_NAME}).each do |bin|
35+
sh "strip --strip-unneeded #{bin}" if File.exist?(bin)
36+
end
3637
end
3738
end
3839

3940
namespace :test do
4041
desc "run mruby & unit tests"
4142
# only build mtest for host
4243
task :mtest => :compile do
43-
# in order to get mruby/test/t/synatx.rb __FILE__ to pass,
44-
# we need to make sure the tests are built relative from mruby_root
45-
MRuby.each_target do |target|
46-
# only run unit tests here
47-
target.enable_bintest = false
48-
run_test if target.test_enabled?
44+
Dir.chdir(mruby_root) do
45+
# in order to get mruby/test/t/synatx.rb __FILE__ to pass,
46+
# we need to make sure the tests are built relative from mruby_root
47+
MRuby.each_target do |target|
48+
# only run unit tests here
49+
target.enable_bintest = false
50+
run_test if target.test_enabled?
51+
end
4952
end
5053
end
5154

@@ -63,21 +66,25 @@ namespace :test do
6366

6467
desc "run integration tests"
6568
task :bintest => :compile do
66-
MRuby.each_target do |target|
67-
clean_env(%w(MRUBY_ROOT MRUBY_CONFIG)) do
68-
run_bintest if target.bintest_enabled?
69+
Dir.chdir(mruby_root) do
70+
MRuby.each_target do |target|
71+
clean_env(%w(MRUBY_ROOT MRUBY_CONFIG)) do
72+
run_bintest if target.bintest_enabled?
73+
end
6974
end
7075
end
7176
end
7277
end
7378

7479
desc "run all tests"
7580
Rake::Task['test'].clear
76-
task :test => ['test:bintest', 'test:mtest']
81+
task :test => ["test:mtest", "test:bintest"]
7782

7883
desc "cleanup"
7984
task :clean do
80-
sh "rake deep_clean"
85+
Dir.chdir(mruby_root) do
86+
sh "rake deep_clean"
87+
end
8188
end
8289

8390
desc "generate a release tarball"
@@ -133,8 +140,7 @@ Rake.application.tasks.each do |task|
133140
old_task = Rake.application.instance_variable_get('@tasks').delete(task.name)
134141
desc old_task.full_comment
135142
task old_task.name => old_task.prerequisites do
136-
abort("Not running in docker, you should type \"docker-compose run <task>\".") \
137-
unless is_in_a_docker_container?
143+
abort("Not running in docker, you should type \"docker-compose run <task>\".") unless is_in_a_docker_container?
138144
old_task.invoke
139145
end
140146
end

0 commit comments

Comments
 (0)