Compare commits
No commits in common. "86fcebbda7a307592fe73ff7e22d2bab28321bb3" and "94a86e3433dfe8d50f3c0f71ba6a97e15b58b956" have entirely different histories.
86fcebbda7
...
94a86e3433
@ -3,6 +3,5 @@ configure do
|
||||
end
|
||||
|
||||
env(echo: :command) do |env|
|
||||
env["D_IMPORT_PATH"] << "src"
|
||||
env.Program("hello-d.exe", glob("src/*.d"))
|
||||
env.Program("hello-d.exe", glob("*.d"))
|
||||
end
|
||||
|
||||
@ -3,6 +3,5 @@ configure do
|
||||
end
|
||||
|
||||
env(echo: :command) do |env|
|
||||
env["D_IMPORT_PATH"] << "src"
|
||||
env.Program("hello-d.exe", glob("src/*.d"))
|
||||
env.Program("hello-d.exe", glob("*.d"))
|
||||
end
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
env(echo: :command) do |env|
|
||||
env["LD_LIBRARY_PATH"] << "src"
|
||||
env.Object("main.o", "src/main.d")
|
||||
env.Object("mod.o", "src/mod.d")
|
||||
env.Object("main.o", "main.d")
|
||||
env.Object("mod.o", "mod.d")
|
||||
env.Program("hello-d.exe", ["main.o", "mod.o"])
|
||||
end
|
||||
|
||||
@ -33,7 +33,6 @@ module Rscons
|
||||
:Lex,
|
||||
:Library,
|
||||
:Object,
|
||||
:Precompile,
|
||||
:Preprocess,
|
||||
:Program,
|
||||
:SharedLibrary,
|
||||
@ -153,7 +152,6 @@ require_relative "rscons/builders/disassemble"
|
||||
require_relative "rscons/builders/lex"
|
||||
require_relative "rscons/builders/library"
|
||||
require_relative "rscons/builders/object"
|
||||
require_relative "rscons/builders/precompile"
|
||||
require_relative "rscons/builders/preprocess"
|
||||
require_relative "rscons/builders/program"
|
||||
require_relative "rscons/builders/shared_library"
|
||||
|
||||
@ -27,9 +27,8 @@ module Rscons
|
||||
# env.Directory("dest")
|
||||
# env.Install("dest", "bin")
|
||||
# env.Install("dest", "share")
|
||||
target = Util.absolute_path(builder.target)
|
||||
self[target] ||= []
|
||||
self[target] << builder
|
||||
self[builder.target] ||= []
|
||||
self[builder.target] << builder
|
||||
end
|
||||
|
||||
# Return the number of remaining build steps.
|
||||
@ -56,14 +55,9 @@ module Rscons
|
||||
def get_next_builder_to_run(targets_still_building)
|
||||
to_build = self.find do |target, builders|
|
||||
deps = builders.first.sources + (@build_dependencies[target] || []).to_a
|
||||
deps.map! {|dep| Util.absolute_path(dep)}
|
||||
# All dependencies must have been built for this target to be ready to
|
||||
# build.
|
||||
deps.all? do |dep|
|
||||
puts "BuilderSet: #{target}: dep #{dep}"
|
||||
puts " still building? #{targets_still_building.include?(dep)}"
|
||||
puts " self.include? #{self.include?(dep)}"
|
||||
puts " @side_effects.include? #{@side_effects.include?(dep)}"
|
||||
!(targets_still_building.include?(dep) ||
|
||||
self.include?(dep) ||
|
||||
@side_effects.include?(dep))
|
||||
@ -72,7 +66,6 @@ module Rscons
|
||||
|
||||
if to_build
|
||||
target, builders = *to_build
|
||||
puts "Selecting #{target.inspect} to build"
|
||||
builder = builders.first
|
||||
if builders.size > 1
|
||||
builders.slice!(0)
|
||||
|
||||
@ -15,16 +15,11 @@ module Rscons
|
||||
# List of paths to the object or static library dependencies.
|
||||
def register_object_deps(builder_class)
|
||||
suffixes = @env.expand_varref(["${OBJSUFFIX}", "${LIBSUFFIX}"], @vars)
|
||||
barrier_target = @env.setup_precompile(@sources)
|
||||
@sources.map do |source|
|
||||
if source.end_with?(*suffixes)
|
||||
source
|
||||
else
|
||||
object_file_path = @env.register_dependency_build(@target, source, suffixes.first, @vars, builder_class)
|
||||
if barrier_target
|
||||
@env.depends(object_file_path, barrier_target)
|
||||
end
|
||||
object_file_path
|
||||
@env.register_dependency_build(@target, source, suffixes.first, @vars, builder_class)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
module Rscons
|
||||
module Builders
|
||||
# The Precompile builder generates .di interface files from .d source files
|
||||
# for D.
|
||||
class Precompile < Builder
|
||||
|
||||
# Run the builder to produce a build target.
|
||||
def run(options)
|
||||
if @command
|
||||
finalize_command
|
||||
else
|
||||
if @sources.find {|s| s.end_with?(*@env.expand_varref("${DSUFFIX}", @vars))}
|
||||
pcc = @env.expand_varref("${DC}")
|
||||
if pcc =~ /ldc/
|
||||
dpc_cmd = "${DPC_CMD:ldc}"
|
||||
else
|
||||
dpc_cmd = "${DPC_CMD:gdc}"
|
||||
end
|
||||
@vars["_TARGET"] = @target
|
||||
@vars["_SOURCES"] = @sources
|
||||
command = @env.build_command(dpc_cmd, @vars)
|
||||
standard_command("Precompile <source>#{Util.short_format_paths(@sources)}<reset>", command)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -142,16 +142,14 @@ module Rscons
|
||||
# - each cached dependency file's current checksum matches the checksum
|
||||
# stored in the cache file
|
||||
def up_to_date?(targets, command, deps, env, options = {})
|
||||
deps.map! {|dep| Util.absolute_path(dep)}
|
||||
Array(targets).each do |target|
|
||||
target = Util.absolute_path(target)
|
||||
cache_key = get_cache_key(target)
|
||||
|
||||
unless Rscons.phony_target?(target)
|
||||
# target file must exist on disk
|
||||
unless File.exist?(target)
|
||||
if options[:debug] || ENV["RSCONS_CACHE_DEBUG"]
|
||||
puts "Cache: up_to_date?: Target #{target} needs rebuilding because it does not exist on disk"
|
||||
if options[:debug]
|
||||
puts "Target #{target} needs rebuilding because it does not exist on disk"
|
||||
end
|
||||
return false
|
||||
end
|
||||
@ -159,8 +157,8 @@ module Rscons
|
||||
|
||||
# target must be registered in the cache
|
||||
unless @cache["targets"].has_key?(cache_key)
|
||||
if options[:debug] || ENV["RSCONS_CACHE_DEBUG"]
|
||||
puts "Cache: up_to_date?: Target #{target} needs rebuilding because there is no cached build information for it"
|
||||
if options[:debug]
|
||||
puts "Target #{target} needs rebuilding because there is no cached build information for it"
|
||||
end
|
||||
return false
|
||||
end
|
||||
@ -168,8 +166,8 @@ module Rscons
|
||||
unless Rscons.phony_target?(target)
|
||||
# target must have the same checksum as when it was built last
|
||||
unless @cache["targets"][cache_key]["checksum"] == lookup_checksum(target)
|
||||
if options[:debug] || ENV["RSCONS_CACHE_DEBUG"]
|
||||
puts "Cache: up_to_date?: Target #{target} needs rebuilding because it has been changed on disk since being built last"
|
||||
if options[:debug]
|
||||
puts "Target #{target} needs rebuilding because it has been changed on disk since being built last"
|
||||
end
|
||||
return false
|
||||
end
|
||||
@ -177,8 +175,8 @@ module Rscons
|
||||
|
||||
# command used to build target must be identical
|
||||
unless @cache["targets"][cache_key]["command"] == Digest::MD5.hexdigest(command.inspect)
|
||||
if options[:debug] || ENV["RSCONS_CACHE_DEBUG"]
|
||||
puts "Cache: up_to_date?: Target #{target} needs rebuilding because the command used to build it has changed"
|
||||
if options[:debug]
|
||||
puts "Target #{target} needs rebuilding because the command used to build it has changed"
|
||||
end
|
||||
return false
|
||||
end
|
||||
@ -188,16 +186,16 @@ module Rscons
|
||||
if options[:strict_deps]
|
||||
# depedencies passed in must exactly equal those in the cache
|
||||
unless deps == cached_deps_fnames
|
||||
if options[:debug] || ENV["RSCONS_CACHE_DEBUG"]
|
||||
puts "Cache: up_to_date?: Target #{target} needs rebuilding because the :strict_deps option is given and the set of dependencies does not match the previous set of dependencies"
|
||||
if options[:debug]
|
||||
puts "Target #{target} needs rebuilding because the :strict_deps option is given and the set of dependencies does not match the previous set of dependencies"
|
||||
end
|
||||
return false
|
||||
end
|
||||
else
|
||||
# all dependencies passed in must exist in cache (but cache may have more)
|
||||
unless (Set.new(deps) - Set.new(cached_deps_fnames)).empty?
|
||||
if options[:debug] || ENV["RSCONS_CACHE_DEBUG"]
|
||||
puts "Cache: up_to_date?: Target #{target} needs rebuilding because there are new dependencies"
|
||||
if options[:debug]
|
||||
puts "Target #{target} needs rebuilding because there are new dependencies"
|
||||
end
|
||||
return false
|
||||
end
|
||||
@ -205,12 +203,11 @@ module Rscons
|
||||
|
||||
# set of user dependencies must match
|
||||
user_deps = env.get_user_deps(target) || []
|
||||
user_deps.map! {|dep| Util.absolute_path(dep)}
|
||||
cached_user_deps = @cache["targets"][cache_key]["user_deps"] || []
|
||||
cached_user_deps_fnames = cached_user_deps.map { |dc| dc["fname"] }
|
||||
unless user_deps == cached_user_deps_fnames
|
||||
if options[:debug] || ENV["RSCONS_CACHE_DEBUG"]
|
||||
puts "Cache: up_to_date?: Target #{target} needs rebuilding because the set of user-specified dependency files has changed"
|
||||
if options[:debug]
|
||||
puts "Target #{target} needs rebuilding because the set of user-specified dependency files has changed"
|
||||
end
|
||||
return false
|
||||
end
|
||||
@ -218,14 +215,12 @@ module Rscons
|
||||
# all cached dependencies must have their checksums match
|
||||
(cached_deps + cached_user_deps).each do |dep_cache|
|
||||
unless dep_cache["checksum"] == lookup_checksum(dep_cache["fname"])
|
||||
if options[:debug] || ENV["RSCONS_CACHE_DEBUG"]
|
||||
puts "Cache: up_to_date?: Target #{target} needs rebuilding because dependency file #{dep_cache["fname"]} has changed"
|
||||
if options[:debug]
|
||||
puts "Target #{target} needs rebuilding because dependency file #{dep_cache["fname"]} has changed"
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
puts "Cache: up_to_date?: Target #{target} is up to date" if ENV["RSCONS_CACHE_DEBUG"]
|
||||
end
|
||||
|
||||
true
|
||||
@ -252,26 +247,22 @@ module Rscons
|
||||
# @return [void]
|
||||
def register_build(targets, command, deps, env, options = {})
|
||||
Array(targets).each do |target|
|
||||
target = Util.absolute_path(target)
|
||||
target_checksum =
|
||||
if options[:side_effect] or Rscons.phony_target?(target)
|
||||
""
|
||||
else
|
||||
calculate_checksum(target)
|
||||
end
|
||||
puts "Cache: register_build(#{target}, #{target_checksum})"
|
||||
@cache["targets"][get_cache_key(target)] = {
|
||||
"command" => Digest::MD5.hexdigest(command.inspect),
|
||||
"checksum" => target_checksum,
|
||||
"deps" => deps.map do |dep|
|
||||
dep = Util.absolute_path(dep)
|
||||
{
|
||||
"fname" => dep,
|
||||
"checksum" => lookup_checksum(dep),
|
||||
}
|
||||
end,
|
||||
"user_deps" => (env.get_user_deps(target) || []).map do |dep|
|
||||
dep = Util.absolute_path(dep)
|
||||
{
|
||||
"fname" => dep,
|
||||
"checksum" => lookup_checksum(dep),
|
||||
@ -390,8 +381,6 @@ module Rscons
|
||||
#
|
||||
# @return [String] The file's checksum.
|
||||
def lookup_checksum(file)
|
||||
file = Util.absolute_path(file)
|
||||
puts "Cache: lookup_checksum(#{file})" if ENV["RSCONS_CACHE_DEBUG"]
|
||||
@lookup_checksums[file] || calculate_checksum(file)
|
||||
end
|
||||
|
||||
@ -401,10 +390,7 @@ module Rscons
|
||||
#
|
||||
# @return [String] The file's checksum.
|
||||
def calculate_checksum(file)
|
||||
file = Util.absolute_path(file)
|
||||
cs = Digest::MD5.hexdigest(File.read(file, mode: "rb")) rescue ""
|
||||
puts "Cache: calculate_checksum(#{file}) = #{cs}" if ENV["RSCONS_CACHE_DEBUG"]
|
||||
@lookup_checksums[file] = cs
|
||||
@lookup_checksums[file] = Digest::MD5.hexdigest(File.read(file, mode: "rb")) rescue ""
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -43,8 +43,6 @@ module Rscons
|
||||
"DFLAGS" => [],
|
||||
"DISASM_CMD" => %w[${OBJDUMP} ${DISASM_FLAGS} ${_SOURCES}],
|
||||
"DISASM_FLAGS" => %w[--disassemble --source],
|
||||
"DPC_CMD:ldc" => %w[${DC} -H -Hf ${_TARGET} -o- ${INCPREFIX}${D_IMPORT_PATH} ${DFLAGS} ${_SOURCES}],
|
||||
"DPC_CMD:gdc" => %w[${DC} -H -Hf ${_TARGET} -fsyntax-only ${INCPREFIX}${D_IMPORT_PATH} ${DFLAGS} ${_SOURCES}],
|
||||
"DSUFFIX" => %w[.d],
|
||||
"D_IMPORT_PATH" => [],
|
||||
"INCPREFIX" => "-I",
|
||||
|
||||
@ -291,17 +291,6 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
# Get a path under the build root for precompile outputs.
|
||||
#
|
||||
# @param end_path [String]
|
||||
# Path to append to precompile build root.
|
||||
#
|
||||
# @return [String]
|
||||
# Precompile directory name.
|
||||
def get_pc_build_dir(end_path)
|
||||
"#{@build_root}/pc/#{Util.make_relative_path(end_path)}"
|
||||
end
|
||||
|
||||
# Build all build targets specified in the Environment.
|
||||
#
|
||||
# When a block is passed to Environment.new, this method is automatically
|
||||
@ -400,9 +389,7 @@ module Rscons
|
||||
if target.is_a?(Builder)
|
||||
target = target.target
|
||||
end
|
||||
unless Rscons.phony_target?(target)
|
||||
target = Util.absolute_path(expand(target))
|
||||
end
|
||||
target = expand(target.to_s)
|
||||
user_deps = user_deps.map do |ud|
|
||||
if ud.is_a?(Builder)
|
||||
ud = ud.target
|
||||
@ -410,9 +397,9 @@ module Rscons
|
||||
expand(ud)
|
||||
end
|
||||
@user_deps[target] ||= []
|
||||
user_deps.each do |ud|
|
||||
unless @user_deps[target].include?(ud)
|
||||
@user_deps[target] << Util.absolute_path(ud)
|
||||
(@user_deps[target] + user_deps).each do |ud|
|
||||
unless Rscons.phony_target?(ud) || @user_deps[target].include?(ud)
|
||||
@user_deps[target] << ud
|
||||
end
|
||||
end
|
||||
build_after(target, user_deps)
|
||||
@ -445,16 +432,14 @@ module Rscons
|
||||
targets = Array(targets)
|
||||
prerequisites = Array(prerequisites)
|
||||
targets.each do |target|
|
||||
unless Rscons.phony_target?(target)
|
||||
target = Util.absolute_path(expand(target))
|
||||
end
|
||||
target = expand(target)
|
||||
@registered_build_dependencies[target] ||= Set.new
|
||||
prerequisites.each do |prerequisite|
|
||||
if prerequisite.is_a?(Builder)
|
||||
prerequisite = prerequisite.target
|
||||
end
|
||||
prerequisite = expand(prerequisite)
|
||||
@registered_build_dependencies[target] << Util.absolute_path(prerequisite)
|
||||
@registered_build_dependencies[target] << prerequisite
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -469,7 +454,7 @@ module Rscons
|
||||
#
|
||||
# @return [void]
|
||||
def produces(target, *side_effects)
|
||||
target = Util.absolute_path(expand(target))
|
||||
target = expand(target)
|
||||
@builder_sets.reverse.each do |builder_set|
|
||||
if builders = builder_set[target]
|
||||
builders.last.produces(*side_effects)
|
||||
@ -615,42 +600,6 @@ module Rscons
|
||||
@builder_sets << build_builder_set
|
||||
end
|
||||
|
||||
# Set up builders and barrier for a precompile phase if needed.
|
||||
#
|
||||
# @param sources [Array<String>]
|
||||
# Sources for the build operation.
|
||||
#
|
||||
# @return [Symbol, nil]
|
||||
# Barrier target name if a precompile phase is needed, otherwise nil.
|
||||
def setup_precompile(sources)
|
||||
barrier_target = nil
|
||||
precompile_paths = Set.new
|
||||
sources.each do |source|
|
||||
next unless source.end_with?(".d")
|
||||
unless barrier_target
|
||||
barrier_target = Rscons.gen_phony_target
|
||||
self.Barrier(barrier_target)
|
||||
end
|
||||
next unless module_name = Util.get_module_name(source)
|
||||
next unless import_path = Util.find_import_path_for_d_source(self["D_IMPORT_PATH"], source, module_name)
|
||||
precompile_path = get_pc_build_dir(import_path)
|
||||
unless precompile_paths.include?(precompile_path)
|
||||
Util.clean_d_precompile_path(precompile_path, import_path)
|
||||
precompile_paths << precompile_path
|
||||
end
|
||||
unless self["D_IMPORT_PATH"].include?(precompile_path)
|
||||
# Put the precompile path containing the .di files for the given
|
||||
# import path immediately before the import path.
|
||||
index = self["D_IMPORT_PATH"].find_index {|ip| ip == import_path}
|
||||
self["D_IMPORT_PATH"].insert(index, precompile_path)
|
||||
end
|
||||
pctarget = "#{precompile_path}/#{module_name.gsub(".", "/")}.di"
|
||||
self.Precompile(pctarget, source)
|
||||
self.depends(barrier_target, pctarget)
|
||||
end
|
||||
barrier_target
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Build a BuilderSet.
|
||||
@ -781,7 +730,7 @@ module Rscons
|
||||
# If no builder was found to run yet and there are threads available, try
|
||||
# to get a runnable builder from the builder set.
|
||||
targets_still_building = @threads.reduce([]) do |result, (thread, obj)|
|
||||
result << Util.absolute_path(builder_for_thread(thread).target)
|
||||
result << builder_for_thread(thread).target
|
||||
end
|
||||
if @builder_sets.size > 0
|
||||
if builder = @builder_sets[0].get_next_builder_to_run(targets_still_building)
|
||||
|
||||
@ -34,7 +34,15 @@ module Rscons
|
||||
#
|
||||
# @return [Array<String>] Paths matching the specified pattern(s).
|
||||
def glob(*patterns)
|
||||
Util.glob(*patterns)
|
||||
require "pathname"
|
||||
patterns.reduce([]) do |result, pattern|
|
||||
if pattern.end_with?("/**")
|
||||
pattern += "/"
|
||||
end
|
||||
result += Dir.glob(pattern).map do |path|
|
||||
Pathname.new(path.gsub("\\", "/")).cleanpath.to_s
|
||||
end
|
||||
end.sort
|
||||
end
|
||||
|
||||
# Download a file.
|
||||
|
||||
@ -16,42 +16,6 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
# Get the absolute path for a given path.
|
||||
#
|
||||
# If the path is a phony target, leave it as is.
|
||||
#
|
||||
# @param path [String, Symbol]
|
||||
# Input path.
|
||||
#
|
||||
# @return [String, Symbol]
|
||||
# Output path.
|
||||
def absolute_path(path)
|
||||
if Rscons.phony_target?(path)
|
||||
path
|
||||
else
|
||||
File.expand_path(path)
|
||||
end
|
||||
end
|
||||
|
||||
# Remove any stale .di files from the precompile path.
|
||||
#
|
||||
# @param pc_path [String]
|
||||
# Path to precompile build directory containing .di generated
|
||||
# interface files.
|
||||
# @param import_path [String]
|
||||
# D import path containing .d source files.
|
||||
#
|
||||
# @return [void]
|
||||
def clean_d_precompile_path(pc_path, import_path)
|
||||
glob("#{pc_path}/**/*.di").each do |di_path|
|
||||
end_path = di_path[(pc_path.size+1)..]
|
||||
path = "#{import_path}/#{end_path}".sub(/\.di$/, ".d")
|
||||
unless File.exist?(path)
|
||||
FileUtils.rm_f(path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Colorize a builder run message.
|
||||
#
|
||||
# @param message [String]
|
||||
@ -156,29 +120,6 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
# Find the D import path that will be used to import the given module.
|
||||
#
|
||||
# @param import_paths [Array<String>]
|
||||
# Import paths.
|
||||
# @param source [String]
|
||||
# Source file name.
|
||||
# @param module_name [String]
|
||||
# Module name.
|
||||
#
|
||||
# @return [String, nil]
|
||||
# Import path used to import the given module.
|
||||
def find_import_path_for_d_source(import_paths, source, module_name)
|
||||
source = source.gsub("\\", "/")
|
||||
module_path = module_name.gsub(".", "/") + ".d"
|
||||
import_paths.each do |import_path|
|
||||
path = "#{import_path}/#{module_path}".gsub("\\", "/")
|
||||
if path == source
|
||||
return import_path
|
||||
end
|
||||
end
|
||||
nil
|
||||
end
|
||||
|
||||
# Format an elapsed time in human-readable format.
|
||||
#
|
||||
# @return [String]
|
||||
@ -200,52 +141,6 @@ module Rscons
|
||||
result
|
||||
end
|
||||
|
||||
# Get the module name for a D source file.
|
||||
#
|
||||
# @param source_path [String]
|
||||
# D source file.
|
||||
#
|
||||
# @return [String, nil]
|
||||
# Module name.
|
||||
def get_module_name(source_path)
|
||||
if File.exist?(source_path)
|
||||
if File.binread(source_path) =~ /^\s*module\s(\S*);/
|
||||
return $1
|
||||
end
|
||||
name = File.basename(source_path).sub(/\.d$/, "")
|
||||
if name =~ /^\w+$/
|
||||
return name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Return a list of paths matching the specified pattern(s).
|
||||
#
|
||||
# A pattern can contain a "/**" component to recurse through directories.
|
||||
# If the pattern ends with "/**" then only the recursive list of
|
||||
# directories will be returned.
|
||||
#
|
||||
# Examples:
|
||||
# - "src/**": return all directories under "src", recursively (including
|
||||
# "src" itself).
|
||||
# - "src/**/*": return all files and directories recursively under the src
|
||||
# directory.
|
||||
# - "src/**/*.c": return all .c files recursively under the src directory.
|
||||
# - "dir/*/": return all directories in dir, but no files.
|
||||
#
|
||||
# @return [Array<String>] Paths matching the specified pattern(s).
|
||||
def glob(*patterns)
|
||||
require "pathname"
|
||||
patterns.reduce([]) do |result, pattern|
|
||||
if pattern.end_with?("/**")
|
||||
pattern += "/"
|
||||
end
|
||||
result += Dir.glob(pattern).map do |path|
|
||||
Pathname.new(path.gsub("\\", "/")).cleanpath.to_s
|
||||
end
|
||||
end.sort
|
||||
end
|
||||
|
||||
# Make a relative path corresponding to a possibly absolute one.
|
||||
#
|
||||
# @param path [String]
|
||||
|
||||
@ -671,9 +671,9 @@ EOF
|
||||
result = run_rscons
|
||||
expect(result.stderr).to eq ""
|
||||
slines = lines(result.stdout)
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/src/main.d.o .* src/main.d}])
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/src/mod.d.o .* src/mod.d}])
|
||||
verify_lines(slines, [%r{gdc -o hello-d.exe build/o/src/main.d.o build/o/src/mod.d.o}])
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/main.d.o -MMD -MF build/o/main.d.o.mf main.d}])
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/mod.d.o -MMD -MF build/o/mod.d.o.mf mod.d}])
|
||||
verify_lines(slines, [%r{gdc -o hello-d.exe build/o/main.d.o build/o/mod.d.o}])
|
||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
||||
end
|
||||
end
|
||||
@ -683,9 +683,9 @@ EOF
|
||||
result = run_rscons(args: %w[-f build-ldc2.rb])
|
||||
expect(result.stderr).to eq ""
|
||||
slines = lines(result.stdout)
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/src/main.d.o(bj)? -deps=build/o/src/main.d.o(bj)?.mf.* src/main.d}])
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/src/mod.d.o(bj)? -deps=build/o/src/mod.d.o(bj)?.mf.* src/mod.d}])
|
||||
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/o/src/main.d.o(bj)? build/o/src/mod.d.o(bj)?}])
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/main.d.o(bj)? -deps=build/o/main.d.o(bj)?.mf main.d}])
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/mod.d.o(bj)? -deps=build/o/mod.d.o(bj)?.mf mod.d}])
|
||||
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/o/main.d.o(bj)? build/o/mod.d.o(bj)?}])
|
||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
||||
end
|
||||
|
||||
@ -694,20 +694,20 @@ EOF
|
||||
result = run_rscons(args: %w[-f build-ldc2.rb])
|
||||
expect(result.stderr).to eq ""
|
||||
slines = lines(result.stdout)
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/src/main.d.o(bj)? -deps=build/o/src/main.d.o(bj)?.mf.* src/main.d}])
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/src/mod.d.o(bj)? -deps=build/o/src/mod.d.o(bj)?.mf.* src/mod.d}])
|
||||
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/o/src/main.d.o(bj)? build/o/src/mod.d.o(bj)?}])
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/main.d.o(bj)? -deps=build/o/main.d.o(bj)?.mf main.d}])
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/mod.d.o(bj)? -deps=build/o/mod.d.o(bj)?.mf mod.d}])
|
||||
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/o/main.d.o(bj)? build/o/mod.d.o(bj)?}])
|
||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
||||
contents = File.read("src/mod.d", mode: "rb").sub("42", "33")
|
||||
File.open("src/mod.d", "wb") do |fh|
|
||||
contents = File.read("mod.d", mode: "rb").sub("42", "33")
|
||||
File.open("mod.d", "wb") do |fh|
|
||||
fh.write(contents)
|
||||
end
|
||||
result = run_rscons(args: %w[-f build-ldc2.rb])
|
||||
expect(result.stderr).to eq ""
|
||||
slines = lines(result.stdout)
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/src/main.d.o(bj)? -deps=build/o/src/main.d.o(bj)?.mf.* src/main.d}])
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/src/mod.d.o(bj)? -deps=build/o/src/mod.d.o(bj)?.mf.* src/mod.d}])
|
||||
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/o/src/main.d.o(bj)? build/o/src/mod.d.o(bj)?}])
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/main.d.o(bj)? -deps=build/o/main.d.o(bj)?.mf main.d}])
|
||||
verify_lines(slines, [%r{ldc2 -c -of build/o/mod.d.o(bj)? -deps=build/o/mod.d.o(bj)?.mf mod.d}])
|
||||
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/o/main.d.o(bj)? build/o/mod.d.o(bj)?}])
|
||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 33!"
|
||||
end
|
||||
|
||||
@ -726,18 +726,18 @@ EOF
|
||||
result = run_rscons
|
||||
expect(result.stderr).to eq ""
|
||||
slines = lines(result.stdout)
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/src/main.d.o -MMD -MF build/o/src/main.d.o.mf.* src/main.d}])
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/src/mod.d.o -MMD -MF build/o/src/mod.d.o.mf.* src/mod.d}])
|
||||
verify_lines(slines, [%r{gdc -o hello-d.exe build/o/src/main.d.o build/o/src/mod.d.o}])
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/main.d.o -MMD -MF build/o/main.d.o.mf main.d}])
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/mod.d.o -MMD -MF build/o/mod.d.o.mf mod.d}])
|
||||
verify_lines(slines, [%r{gdc -o hello-d.exe build/o/main.d.o build/o/mod.d.o}])
|
||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
||||
fcontents = File.read("src/mod.d", mode: "rb").sub("42", "33")
|
||||
File.open("src/mod.d", "wb") {|fh| fh.write(fcontents)}
|
||||
fcontents = File.read("mod.d", mode: "rb").sub("42", "33")
|
||||
File.open("mod.d", "wb") {|fh| fh.write(fcontents)}
|
||||
result = run_rscons
|
||||
expect(result.stderr).to eq ""
|
||||
slines = lines(result.stdout)
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/src/main.d.o -MMD -MF build/o/src/main.d.o.mf.* src/main.d}])
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/src/mod.d.o -MMD -MF build/o/src/mod.d.o.mf.* src/mod.d}])
|
||||
verify_lines(slines, [%r{gdc -o hello-d.exe build/o/src/main.d.o build/o/src/mod.d.o}])
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/main.d.o -MMD -MF build/o/main.d.o.mf main.d}])
|
||||
verify_lines(slines, [%r{gdc -c -o build/o/mod.d.o -MMD -MF build/o/mod.d.o.mf mod.d}])
|
||||
verify_lines(slines, [%r{gdc -o hello-d.exe build/o/main.d.o build/o/mod.d.o}])
|
||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 33!"
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user