Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
d5c1a4b41a | |||
3f63bf5d13 | |||
ce47bd3599 | |||
|
68cab5e24d | ||
|
f92dd62ebd |
@ -1,5 +1,12 @@
|
|||||||
## ChangeLog
|
## ChangeLog
|
||||||
|
|
||||||
|
### v1.17.0
|
||||||
|
|
||||||
|
#### New Features
|
||||||
|
|
||||||
|
- allow construction variable expansion on `true` and `false` values.
|
||||||
|
- remove makefile target name check when parsing dependencies
|
||||||
|
|
||||||
### v1.16.0
|
### v1.16.0
|
||||||
|
|
||||||
#### New Features
|
#### New Features
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
rscons (1.16.0)
|
rscons (1.17.0)
|
||||||
json (>= 1.8, < 3.0)
|
json (>= 1.8, < 3.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
@ -45,4 +45,4 @@ DEPENDENCIES
|
|||||||
yard
|
yard
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.16.2
|
1.16.6
|
||||||
|
@ -30,7 +30,7 @@ module Rscons
|
|||||||
'ASSUFFIX' => ['.S'],
|
'ASSUFFIX' => ['.S'],
|
||||||
'ASPPPATH' => '${CPPPATH}',
|
'ASPPPATH' => '${CPPPATH}',
|
||||||
'ASPPFLAGS' => '${CPPFLAGS}',
|
'ASPPFLAGS' => '${CPPFLAGS}',
|
||||||
'ASDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}', '-MT', 'TARGET'],
|
'ASDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
||||||
'ASCMD' => ['${AS}', '-c', '-o', '${_TARGET}', '${ASDEPGEN}', '${INCPREFIX}${ASPPPATH}', '${ASPPFLAGS}', '${ASFLAGS}', '${_SOURCES}'],
|
'ASCMD' => ['${AS}', '-c', '-o', '${_TARGET}', '${ASDEPGEN}', '${INCPREFIX}${ASPPPATH}', '${ASPPFLAGS}', '${ASFLAGS}', '${_SOURCES}'],
|
||||||
|
|
||||||
'CPPFLAGS' => ['${CPPDEFPREFIX}${CPPDEFINES}'],
|
'CPPFLAGS' => ['${CPPDEFPREFIX}${CPPDEFINES}'],
|
||||||
@ -42,19 +42,19 @@ module Rscons
|
|||||||
'CC' => 'gcc',
|
'CC' => 'gcc',
|
||||||
'CFLAGS' => [],
|
'CFLAGS' => [],
|
||||||
'CSUFFIX' => ['.c'],
|
'CSUFFIX' => ['.c'],
|
||||||
'CCDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}', '-MT', 'TARGET'],
|
'CCDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
||||||
'CCCMD' => ['${CC}', '-c', '-o', '${_TARGET}', '${CCDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${CFLAGS}', '${CCFLAGS}', '${_SOURCES}'],
|
'CCCMD' => ['${CC}', '-c', '-o', '${_TARGET}', '${CCDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${CFLAGS}', '${CCFLAGS}', '${_SOURCES}'],
|
||||||
|
|
||||||
'CXX' => 'g++',
|
'CXX' => 'g++',
|
||||||
'CXXFLAGS' => [],
|
'CXXFLAGS' => [],
|
||||||
'CXXSUFFIX' => ['.cc', '.cpp', '.cxx', '.C'],
|
'CXXSUFFIX' => ['.cc', '.cpp', '.cxx', '.C'],
|
||||||
'CXXDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}', '-MT', 'TARGET'],
|
'CXXDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
||||||
'CXXCMD' =>['${CXX}', '-c', '-o', '${_TARGET}', '${CXXDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${CXXFLAGS}', '${CCFLAGS}', '${_SOURCES}'],
|
'CXXCMD' =>['${CXX}', '-c', '-o', '${_TARGET}', '${CXXDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${CXXFLAGS}', '${CCFLAGS}', '${_SOURCES}'],
|
||||||
|
|
||||||
'DC' => 'gdc',
|
'DC' => 'gdc',
|
||||||
'DFLAGS' => [],
|
'DFLAGS' => [],
|
||||||
'DSUFFIX' => ['.d'],
|
'DSUFFIX' => ['.d'],
|
||||||
'DDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}', '-MT', 'TARGET'],
|
'DDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
||||||
'D_IMPORT_PATH' => [],
|
'D_IMPORT_PATH' => [],
|
||||||
'DCCMD' => ['${DC}', '-c', '-o', '${_TARGET}', '${DDEPGEN}', '${INCPREFIX}${D_IMPORT_PATH}', '${DFLAGS}', '${_SOURCES}'],
|
'DCCMD' => ['${DC}', '-c', '-o', '${_TARGET}', '${DDEPGEN}', '${INCPREFIX}${D_IMPORT_PATH}', '${DFLAGS}', '${_SOURCES}'],
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ module Rscons
|
|||||||
if options[:command_status]
|
if options[:command_status]
|
||||||
target, deps, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
target, deps, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||||
if File.exists?(vars['_DEPFILE'])
|
if File.exists?(vars['_DEPFILE'])
|
||||||
deps += Environment.parse_makefile_deps(vars['_DEPFILE'], 'TARGET')
|
deps += Environment.parse_makefile_deps(vars['_DEPFILE'])
|
||||||
FileUtils.rm_f(vars['_DEPFILE'])
|
FileUtils.rm_f(vars['_DEPFILE'])
|
||||||
end
|
end
|
||||||
cache.register_build(target, options[:tc].command, deps.uniq, env)
|
cache.register_build(target, options[:tc].command, deps.uniq, env)
|
||||||
|
@ -55,7 +55,7 @@ module Rscons
|
|||||||
if options[:command_status]
|
if options[:command_status]
|
||||||
target, deps, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
target, deps, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||||
if File.exists?(vars['_DEPFILE'])
|
if File.exists?(vars['_DEPFILE'])
|
||||||
deps += Environment.parse_makefile_deps(vars['_DEPFILE'], nil)
|
deps += Environment.parse_makefile_deps(vars['_DEPFILE'])
|
||||||
FileUtils.rm_f(vars['_DEPFILE'])
|
FileUtils.rm_f(vars['_DEPFILE'])
|
||||||
end
|
end
|
||||||
cache.register_build(target, options[:tc].command, deps.uniq, env)
|
cache.register_build(target, options[:tc].command, deps.uniq, env)
|
||||||
|
@ -100,7 +100,7 @@ module Rscons
|
|||||||
if options[:command_status]
|
if options[:command_status]
|
||||||
target, deps, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
target, deps, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||||
if File.exists?(vars['_DEPFILE'])
|
if File.exists?(vars['_DEPFILE'])
|
||||||
deps += Environment.parse_makefile_deps(vars['_DEPFILE'], 'TARGET')
|
deps += Environment.parse_makefile_deps(vars['_DEPFILE'])
|
||||||
FileUtils.rm_f(vars['_DEPFILE'])
|
FileUtils.rm_f(vars['_DEPFILE'])
|
||||||
end
|
end
|
||||||
cache.register_build(target, options[:tc].command, deps.uniq, env)
|
cache.register_build(target, options[:tc].command, deps.uniq, env)
|
||||||
|
@ -385,12 +385,12 @@ module Rscons
|
|||||||
|
|
||||||
# Expand a construction variable reference.
|
# Expand a construction variable reference.
|
||||||
#
|
#
|
||||||
# @param varref [Array, String] Variable reference to expand.
|
# @param varref [nil, String, Array, Proc, Symbol, TrueClass, FalseClass] Variable reference to expand.
|
||||||
# @param extra_vars [Hash, VarSet]
|
# @param extra_vars [Hash, VarSet]
|
||||||
# Extra variables to use in addition to (or replace) the Environment's
|
# Extra variables to use in addition to (or replace) the Environment's
|
||||||
# construction variables when expanding the variable reference.
|
# construction variables when expanding the variable reference.
|
||||||
#
|
#
|
||||||
# @return [Array, String] Expansion of the variable reference.
|
# @return [nil, String, Array, Symbol, TrueClass, FalseClass] Expansion of the variable reference.
|
||||||
def expand_varref(varref, extra_vars = nil)
|
def expand_varref(varref, extra_vars = nil)
|
||||||
vars = if extra_vars.nil?
|
vars = if extra_vars.nil?
|
||||||
@varset
|
@varset
|
||||||
@ -1065,16 +1065,14 @@ module Rscons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Parse dependencies for a given target from a Makefile.
|
# Parse dependencies from a Makefile.
|
||||||
#
|
#
|
||||||
# This method is used internally by Rscons builders.
|
# This method is used internally by Rscons builders.
|
||||||
#
|
#
|
||||||
# @param mf_fname [String] File name of the Makefile to read.
|
# @param mf_fname [String] File name of the Makefile to read.
|
||||||
# @param target [String, nil]
|
|
||||||
# Name of the target to gather dependencies for, nil for any/all.
|
|
||||||
#
|
#
|
||||||
# @return [Array<String>] Paths of dependency files.
|
# @return [Array<String>] Paths of dependency files.
|
||||||
def self.parse_makefile_deps(mf_fname, target)
|
def self.parse_makefile_deps(mf_fname)
|
||||||
deps = []
|
deps = []
|
||||||
buildup = ''
|
buildup = ''
|
||||||
File.read(mf_fname).each_line do |line|
|
File.read(mf_fname).each_line do |line|
|
||||||
@ -1082,11 +1080,9 @@ module Rscons
|
|||||||
buildup += ' ' + $1
|
buildup += ' ' + $1
|
||||||
else
|
else
|
||||||
buildup += ' ' + line
|
buildup += ' ' + line
|
||||||
if buildup =~ /^(.*): (.*)$/
|
if buildup =~ /^.*: (.*)$/
|
||||||
mf_target, mf_deps = $1.strip, $2
|
mf_deps = $1
|
||||||
if target.nil? or mf_target == target
|
deps += mf_deps.split(' ').map(&:strip)
|
||||||
deps += mf_deps.split(' ').map(&:strip)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
buildup = ''
|
buildup = ''
|
||||||
end
|
end
|
||||||
|
@ -86,12 +86,12 @@ module Rscons
|
|||||||
# Replace "$!{var}" variable references in varref with the expanded
|
# Replace "$!{var}" variable references in varref with the expanded
|
||||||
# variables' values, recursively.
|
# variables' values, recursively.
|
||||||
#
|
#
|
||||||
# @param varref [nil, String, Array, Proc]
|
# @param varref [nil, String, Array, Proc, Symbol, TrueClass, FalseClass]
|
||||||
# Value containing references to variables.
|
# Value containing references to variables.
|
||||||
# @param lambda_args [Array]
|
# @param lambda_args [Array]
|
||||||
# Arguments to pass to any lambda variable values to be expanded.
|
# Arguments to pass to any lambda variable values to be expanded.
|
||||||
#
|
#
|
||||||
# @return [nil, String, Array]
|
# @return [nil, String, Array, Symbol, TrueClass, FalseClass]
|
||||||
# Expanded value with "$!{var}" variable references replaced.
|
# Expanded value with "$!{var}" variable references replaced.
|
||||||
def expand_varref(varref, lambda_args)
|
def expand_varref(varref, lambda_args)
|
||||||
if varref.is_a?(String)
|
if varref.is_a?(String)
|
||||||
@ -118,6 +118,10 @@ module Rscons
|
|||||||
nil
|
nil
|
||||||
elsif varref.is_a?(Symbol)
|
elsif varref.is_a?(Symbol)
|
||||||
varref
|
varref
|
||||||
|
elsif varref.is_a?(TrueClass)
|
||||||
|
varref
|
||||||
|
elsif varref.is_a?(FalseClass)
|
||||||
|
varref
|
||||||
else
|
else
|
||||||
raise "Unknown varref type: #{varref.class} (#{varref.inspect})"
|
raise "Unknown varref type: #{varref.class} (#{varref.inspect})"
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Rscons
|
module Rscons
|
||||||
# gem version
|
# gem version
|
||||||
VERSION = "1.16.0"
|
VERSION = "1.17.0"
|
||||||
end
|
end
|
||||||
|
@ -126,7 +126,7 @@ EOF
|
|||||||
result = run_test(rsconsfile: "command.rb")
|
result = run_test(rsconsfile: "command.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to eq [
|
expect(lines(result.stdout)).to eq [
|
||||||
'gcc -c -o build/simple.o -MMD -MF build/simple.mf -MT TARGET simple.c',
|
'gcc -c -o build/simple.o -MMD -MF build/simple.mf simple.c',
|
||||||
"gcc -o simple.exe build/simple.o",
|
"gcc -o simple.exe build/simple.o",
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@ -195,7 +195,7 @@ EOF
|
|||||||
result = run_test(rsconsfile: "command.rb")
|
result = run_test(rsconsfile: "command.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to eq [
|
expect(lines(result.stdout)).to eq [
|
||||||
'gcc -c -o build/simple.o -MMD -MF build/simple.mf -MT TARGET simple.c',
|
'gcc -c -o build/simple.o -MMD -MF build/simple.mf simple.c',
|
||||||
"gcc -o simple.exe build/simple.o",
|
"gcc -o simple.exe build/simple.o",
|
||||||
]
|
]
|
||||||
result = run_test(rsconsfile: "link_flag_change.rb")
|
result = run_test(rsconsfile: "link_flag_change.rb")
|
||||||
@ -250,8 +250,8 @@ EOF
|
|||||||
result = run_test(rsconsfile: "carat.rb")
|
result = run_test(rsconsfile: "carat.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(Set[*lines(result.stdout)]).to eq Set[
|
expect(Set[*lines(result.stdout)]).to eq Set[
|
||||||
%q{gcc -c -o build_root/one.o -MMD -MF build_root/one.mf -MT TARGET -Isrc -Isrc/one -Isrc/two build_root/one.c},
|
%q{gcc -c -o build_root/one.o -MMD -MF build_root/one.mf -Isrc -Isrc/one -Isrc/two build_root/one.c},
|
||||||
%q{gcc -c -o build_root/src/two/two.o -MMD -MF build_root/src/two/two.mf -MT TARGET -Isrc -Isrc/one -Isrc/two src/two/two.c},
|
%q{gcc -c -o build_root/src/two/two.o -MMD -MF build_root/src/two/two.mf -Isrc -Isrc/one -Isrc/two src/two/two.c},
|
||||||
%Q{gcc -o build_dir.exe build_root/src/two/two.o build_root/one.o},
|
%Q{gcc -o build_dir.exe build_root/src/two/two.o build_root/one.o},
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@ -330,9 +330,9 @@ EOF
|
|||||||
result = run_test
|
result = run_test
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(Set[*lines(result.stdout)]).to eq Set[
|
expect(Set[*lines(result.stdout)]).to eq Set[
|
||||||
%q{gcc -c -o debug/program.o -MMD -MF debug/program.mf -MT TARGET '-DSTRING="Debug Version"' -O2 src/program.c},
|
%q{gcc -c -o debug/program.o -MMD -MF debug/program.mf '-DSTRING="Debug Version"' -O2 src/program.c},
|
||||||
%Q{gcc -o program-debug.exe debug/program.o},
|
%Q{gcc -o program-debug.exe debug/program.o},
|
||||||
%q{gcc -c -o release/program.o -MMD -MF release/program.mf -MT TARGET '-DSTRING="Release Version"' -O2 src/program.c},
|
%q{gcc -c -o release/program.o -MMD -MF release/program.mf '-DSTRING="Release Version"' -O2 src/program.c},
|
||||||
%Q{gcc -o program-release.exe release/program.o},
|
%Q{gcc -o program-release.exe release/program.o},
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@ -342,7 +342,7 @@ EOF
|
|||||||
result = run_test(rsconsfile: "clone_all.rb")
|
result = run_test(rsconsfile: "clone_all.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to eq [
|
expect(lines(result.stdout)).to eq [
|
||||||
%q{gcc -c -o build/program.o -MMD -MF build/program.mf -MT TARGET -DSTRING="Hello" -O2 src/program.c},
|
%q{gcc -c -o build/program.o -MMD -MF build/program.mf -DSTRING="Hello" -O2 src/program.c},
|
||||||
%q{post build/program.o},
|
%q{post build/program.o},
|
||||||
%Q{gcc -o program.exe build/program.o},
|
%Q{gcc -o program.exe build/program.o},
|
||||||
%q{post program.exe},
|
%q{post program.exe},
|
||||||
@ -365,8 +365,8 @@ EOF
|
|||||||
result = run_test
|
result = run_test
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(Set[*lines(result.stdout)]).to eq Set[
|
expect(Set[*lines(result.stdout)]).to eq Set[
|
||||||
'gcc -c -o one.o -MMD -MF one.mf -MT TARGET -DONE one.c',
|
'gcc -c -o one.o -MMD -MF one.mf -DONE one.c',
|
||||||
'gcc -c -o build/two.o -MMD -MF build/two.mf -MT TARGET two.c',
|
'gcc -c -o build/two.o -MMD -MF build/two.mf two.c',
|
||||||
"gcc -o two_sources.exe one.o build/two.o",
|
"gcc -o two_sources.exe one.o build/two.o",
|
||||||
]
|
]
|
||||||
expect(File.exists?("two_sources.exe")).to be_truthy
|
expect(File.exists?("two_sources.exe")).to be_truthy
|
||||||
@ -378,10 +378,10 @@ EOF
|
|||||||
result = run_test
|
result = run_test
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(Set[*lines(result.stdout)]).to eq Set[
|
expect(Set[*lines(result.stdout)]).to eq Set[
|
||||||
'gcc -c -o build/one.o -MMD -MF build/one.mf -MT TARGET -Dmake_lib one.c',
|
'gcc -c -o build/one.o -MMD -MF build/one.mf -Dmake_lib one.c',
|
||||||
'gcc -c -o build/two.o -MMD -MF build/two.mf -MT TARGET -Dmake_lib two.c',
|
'gcc -c -o build/two.o -MMD -MF build/two.mf -Dmake_lib two.c',
|
||||||
'ar rcs lib.a build/one.o build/two.o',
|
'ar rcs lib.a build/one.o build/two.o',
|
||||||
'gcc -c -o build/three.o -MMD -MF build/three.mf -MT TARGET three.c',
|
'gcc -c -o build/three.o -MMD -MF build/three.mf three.c',
|
||||||
"gcc -o library.exe lib.a build/three.o",
|
"gcc -o library.exe lib.a build/three.o",
|
||||||
]
|
]
|
||||||
expect(File.exists?("library.exe")).to be_truthy
|
expect(File.exists?("library.exe")).to be_truthy
|
||||||
@ -393,8 +393,8 @@ EOF
|
|||||||
result = run_test(rsconsfile: "build_hooks.rb")
|
result = run_test(rsconsfile: "build_hooks.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(Set[*lines(result.stdout)]).to eq Set[
|
expect(Set[*lines(result.stdout)]).to eq Set[
|
||||||
'gcc -c -o build_one/one.o -MMD -MF build_one/one.mf -MT TARGET -Isrc/one -Isrc/two -O1 src/one/one.c',
|
'gcc -c -o build_one/one.o -MMD -MF build_one/one.mf -Isrc/one -Isrc/two -O1 src/one/one.c',
|
||||||
'gcc -c -o build_two/two.o -MMD -MF build_two/two.mf -MT TARGET -Isrc/one -Isrc/two -O2 src/two/two.c',
|
'gcc -c -o build_two/two.o -MMD -MF build_two/two.mf -Isrc/one -Isrc/two -O2 src/two/two.c',
|
||||||
'gcc -o build_hook.exe build_one/one.o build_two/two.o',
|
'gcc -o build_hook.exe build_one/one.o build_two/two.o',
|
||||||
]
|
]
|
||||||
expect(`./build_hook.exe`).to eq "Hello from two()\n"
|
expect(`./build_hook.exe`).to eq "Hello from two()\n"
|
||||||
@ -431,8 +431,8 @@ EOF
|
|||||||
result = run_test
|
result = run_test
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
expect(slines).to include("gdc -c -o build/main.o -MMD -MF build/main.mf -MT TARGET main.d")
|
expect(slines).to include("gdc -c -o build/main.o -MMD -MF build/main.mf main.d")
|
||||||
expect(slines).to include("gdc -c -o build/mod.o -MMD -MF build/mod.mf -MT TARGET mod.d")
|
expect(slines).to include("gdc -c -o build/mod.o -MMD -MF build/mod.mf mod.d")
|
||||||
expect(slines.last).to eq("gdc -o hello-d.exe build/main.o build/mod.o")
|
expect(slines.last).to eq("gdc -o hello-d.exe build/main.o build/mod.o")
|
||||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
||||||
end
|
end
|
||||||
@ -442,8 +442,8 @@ EOF
|
|||||||
result = run_test
|
result = run_test
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
expect(slines).to include("gdc -c -o build/main.o -MMD -MF build/main.mf -MT TARGET main.d")
|
expect(slines).to include("gdc -c -o build/main.o -MMD -MF build/main.mf main.d")
|
||||||
expect(slines).to include("gdc -c -o build/mod.o -MMD -MF build/mod.mf -MT TARGET mod.d")
|
expect(slines).to include("gdc -c -o build/mod.o -MMD -MF build/mod.mf mod.d")
|
||||||
expect(slines.last).to eq("gdc -o hello-d.exe build/main.o build/mod.o")
|
expect(slines.last).to eq("gdc -o hello-d.exe build/main.o build/mod.o")
|
||||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
||||||
fcontents = File.read("mod.d", mode: "rb").sub("42", "33")
|
fcontents = File.read("mod.d", mode: "rb").sub("42", "33")
|
||||||
@ -451,8 +451,8 @@ EOF
|
|||||||
result = run_test
|
result = run_test
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
expect(slines).to include("gdc -c -o build/main.o -MMD -MF build/main.mf -MT TARGET main.d")
|
expect(slines).to include("gdc -c -o build/main.o -MMD -MF build/main.mf main.d")
|
||||||
expect(slines).to include("gdc -c -o build/mod.o -MMD -MF build/mod.mf -MT TARGET mod.d")
|
expect(slines).to include("gdc -c -o build/mod.o -MMD -MF build/mod.mf mod.d")
|
||||||
expect(slines.last).to eq("gdc -o hello-d.exe build/main.o build/mod.o")
|
expect(slines.last).to eq("gdc -o hello-d.exe build/main.o build/mod.o")
|
||||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 33!"
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 33!"
|
||||||
end
|
end
|
||||||
@ -894,8 +894,8 @@ EOF
|
|||||||
result = run_test(rsconsfile: "backward_compatible_build_hooks.rb")
|
result = run_test(rsconsfile: "backward_compatible_build_hooks.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(Set[*lines(result.stdout)]).to eq Set[
|
expect(Set[*lines(result.stdout)]).to eq Set[
|
||||||
'gcc -c -o one.o -MMD -MF one.mf -MT TARGET -Isrc -Isrc/one -Isrc/two -O1 src/two/two.c',
|
'gcc -c -o one.o -MMD -MF one.mf -Isrc -Isrc/one -Isrc/two -O1 src/two/two.c',
|
||||||
'gcc -c -o two.o -MMD -MF two.mf -MT TARGET -Isrc -Isrc/one -Isrc/two -O2 src/two/two.c'
|
'gcc -c -o two.o -MMD -MF two.mf -Isrc -Isrc/one -Isrc/two -O2 src/two/two.c'
|
||||||
]
|
]
|
||||||
expect(File.exists?('one.o')).to be_truthy
|
expect(File.exists?('one.o')).to be_truthy
|
||||||
expect(File.exists?('two.o')).to be_truthy
|
expect(File.exists?('two.o')).to be_truthy
|
||||||
@ -1354,7 +1354,7 @@ EOF
|
|||||||
result = run_test(rsconsfile: "override_depfilesuffix.rb")
|
result = run_test(rsconsfile: "override_depfilesuffix.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to eq [
|
expect(lines(result.stdout)).to eq [
|
||||||
"gcc -c -o simple.o -MMD -MF simple.deppy -MT TARGET simple.c",
|
"gcc -c -o simple.o -MMD -MF simple.deppy simple.c",
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ module Rscons
|
|||||||
expect(File).to receive(:read).with('makefile').and_return(<<EOS)
|
expect(File).to receive(:read).with('makefile').and_return(<<EOS)
|
||||||
module.o: source.cc
|
module.o: source.cc
|
||||||
EOS
|
EOS
|
||||||
expect(Environment.parse_makefile_deps('makefile', 'module.o')).to eq ['source.cc']
|
expect(Environment.parse_makefile_deps('makefile')).to eq ['source.cc']
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'handles dependencies split across many lines' do
|
it 'handles dependencies split across many lines' do
|
||||||
@ -338,7 +338,7 @@ module.o: module.c \\
|
|||||||
module.h \\
|
module.h \\
|
||||||
other.h
|
other.h
|
||||||
EOS
|
EOS
|
||||||
expect(Environment.parse_makefile_deps('makefile', 'module.o')).to eq [
|
expect(Environment.parse_makefile_deps('makefile')).to eq [
|
||||||
'module.c', 'module.h', 'other.h']
|
'module.c', 'module.h', 'other.h']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -159,6 +159,12 @@ module Rscons
|
|||||||
it "calls a lambda with the given lambda arguments" do
|
it "calls a lambda with the given lambda arguments" do
|
||||||
expect(v.expand_varref("${lambda}", [v: "fez"])).to eq("fez--12")
|
expect(v.expand_varref("${lambda}", [v: "fez"])).to eq("fez--12")
|
||||||
end
|
end
|
||||||
|
it "returns true when passed true" do
|
||||||
|
expect(v.expand_varref(true, :lambda_args)).to eq(true)
|
||||||
|
end
|
||||||
|
it "returns false when passed false" do
|
||||||
|
expect(v.expand_varref(false, :lambda_args)).to eq(false)
|
||||||
|
end
|
||||||
it "raises an error when given an invalid argument" do
|
it "raises an error when given an invalid argument" do
|
||||||
expect { v.expand_varref({a: :b}, :lambda_args) }.to raise_error /Unknown varref type: Hash/
|
expect { v.expand_varref({a: :b}, :lambda_args) }.to raise_error /Unknown varref type: Hash/
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user