Skip to content

Commit

Permalink
Use Rake.verbose instead of $verbose and $pp_show in build scripts
Browse files Browse the repository at this point in the history
The incompatibility that the commands of `FileUtils` origin output verbose
by default due to the changes in d8a5163 and 26e6e75 is also fixed.
  • Loading branch information
shuujii committed Dec 28, 2019
1 parent d2f34a8 commit bb98fd7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MRUBY_ROOT = File.dirname(File.expand_path(__FILE__))
MRUBY_BUILD_HOST_IS_CYGWIN = RUBY_PLATFORM.include?('cygwin')
MRUBY_BUILD_HOST_IS_OPENBSD = RUBY_PLATFORM.include?('openbsd')

$verbose = Rake.verbose == true
Rake.verbose(false) if Rake.verbose == Rake::DSL::DEFAULT

$LOAD_PATH << File.join(MRUBY_ROOT, "lib")

Expand Down
21 changes: 1 addition & 20 deletions lib/mruby-core-ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,8 @@ def relative_path
end
end

$pp_show = true

if $verbose.nil?
if Rake.respond_to?(:verbose) && !Rake.verbose.nil?
if Rake.verbose.class == TrueClass
# verbose message logging
$pp_show = false
else
$pp_show = true
Rake.verbose(false)
end
else
# could not identify rake version
$pp_show = false
end
else
$pp_show = false if $verbose
end

def _pp(cmd, src, tgt=nil, options={})
return unless $pp_show
return if Rake.verbose

width = 5
template = options[:indent] ? "%#{width*options[:indent]}s %s %s" : "%-#{width}s %s %s"
Expand Down
4 changes: 2 additions & 2 deletions lib/mruby/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def build_mrbtest_lib_only?
end

def verbose_flag
$verbose ? ' -v' : ''
Rake.verbose ? ' -v' : ''
end

def run_test
Expand Down Expand Up @@ -386,7 +386,7 @@ def mrbcfile
end

def run_test
@test_runner.runner_options << ' -v' if $verbose
@test_runner.runner_options << verbose_flag
mrbtest = exefile("#{build_dir}/bin/mrbtest")
if (@test_runner.command == nil)
puts "You should run #{mrbtest} on target device."
Expand Down
2 changes: 1 addition & 1 deletion lib/mruby/build/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def run(out, infiles, funcname)
_pp "MRBC", f.relative_path, nil, :indent => 2
end
cmd = "#{filename @command} #{@compile_options % {:funcname => funcname}} #{filename(infiles).join(' ')}"
print("#{cmd}\n") if $verbose
puts cmd if Rake.verbose
IO.popen(cmd, 'r+') do |io|
out.puts io.read
end
Expand Down

0 comments on commit bb98fd7

Please sign in to comment.