show build progress - close #98

This commit is contained in:
josh committed 2019-04-28 22:40:50 -04:00
1 parent 59a3cb4e10
commit a4fead7dc6
8 files changed
+395 -219

No files matched your search

+20 -6
View File
@@ -5,10 +5,26 @@ module Rscons
# The Copy builder copies files/directories to new locations.
class Copy < Builder
# Construct builder.
def initialize(*args)
super
@install_builder = self.class.name == "Install"
@nop = @install_builder && !Rscons.application.operation("install")
end
# Return whether the builder is a no-op.
#
# @return [Boolean]
# Whether the builder is a no-op.
def nop?
@nop
end
# Run the builder to produce a build target.
def run(options)
install_builder = self.class.name == "Install"
if (not install_builder) or Rscons.application.operation("install")
if @nop
true
else
target_is_dir = (@sources.length > 1) ||
Dir.exists?(@sources.first) ||
Dir.exists?(@target)
@@ -40,14 +56,12 @@ module Rscons
print_run_message(message, nil)
printed_message = true
end
@cache.mkdir_p(File.dirname(dest), install: install_builder)
@cache.mkdir_p(File.dirname(dest), install: @install_builder)
FileUtils.cp(src, dest, :preserve => true)
end
@cache.register_build(dest, :Copy, [src], @env, install: install_builder)
@cache.register_build(dest, :Copy, [src], @env, install: @install_builder)
end
(target_is_dir ? Dir.exists?(@target) : File.exists?(@target)) ? true : false
else
true
end
end
+19 -5
View File
@@ -4,10 +4,26 @@ module Rscons
# The Directory builder creates a directory.
class Directory < Builder
# Construct builder.
def initialize(*args)
super
@install_builder = self.class.name == "InstallDirectory"
@nop = @install_builder && !Rscons.application.operation("install")
end
# Return whether the builder is a no-op.
#
# @return [Boolean]
# Whether the builder is a no-op.
def nop?
@nop
end
# Run the builder to produce a build target.
def run(options)
install_builder = self.class.name == "InstallDirectory"
if (not install_builder) or Rscons.application.operation("install")
if @nop
true
else
if File.directory?(@target)
true
elsif File.exists?(@target)
@@ -15,11 +31,9 @@ module Rscons
false
else
print_run_message("Creating directory => #{@target}", nil)
@cache.mkdir_p(@target, install: install_builder)
@cache.mkdir_p(@target, install: @install_builder)
true
end
else
true
end
end