update builder messages - close #77

This commit is contained in:
josh committed 2019-02-18 22:30:11 -05:00
1 parent 658b73e4de
commit 983862a528
20 files changed
+140 -101

No files matched your search

+14 -1
View File
@@ -119,6 +119,19 @@ module Rscons
raise "This method must be overridden in a subclass"
end
# Print the builder run message, depending on the Environment's echo mode.
#
# @param short_description [String]
# Builder short description, printed if the echo mode is :short, or if
# there is no command.
# @param command [Array<String>]
# Builder command, printed if the echo mode is :command.
#
# @return [void]
def print_run_message(short_description, command)
@env.print_builder_run_message(self, short_description, command)
end
# Create a {Command} object to execute the build command in a thread.
#
# @param short_description [String]
@@ -138,7 +151,7 @@ module Rscons
if options[:stdout]
command_options[:system_options] = {out: options[:stdout]}
end
@env.print_builder_run_message(short_description, @command)
print_run_message(short_description, @command)
wait_for(Command.new(command, self, command_options))
end
+11 -10
View File
@@ -26,17 +26,18 @@ module Rscons
else
@vars["_TARGET"] = @target
@vars["_SOURCES"] = @sources
cmd =
case
when @sources.first.end_with?(*@env.expand_varref("${LEXSUFFIX}"))
"LEX"
when @sources.first.end_with?(*@env.expand_varref("${YACCSUFFIX}"))
"YACC"
else
raise "Unknown source file #{@sources.first.inspect} for CFile builder"
end
case
when @sources.first.end_with?(*@env.expand_varref("${LEXSUFFIX}"))
cmd = "LEX"
message = "Generating lexer"
when @sources.first.end_with?(*@env.expand_varref("${YACCSUFFIX}"))
cmd = "YACC"
message = "Generating parser"
else
raise "Unknown source file #{@sources.first.inspect} for CFile builder"
end
command = @env.build_command("${#{cmd}_CMD}", @vars)
standard_command("#{cmd} #{@target}", command)
standard_command("#{message} from #{Util.short_format_paths(@sources)} => #{@target}", command)
end
end
+1 -1
View File
@@ -23,7 +23,7 @@ module Rscons
if @vars["CMD_STDOUT"]
options[:stdout] = @env.expand_varref("${CMD_STDOUT}", @vars)
end
standard_command("#{cmd_desc} #{@target}", command, options)
standard_command("#{cmd_desc} => #{@target}", command, options)
end
end
+1 -1
View File
@@ -11,7 +11,7 @@ module Rscons
Ansi.write($stderr, :red, "Error: `#{@target}' already exists and is not a directory", :reset, "\n")
false
else
@env.print_builder_run_message("Directory #{@target}", nil)
print_run_message("Creating directory => #{@target}", nil)
@cache.mkdir_p(@target)
true
end
+1 -1
View File
@@ -16,7 +16,7 @@ module Rscons
else
@vars["_SOURCES"] = @sources
command = @env.build_command("${DISASM_CMD}", @vars)
standard_command("Disassemble #{target}", command, stdout: @target)
standard_command("Disassembling #{Util.short_format_paths(@sources)} => #{target}", command, stdout: @target)
end
end
+2 -1
View File
@@ -34,7 +34,8 @@ module Rscons
# Check the cache and copy if necessary
unless @cache.up_to_date?(dest, :Copy, [src], @env)
unless printed_message
@env.print_builder_run_message("#{name} #{@target}", nil)
message = "#{name} #{Util.short_format_paths(@sources)} => #{@target}"
print_run_message(message, nil)
printed_message = true
end
@cache.mkdir_p(File.dirname(dest))
+1 -1
View File
@@ -27,7 +27,7 @@ module Rscons
@vars["_TARGET"] = @target
@vars["_SOURCES"] = @objects
command = @env.build_command("${ARCMD}", @vars)
standard_command("AR #{@target}", command, sources: @objects)
standard_command("Building static library archive => #{@target}", command, sources: @objects)
end
end
+3 -1
View File
@@ -95,7 +95,9 @@ module Rscons
end.first
command = @env.build_command("${#{com_prefix}CMD}", @vars)
@env.produces(@target, @vars["_DEPFILE"])
standard_command("#{com_prefix} #{@target}", command)
verb = com_prefix == "AS" ? "Assembling" : "Compiling"
message = "#{verb} #{Util.short_format_paths(@sources)}"
standard_command(message, command)
end
end
+1 -1
View File
@@ -35,7 +35,7 @@ module Rscons
@vars["_DEPFILE"] = Rscons.set_suffix(target, env.expand_varref("${DEPFILESUFFIX}", vars))
command = @env.build_command("${CPP_CMD}", @vars)
@env.produces(@target, @vars["_DEPFILE"])
standard_command("#{name} #{@target}", command)
standard_command("Preprocessing #{Util.short_format_paths(@sources)} => #{@target}", command)
end
end
+1 -1
View File
@@ -59,7 +59,7 @@ module Rscons
@vars["_SOURCES"] = @objects
@vars["LD"] = ld
command = @env.build_command("${LDCMD}", @vars)
standard_command("LD #{@target}", command, sources: @objects)
standard_command("Linking => #{@target}", command, sources: @objects)
end
end
+1 -1
View File
@@ -60,7 +60,7 @@ module Rscons
@vars["_SOURCES"] = @objects
@vars["SHLD"] = ld
command = @env.build_command("${SHLDCMD}", @vars)
standard_command("SHLD #{@target}", command, sources: @objects)
standard_command("Linking => #{@target}", command, sources: @objects)
end
end
+3 -1
View File
@@ -80,7 +80,9 @@ module Rscons
end.first
command = @env.build_command("${#{com_prefix}CMD}", @vars)
@env.produces(@target, @vars["_DEPFILE"])
standard_command("#{com_prefix} #{@target}", command)
verb = com_prefix == "AS" ? "Assembling" : "Compiling"
message = "#{verb} #{Util.short_format_paths(@sources)}"
standard_command(message, command)
end
end
+5 -2
View File
@@ -512,13 +512,16 @@ module Rscons
# Print the builder run message, depending on the Environment's echo mode.
#
# @param builder [Builder]
# The {Builder} that is executing.
# @param short_description [String]
# Builder short description, printed if the echo mode is :short.
# Builder short description, printed if the echo mode is :short, or if
# there is no command.
# @param command [Array<String>]
# Builder command, printed if the echo mode is :command.
#
# @return [void]
def print_builder_run_message(short_description, command)
def print_builder_run_message(builder, short_description, command)
case @echo
when :command
if command.is_a?(Array)
+17
View File
@@ -26,6 +26,23 @@ module Rscons
command.map { |c| c =~ /\s/ ? "'#{c}'" : c }.join(' ')
end
# Return a string showing the path specified, or if more than one, then
# the first path with a "(+D)" afterward, where D is the number of
# remaining paths.
#
# @param paths [Array<String>]
# Paths.
#
# @return [String]
# Condensed path readout.
def short_format_paths(paths)
if paths.size == 1
paths.first
else
"#{paths.first} (#{paths.size - 1})"
end
end
# Look for an executable.
#
# @return [String, nil]