From 983862a52804496e06088ab0eeafa793cd3769df Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 18 Feb 2019 22:30:11 -0500 Subject: [PATCH] update builder messages - close #77 --- build_tests/custom_builder/wait_for_thread.rb | 2 +- build_tests/simple/absolute_source_path.rb | 2 +- .../simple/builder_wait_for_builder.rb | 2 +- build_tests/simple/cache_varset.rb | 2 +- build_tests/typical/echo_command_string.rb | 2 +- lib/rscons/builder.rb | 15 +- lib/rscons/builders/cfile.rb | 21 +-- lib/rscons/builders/command.rb | 2 +- lib/rscons/builders/directory.rb | 2 +- lib/rscons/builders/disassemble.rb | 2 +- lib/rscons/builders/install.rb | 3 +- lib/rscons/builders/library.rb | 2 +- lib/rscons/builders/object.rb | 4 +- lib/rscons/builders/preprocess.rb | 2 +- lib/rscons/builders/program.rb | 2 +- lib/rscons/builders/shared_library.rb | 2 +- lib/rscons/builders/shared_object.rb | 4 +- lib/rscons/environment.rb | 7 +- lib/rscons/util.rb | 17 ++ spec/build_tests_spec.rb | 146 +++++++++--------- 20 files changed, 140 insertions(+), 101 deletions(-) diff --git a/build_tests/custom_builder/wait_for_thread.rb b/build_tests/custom_builder/wait_for_thread.rb index e63fc20..ffb422f 100644 --- a/build_tests/custom_builder/wait_for_thread.rb +++ b/build_tests/custom_builder/wait_for_thread.rb @@ -3,7 +3,7 @@ class MyBuilder < Rscons::Builder if @thread true else - @env.print_builder_run_message("#{name} #{target}", nil) + print_run_message("#{name} #{target}", nil) @thread = Thread.new do sleep 2 FileUtils.touch(@target) diff --git a/build_tests/simple/absolute_source_path.rb b/build_tests/simple/absolute_source_path.rb index 1e4743d..3358796 100644 --- a/build_tests/simple/absolute_source_path.rb +++ b/build_tests/simple/absolute_source_path.rb @@ -1,5 +1,5 @@ build do - Environment.new do |env| + Environment.new(echo: :command) do |env| tempdir = ENV["TEMP"] || ENV["TMP"] || "/tmp" source_file = File.join(tempdir, "abs.c") File.open(source_file, "w") do |fh| diff --git a/build_tests/simple/builder_wait_for_builder.rb b/build_tests/simple/builder_wait_for_builder.rb index 911e98e..5266987 100644 --- a/build_tests/simple/builder_wait_for_builder.rb +++ b/build_tests/simple/builder_wait_for_builder.rb @@ -7,7 +7,7 @@ class MyObject < Rscons::Builder false end else - @env.print_builder_run_message("#{name} #{@target}", nil) + print_run_message("#{name} #{@target}", nil) @builder = @env.Object(@target, @sources, @vars) wait_for(@builder) end diff --git a/build_tests/simple/cache_varset.rb b/build_tests/simple/cache_varset.rb index 29fb33a..5a4bde9 100644 --- a/build_tests/simple/cache_varset.rb +++ b/build_tests/simple/cache_varset.rb @@ -6,7 +6,7 @@ class TestBuilder < Rscons::Builder fh.puts("hi") end msg = "#{name} #{@target}" - @env.print_builder_run_message(msg, msg) + print_run_message(msg, msg) @cache.register_build(@target, command, @sources, @env) end true diff --git a/build_tests/typical/echo_command_string.rb b/build_tests/typical/echo_command_string.rb index a5ed4ca..016f203 100644 --- a/build_tests/typical/echo_command_string.rb +++ b/build_tests/typical/echo_command_string.rb @@ -1,6 +1,6 @@ class MyBuilder < Rscons::Builder def run(options) - @env.print_builder_run_message("MyBuilder #{@target}", "MyBuilder #{@target} command") + print_run_message("MyBuilder #{@target}", "MyBuilder #{@target} command") true end end diff --git a/lib/rscons/builder.rb b/lib/rscons/builder.rb index aa96ce6..7ea4ea1 100644 --- a/lib/rscons/builder.rb +++ b/lib/rscons/builder.rb @@ -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] + # 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 diff --git a/lib/rscons/builders/cfile.rb b/lib/rscons/builders/cfile.rb index 539a9cf..616bd30 100644 --- a/lib/rscons/builders/cfile.rb +++ b/lib/rscons/builders/cfile.rb @@ -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 diff --git a/lib/rscons/builders/command.rb b/lib/rscons/builders/command.rb index 6bdcc58..612a8f1 100644 --- a/lib/rscons/builders/command.rb +++ b/lib/rscons/builders/command.rb @@ -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 diff --git a/lib/rscons/builders/directory.rb b/lib/rscons/builders/directory.rb index 65e4196..13c71e1 100644 --- a/lib/rscons/builders/directory.rb +++ b/lib/rscons/builders/directory.rb @@ -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 diff --git a/lib/rscons/builders/disassemble.rb b/lib/rscons/builders/disassemble.rb index bdfd0f0..435708a 100644 --- a/lib/rscons/builders/disassemble.rb +++ b/lib/rscons/builders/disassemble.rb @@ -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 diff --git a/lib/rscons/builders/install.rb b/lib/rscons/builders/install.rb index 1800460..34881f6 100644 --- a/lib/rscons/builders/install.rb +++ b/lib/rscons/builders/install.rb @@ -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)) diff --git a/lib/rscons/builders/library.rb b/lib/rscons/builders/library.rb index e36739f..01ce15a 100644 --- a/lib/rscons/builders/library.rb +++ b/lib/rscons/builders/library.rb @@ -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 diff --git a/lib/rscons/builders/object.rb b/lib/rscons/builders/object.rb index 9ebbab2..70a79ae 100644 --- a/lib/rscons/builders/object.rb +++ b/lib/rscons/builders/object.rb @@ -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 diff --git a/lib/rscons/builders/preprocess.rb b/lib/rscons/builders/preprocess.rb index a2db59a..0ef3c34 100644 --- a/lib/rscons/builders/preprocess.rb +++ b/lib/rscons/builders/preprocess.rb @@ -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 diff --git a/lib/rscons/builders/program.rb b/lib/rscons/builders/program.rb index d92b9c1..2cefb4d 100644 --- a/lib/rscons/builders/program.rb +++ b/lib/rscons/builders/program.rb @@ -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 diff --git a/lib/rscons/builders/shared_library.rb b/lib/rscons/builders/shared_library.rb index ca13f82..9131f66 100644 --- a/lib/rscons/builders/shared_library.rb +++ b/lib/rscons/builders/shared_library.rb @@ -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 diff --git a/lib/rscons/builders/shared_object.rb b/lib/rscons/builders/shared_object.rb index 884f27e..ae50da6 100644 --- a/lib/rscons/builders/shared_object.rb +++ b/lib/rscons/builders/shared_object.rb @@ -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 diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index 154e37b..5910726 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -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] # 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) diff --git a/lib/rscons/util.rb b/lib/rscons/util.rb index ff694c7..c54df87 100644 --- a/lib/rscons/util.rb +++ b/lib/rscons/util.rb @@ -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] + # 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] diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index 170a49f..cc8d4f1 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -188,8 +188,8 @@ EOF result = run_rscons expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - 'CC build/e.1/header.o', - "LD header.exe", + "Compiling header.c", + "Linking => header.exe", ] end @@ -217,8 +217,8 @@ EOF result = run_rscons expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - 'CC build/e.1/header.o', - "LD header.exe", + "Compiling header.c", + "Linking => header.exe", ] expect(`./header.exe`).to eq "The value is 2\n" result = run_rscons @@ -231,8 +231,8 @@ EOF result = run_rscons expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - 'CC build/e.1/header.o', - "LD header.exe", + "Compiling header.c", + "Linking => header.exe", ] expect(`./header.exe`).to eq "The value is 2\n" sleep 0.05 @@ -305,7 +305,7 @@ EOF test_dir('custom_builder') result = run_rscons expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["CC build/e.1/program.o", "LD program.exe"] + expect(lines(result.stdout)).to include *["Compiling program.c", "Linking => program.exe"] expect(File.exists?('inc.h')).to be_truthy expect(`./program.exe`).to eq "The value is 5678\n" end @@ -315,7 +315,7 @@ EOF result = run_rscons(rsconscript: "multiple_targets.rb") expect(result.stderr).to eq "" slines = lines(result.stdout) - expect(slines).to include("CHGen inc.c", "CC build/e.1/program.o", "CC build/e.1/inc.o", "LD program.exe") + expect(slines).to include("CHGen inc.c", "Compiling program.c", "Compiling inc.c", "Linking => program.exe") expect(File.exists?("inc.c")).to be_truthy expect(File.exists?("inc.h")).to be_truthy expect(`./program.exe`).to eq "The value is 42\n" @@ -453,19 +453,19 @@ EOF File.open("program.ld", "w") {|fh| fh.puts("1")} result = run_rscons(rsconscript: "user_dependencies.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["CC build/e.1/simple.o", "LD simple.exe"] + expect(lines(result.stdout)).to include *["Compiling simple.c", "Linking => simple.exe"] expect(File.exists?('build/e.1/simple.o')).to be_truthy expect(`./simple.exe`).to eq "This is a simple C program\n" File.open("program.ld", "w") {|fh| fh.puts("2")} result = run_rscons(rsconscript: "user_dependencies.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["LD simple.exe"] + expect(lines(result.stdout)).to include *["Linking => simple.exe"] File.unlink("program.ld") result = run_rscons(rsconscript: "user_dependencies.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["LD simple.exe"] + expect(lines(result.stdout)).to include *["Linking => simple.exe"] result = run_rscons(rsconscript: "user_dependencies.rb") expect(result.stderr).to eq "" @@ -515,9 +515,9 @@ EOF #expect(result.stderr).to eq "" slines = lines(result.stdout) if RUBY_PLATFORM =~ /mingw/ - expect(slines).to include("SHLD mine.dll") + expect(slines).to include("Linking => mine.dll") else - expect(slines).to include("SHLD libmine.so") + expect(slines).to include("Linking => libmine.so") end end end @@ -561,7 +561,7 @@ EOF test_dir('custom_builder') result = run_rscons(rsconscript: "cvar_expansion.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["CC build/e.1/program.o", "LD program.exe"] + expect(lines(result.stdout)).to include *["Compiling program.c", "Linking => program.exe"] expect(File.exists?('inc.h')).to be_truthy expect(`./program.exe`).to eq "The value is 678\n" end @@ -625,11 +625,11 @@ EOF result = run_rscons(rsconscript: "assuffix.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC one.ssss", - "CC two.sss", - "AS build/e.1/one.o", - "AS build/e.1/two.o", - "LD two_sources.exe", + "Compiling one.c", + "Compiling two.c", + "Assembling one.ssss", + "Assembling two.sss", + "Linking => two_sources.exe", ] expect(File.exists?("two_sources.exe")).to be_truthy expect(`./two_sources.exe`).to eq "This is a C program with two sources.\n" @@ -650,7 +650,7 @@ EOF result = run_rscons expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include "Preprocess pp" + expect(lines(result.stdout)).to include "Preprocessing foo.h => pp" expect(File.read("pp")).to match(%r{xyz42abc}m) result = run_rscons @@ -662,7 +662,7 @@ EOF end result = run_rscons expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include "Preprocess pp" + expect(lines(result.stdout)).to include "Preprocessing foo.h => pp" expect(File.read("pp")).to match(%r{abc88xyz}m) end @@ -680,8 +680,8 @@ EOF expect(result.stderr).to eq "" expect(File.exists?("one.o")).to be_truthy expect(lines(result.stdout)).to include *[ - "CC one.o", - "CC one.o", + "Compiling src/one/one.c", + "Compiling src/two/two.c", ] end @@ -692,8 +692,8 @@ EOF expect(File.exists?("one.o")).to be_truthy expect(File.exists?("two.o")).to be_truthy expect(lines(result.stdout)).to include *[ - "CC one.o", - "CC two.o", + "Compiling src/one/one.c", + "Compiling src/two/two.c", ] end @@ -713,7 +713,7 @@ EOF rscons_args: %w[-j1]) expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC two.o", + "Compiling two.c", ] end @@ -722,8 +722,8 @@ EOF result = run_rscons(rsconscript: "progsuffix.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC build/e.1/simple.o", - "LD simple.out", + "Compiling simple.c", + "Linking => simple.out", ] end @@ -732,8 +732,8 @@ EOF result = run_rscons(rsconscript: "progsuffix2.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC build/e.1/simple.o", - "LD simple.out", + "Compiling simple.c", + "Linking => simple.out", ] end @@ -742,8 +742,8 @@ EOF result = run_rscons(rsconscript: "progsuffix3.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC build/e.1/simple.o", - "LD simple.xyz", + "Compiling simple.c", + "Linking => simple.xyz", ] end @@ -752,8 +752,8 @@ EOF result = run_rscons(rsconscript: "absolute_source_path.rb") expect(result.stderr).to eq "" slines = lines(result.stdout) - expect(slines).to include a_string_matching %r{^CC build/e.1/.*/abs\.o$} - expect(slines).to include "LD abs.exe" + expect(slines).to include a_string_matching %r{build/e.1/.*/abs\.o$} + expect(slines).to include a_string_matching %r{\babs.exe\b} end it "creates shared libraries" do @@ -763,10 +763,10 @@ EOF expect(result.stderr).to eq "" slines = lines(result.stdout) if RUBY_PLATFORM =~ /mingw/ - expect(slines).to include("SHLD mine.dll") + expect(slines).to include("Linking => mine.dll") expect(File.exists?("mine.dll")).to be_truthy else - expect(slines).to include("SHLD libmine.so") + expect(slines).to include("Linking => libmine.so") expect(File.exists?("libmine.so")).to be_truthy end @@ -786,9 +786,9 @@ EOF expect(result.stderr).to eq "" slines = lines(result.stdout) if RUBY_PLATFORM =~ /mingw/ - expect(slines).to include("SHLD mine.dll") + expect(slines).to include("Linking => mine.dll") else - expect(slines).to include("SHLD libmine.so") + expect(slines).to include("Linking => libmine.so") end result = run_rscons(rsconscript: "shared_library_cxx.rb") @@ -842,7 +842,7 @@ EOF result = run_rscons(rsconscript: "echo_command_ruby_builder.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["Install inst.exe"] + expect(lines(result.stdout)).to include *["Install install.rb => inst.exe"] end it "supports a string for a builder's echoed 'command' with Environment#print_builder_run_message" do @@ -883,8 +883,8 @@ EOF result = run_rscons expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "LEX lexer.c", - "YACC parser.c", + "Generating lexer from lexer.l => lexer.c", + "Generating parser from parser.y => parser.c", ] result = run_rscons @@ -906,7 +906,7 @@ EOF result = run_rscons(rsconscript: "command_builder.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["BuildIt simple.exe"] + expect(lines(result.stdout)).to include *["BuildIt => simple.exe"] expect(`./simple.exe`).to eq "This is a simple C program\n" result = run_rscons(rsconscript: "command_builder.rb") @@ -920,8 +920,8 @@ EOF result = run_rscons(rsconscript: "command_redirect.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC simple.o", - "My Disassemble simple.txt", + "Compiling simple.c", + "My Disassemble => simple.txt", ] expect(File.read("simple.txt")).to match /Disassembly of section .text:/ end @@ -932,7 +932,7 @@ EOF test_dir("simple") result = run_rscons(rsconscript: "directory.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["Directory teh_dir"] + expect(lines(result.stdout)).to include *["Creating directory => teh_dir"] expect(File.directory?("teh_dir")).to be_truthy end @@ -941,7 +941,7 @@ EOF FileUtils.mkdir("teh_dir") result = run_rscons(rsconscript: "directory.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to_not include a_string_matching /Directory/ + expect(lines(result.stdout)).to_not include a_string_matching /Creating directory/ expect(File.directory?("teh_dir")).to be_truthy end @@ -959,7 +959,7 @@ EOF result = run_rscons(rsconscript: "install.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["Install inst.exe"] + expect(lines(result.stdout)).to include *["Install install.rb => inst.exe"] result = run_rscons(rsconscript: "install.rb") expect(result.stderr).to eq "" @@ -971,7 +971,7 @@ EOF FileUtils.rm("inst.exe") result = run_rscons(rsconscript: "install.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["Install inst.exe"] + expect(lines(result.stdout)).to include *["Install install.rb => inst.exe"] end it "operates the same as a Copy builder" do @@ -979,7 +979,7 @@ EOF result = run_rscons(rsconscript: "copy.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["Copy inst.exe"] + expect(lines(result.stdout)).to include *["Copy copy.rb => inst.exe"] result = run_rscons(rsconscript: "copy.rb") expect(result.stderr).to eq "" @@ -991,7 +991,7 @@ EOF FileUtils.rm("inst.exe") result = run_rscons(rsconscript: "copy.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["Copy inst.exe"] + expect(lines(result.stdout)).to include *["Copy copy.rb => inst.exe"] end it "copies a file to the target directory name" do @@ -999,7 +999,7 @@ EOF result = run_rscons(rsconscript: "install_directory.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include("Install inst") + expect(lines(result.stdout)).to include("Install install_directory.rb => inst") expect(File.exists?("inst/install_directory.rb")).to be_truthy expect(File.read("inst/install_directory.rb", mode: "rb")).to eq(File.read("install_directory.rb", mode: "rb")) @@ -1012,7 +1012,7 @@ EOF test_dir("typical") result = run_rscons(rsconscript: "install_directory.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include("Install noexist/src") + expect(lines(result.stdout)).to include("Install src => noexist/src") %w[src/one/one.c src/two/two.c src/two/two.h].each do |f| expect(File.exists?("noexist/#{f}")).to be_truthy expect(File.read("noexist/#{f}", mode: "rb")).to eq(File.read(f, mode: "rb")) @@ -1023,7 +1023,7 @@ EOF test_dir("typical") result = run_rscons(rsconscript: "install_directory.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include("Install exist/src") + expect(lines(result.stdout)).to include("Install src => exist/src") %w[src/one/one.c src/two/two.c src/two/two.h].each do |f| expect(File.exists?("exist/#{f}")).to be_truthy expect(File.read("exist/#{f}", mode: "rb")).to eq(File.read(f, mode: "rb")) @@ -1038,8 +1038,8 @@ EOF result = run_rscons(rsconscript: "phony_target.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC build/e.1/simple.o", - "LD simple.exe", + "Compiling simple.c", + "Linking => simple.exe", "Checker simple.exe", ] @@ -1065,7 +1065,7 @@ EOF test_dir("simple") result = run_rscons(rsconscript: "clear_targets.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to_not include a_string_matching %r{LD} + expect(lines(result.stdout)).to_not include a_string_matching %r{Linking} end end @@ -1128,14 +1128,14 @@ EOF result = run_rscons expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC build/e.1/simple.o", - "LD simple.exe", + "Compiling simple.c", + "Linking => simple.exe", ] result = run_rscons(rsconscript: "cache_command_change.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "LD simple.exe", + "Linking => simple.exe", ] end @@ -1145,14 +1145,14 @@ EOF result = run_rscons(rsconscript: "cache_new_dep1.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC simple.o", - "LD simple.exe", + "Compiling simple.c", + "Linking => simple.exe", ] result = run_rscons(rsconscript: "cache_new_dep2.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "LD simple.exe", + "Linking => simple.exe", ] end @@ -1161,14 +1161,14 @@ EOF result = run_rscons(rsconscript: "cache_dep_checksum_change.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["Copy simple.copy"] + expect(lines(result.stdout)).to include *["Copy simple.c => simple.copy"] File.open("simple.c", "wb") do |fh| fh.write("hi") end result = run_rscons(rsconscript: "cache_dep_checksum_change.rb") expect(result.stderr).to eq "" - expect(lines(result.stdout)).to include *["Copy simple.copy"] + expect(lines(result.stdout)).to include *["Copy simple.c => simple.copy"] end it "forces a rebuild with strict_deps=true when dependency order changes" do @@ -1201,15 +1201,15 @@ EOF result = run_rscons(rsconscript: "cache_user_dep.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC build/e.1/simple.o", - "LD simple.exe", + "Compiling simple.c", + "Linking => simple.exe", ] File.open("user_deps", "wb") {|fh| fh.write("foo")} result = run_rscons(rsconscript: "cache_user_dep.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "LD simple.exe", + "Linking => simple.exe", ] end @@ -1221,8 +1221,8 @@ EOF result = run_rscons(rsconscript: "cache_user_dep.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "CC build/e.1/simple.o", - "LD simple.exe", + "Compiling simple.c", + "Linking => simple.exe", ] result = run_rscons(rsconscript: "cache_user_dep.rb") @@ -1233,7 +1233,7 @@ EOF result = run_rscons(rsconscript: "cache_user_dep.rb") expect(result.stderr).to eq "" expect(lines(result.stdout)).to include *[ - "LD simple.exe", + "Linking => simple.exe", ] end @@ -1378,9 +1378,9 @@ EOF expect(result.stderr).to eq "" slines = lines(result.stdout) if RUBY_PLATFORM =~ /mingw/ - expect(slines).to include("SHLD mine.dll") + expect(slines).to include("Linking => mine.dll") else - expect(slines).to include("SHLD libmine.so") + expect(slines).to include("Linking => libmine.so") end end end @@ -1934,7 +1934,7 @@ EOF test_dir('simple') result = run_rscons expect(result.stderr).to eq "" - expect(result.stdout).to match /CC .*simple\.o/ + expect(result.stdout).to match /Compiling.*simple\.c/ end it "echoes commands by default with -v" do