remove build_dir functionality - close #65
This commit is contained in:
1 parent
a1efb1c1b3
commit
432d221be2
22 files changed
+46
-157
No files matched your search
@@ -1,5 +0,0 @@
|
|||||||
Rscons::Environment.new do |env|
|
|
||||||
env.append('CPPPATH' => Rscons.glob('src/**'))
|
|
||||||
env.build_dir(%r{^src/([^/]+)/}, 'build_\\1/')
|
|
||||||
env.Program('build_dir.exe', Rscons.glob('src/**/*.c'))
|
|
||||||
end
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
env = Rscons::Environment.new do |env|
|
|
||||||
env.append('CPPPATH' => Rscons.glob('src/**/*/'))
|
|
||||||
env.build_dir("src", "build")
|
|
||||||
env.Program('build_dir.exe', Rscons.glob('src/**/*.c'))
|
|
||||||
end
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
Rscons::Environment.new do |env|
|
|
||||||
env.append('CPPPATH' => Rscons.glob('src/**'))
|
|
||||||
env.build_dir("src2", "build")
|
|
||||||
env.Program('build_dir.exe', Rscons.glob('src/**/*.c'))
|
|
||||||
end
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
Rscons::Environment.new do |env|
|
|
||||||
env.append("CPPPATH" => Rscons.glob("src/**"))
|
|
||||||
env.build_dir("src/one/", "build_one/")
|
|
||||||
env.build_dir("src/two", "build_two")
|
|
||||||
env.Program("build_dir.exe", Rscons.glob("src/**/*.c"))
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
debug = Rscons::Environment.new(echo: :command) do |env|
|
debug = Rscons::Environment.new(echo: :command) do |env|
|
||||||
env.build_dir('src', 'debug')
|
|
||||||
env['CFLAGS'] = '-O2'
|
env['CFLAGS'] = '-O2'
|
||||||
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
|
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
|
||||||
env.Program('program-debug.exe', Dir['src/*.c'])
|
env.Program('program-debug.exe', Dir['src/*.c'])
|
||||||
@@ -7,6 +6,5 @@ end
|
|||||||
|
|
||||||
release = debug.clone do |env|
|
release = debug.clone do |env|
|
||||||
env["CPPFLAGS"] = '-DSTRING="Release Version"'
|
env["CPPFLAGS"] = '-DSTRING="Release Version"'
|
||||||
env.build_dir('src', 'release')
|
|
||||||
env.Program('program-release.exe', Dir['src/*.c'])
|
env.Program('program-release.exe', Dir['src/*.c'])
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
env1 = Rscons::Environment.new(echo: :command) do |env|
|
env1 = Rscons::Environment.new(echo: :command) do |env|
|
||||||
env.build_dir('src', 'build')
|
|
||||||
env['CFLAGS'] = '-O2'
|
env['CFLAGS'] = '-O2'
|
||||||
env.add_build_hook do |build_op|
|
env.add_build_hook do |build_op|
|
||||||
build_op[:vars]['CPPFLAGS'] = '-DSTRING="Hello"'
|
build_op[:vars]['CPPFLAGS'] = '-DSTRING="Hello"'
|
||||||
|
|||||||
File renamed without changes.
@@ -1,10 +1,9 @@
|
|||||||
Rscons::Environment.new(echo: :command) do |env|
|
Rscons::Environment.new(echo: :command) do |env|
|
||||||
env.append('CPPPATH' => Rscons.glob('src/**/*/'))
|
env.append('CPPPATH' => Rscons.glob('src/**/*/'))
|
||||||
env.build_dir(%r{^src/([^/]+)/}, 'build_\\1/')
|
|
||||||
env.add_build_hook do |build_op|
|
env.add_build_hook do |build_op|
|
||||||
if build_op[:target] =~ %r{build_one/.*\.o}
|
if File.basename(build_op[:target]) == "one.o"
|
||||||
build_op[:vars]["CFLAGS"] << "-O1"
|
build_op[:vars]["CFLAGS"] << "-O1"
|
||||||
elsif build_op[:target] =~ %r{build_two/.*\.o}
|
elsif File.basename(build_op[:target]) == "two.o"
|
||||||
build_op[:vars]["CFLAGS"] << "-O2"
|
build_op[:vars]["CFLAGS"] << "-O2"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -3,5 +3,5 @@ Rscons::Environment.new(echo: :command) do |env|
|
|||||||
FileUtils.mkdir_p(env.build_root)
|
FileUtils.mkdir_p(env.build_root)
|
||||||
FileUtils.mv("src/one/one.c", env.build_root)
|
FileUtils.mv("src/one/one.c", env.build_root)
|
||||||
env.Object("^/one.o", "^/one.c")
|
env.Object("^/one.o", "^/one.c")
|
||||||
env.Program("build_dir.exe", Rscons.glob('src/**/*.c') + ["^/one.o"])
|
env.Program("program.exe", Rscons.glob('src/**/*.c') + ["^/one.o"])
|
||||||
end
|
end
|
||||||
File renamed without changes.
@@ -2,5 +2,5 @@ Rscons::Environment.new do |env|
|
|||||||
env["CSUFFIX"] = %w[.yargh .c]
|
env["CSUFFIX"] = %w[.yargh .c]
|
||||||
env["CFLAGS"] += %w[-x c]
|
env["CFLAGS"] += %w[-x c]
|
||||||
env["CPPPATH"] += Rscons.glob("src/**")
|
env["CPPPATH"] += Rscons.glob("src/**")
|
||||||
env.Program("build_dir.exe", Rscons.glob("src/**/*.{c,yargh}"))
|
env.Program("program.exe", Rscons.glob("src/**/*.{c,yargh}"))
|
||||||
end
|
end
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -68,7 +68,6 @@ module Rscons
|
|||||||
@job_set = JobSet.new(@registered_build_dependencies, @side_effects)
|
@job_set = JobSet.new(@registered_build_dependencies, @side_effects)
|
||||||
@user_deps = {}
|
@user_deps = {}
|
||||||
@builders = {}
|
@builders = {}
|
||||||
@build_dirs = []
|
|
||||||
@build_hooks = {pre: [], post: []}
|
@build_hooks = {pre: [], post: []}
|
||||||
unless options[:exclude_builders]
|
unless options[:exclude_builders]
|
||||||
DEFAULT_BUILDERS.each do |builder_class_name|
|
DEFAULT_BUILDERS.each do |builder_class_name|
|
||||||
@@ -98,7 +97,6 @@ module Rscons
|
|||||||
# following:
|
# following:
|
||||||
# - :variables to clone construction variables (on by default)
|
# - :variables to clone construction variables (on by default)
|
||||||
# - :builders to clone the builders (on by default)
|
# - :builders to clone the builders (on by default)
|
||||||
# - :build_dirs to clone the build directories (on by default)
|
|
||||||
# - :build_hooks to clone the build hooks (on by default)
|
# - :build_hooks to clone the build hooks (on by default)
|
||||||
#
|
#
|
||||||
# If a block is given, the Environment object is yielded to the block and
|
# If a block is given, the Environment object is yielded to the block and
|
||||||
@@ -109,7 +107,7 @@ module Rscons
|
|||||||
# @return [Environment] The newly created {Environment} object.
|
# @return [Environment] The newly created {Environment} object.
|
||||||
def clone(options = {})
|
def clone(options = {})
|
||||||
clone = options[:clone] || :all
|
clone = options[:clone] || :all
|
||||||
clone = Set[:variables, :builders, :build_dirs, :build_hooks] if clone == :all
|
clone = Set[:variables, :builders, :build_hooks] if clone == :all
|
||||||
clone = Set[] if clone == :none
|
clone = Set[] if clone == :none
|
||||||
clone = Set.new(clone) if clone.is_a?(Array)
|
clone = Set.new(clone) if clone.is_a?(Array)
|
||||||
clone.delete(:builders) if options[:exclude_builders]
|
clone.delete(:builders) if options[:exclude_builders]
|
||||||
@@ -122,11 +120,6 @@ module Rscons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
env.append(@varset) if clone.include?(:variables)
|
env.append(@varset) if clone.include?(:variables)
|
||||||
if clone.include?(:build_dirs)
|
|
||||||
@build_dirs.reverse.each do |src_dir, obj_dir|
|
|
||||||
env.build_dir(src_dir, obj_dir)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if clone.include?(:build_hooks)
|
if clone.include?(:build_hooks)
|
||||||
@build_hooks[:pre].each do |build_hook_block|
|
@build_hooks[:pre].each do |build_hook_block|
|
||||||
env.add_build_hook(&build_hook_block)
|
env.add_build_hook(&build_hook_block)
|
||||||
@@ -227,26 +220,6 @@ module Rscons
|
|||||||
@build_hooks[:post] << block
|
@build_hooks[:post] << block
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specify a build directory for this Environment.
|
|
||||||
#
|
|
||||||
# Source files from src_dir will produce object files under obj_dir.
|
|
||||||
#
|
|
||||||
# @param src_dir [String, Regexp]
|
|
||||||
# Path to the source directory. If a Regexp is given, it will be matched
|
|
||||||
# to source file names.
|
|
||||||
# @param obj_dir [String]
|
|
||||||
# Path to the object directory. If a Regexp is given as src_dir, then
|
|
||||||
# obj_dir can contain backreferences to groups matched from the source
|
|
||||||
# file name.
|
|
||||||
#
|
|
||||||
# @return [void]
|
|
||||||
def build_dir(src_dir, obj_dir)
|
|
||||||
if src_dir.is_a?(String)
|
|
||||||
src_dir = src_dir.gsub("\\", "/").sub(%r{/*$}, "")
|
|
||||||
end
|
|
||||||
@build_dirs.unshift([src_dir, obj_dir])
|
|
||||||
end
|
|
||||||
|
|
||||||
# Return the file name to be built from +source_fname+ with suffix
|
# Return the file name to be built from +source_fname+ with suffix
|
||||||
# +suffix+.
|
# +suffix+.
|
||||||
#
|
#
|
||||||
@@ -264,20 +237,9 @@ module Rscons
|
|||||||
# @return [String]
|
# @return [String]
|
||||||
# The file name to be built from +source_fname+ with suffix +suffix+.
|
# The file name to be built from +source_fname+ with suffix +suffix+.
|
||||||
def get_build_fname(source_fname, suffix, options = {})
|
def get_build_fname(source_fname, suffix, options = {})
|
||||||
build_fname = Rscons.set_suffix(source_fname, suffix).gsub('\\', '/')
|
|
||||||
options[:features] ||= []
|
options[:features] ||= []
|
||||||
extra_path = options[:features].include?("shared") ? "/_shared" : ""
|
extra_path = options[:features].include?("shared") ? "/_shared" : ""
|
||||||
found_match = @build_dirs.find do |src_dir, obj_dir|
|
"#{@build_root}#{extra_path}/#{Util.make_relative_path(Rscons.set_suffix(source_fname, suffix))}".gsub("\\", "/")
|
||||||
if src_dir.is_a?(Regexp)
|
|
||||||
build_fname.sub!(src_dir, "#{obj_dir}#{extra_path}")
|
|
||||||
else
|
|
||||||
build_fname.sub!(%r{^#{src_dir}/}, "#{obj_dir}#{extra_path}/")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
unless found_match
|
|
||||||
build_fname = "#{@build_root}#{extra_path}/#{Util.make_relative_path(build_fname)}"
|
|
||||||
end
|
|
||||||
build_fname.gsub('\\', '/')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get a construction variable's value.
|
# Get a construction variable's value.
|
||||||
|
|||||||
+40
-88
@@ -257,54 +257,14 @@ EOF
|
|||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'builds object files in a different build directory' do
|
|
||||||
test_dir('build_dir')
|
|
||||||
result = run_rscons
|
|
||||||
expect(result.stderr).to eq ""
|
|
||||||
expect(`./build_dir.exe`).to eq "Hello from two()\n"
|
|
||||||
expect(File.exists?('build_one/one.o')).to be_truthy
|
|
||||||
expect(File.exists?('build_two/two.o')).to be_truthy
|
|
||||||
end
|
|
||||||
|
|
||||||
it "supports trailing slashes at the end of build_dir sources and destinations" do
|
|
||||||
test_dir("build_dir")
|
|
||||||
result = run_rscons(rsconscript: "slashes.rb")
|
|
||||||
expect(result.stderr).to eq ""
|
|
||||||
expect(`./build_dir.exe`).to eq "Hello from two()\n"
|
|
||||||
expect(File.exists?("build_one/one.o")).to be_truthy
|
|
||||||
expect(File.exists?("build_two/two.o")).to be_truthy
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'uses build directories before build root' do
|
|
||||||
test_dir('build_dir')
|
|
||||||
result = run_rscons(rsconscript: "build_dirs_and_root.rb")
|
|
||||||
expect(result.stderr).to eq ""
|
|
||||||
expect(lines(result.stdout)).to include *[
|
|
||||||
"CC build/one/one.o",
|
|
||||||
"CC build/two/two.o",
|
|
||||||
"LD build_dir.exe",
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'uses build_root if no build directories match' do
|
|
||||||
test_dir('build_dir')
|
|
||||||
result = run_rscons(rsconscript: "no_match_build_dir.rb")
|
|
||||||
expect(result.stderr).to eq ""
|
|
||||||
expect(lines(result.stdout)).to include *[
|
|
||||||
"CC build/e.1/src/one/one.o",
|
|
||||||
"CC build/e.1/src/two/two.o",
|
|
||||||
"LD build_dir.exe",
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
it "expands target and source paths starting with ^/ to be relative to the build root" do
|
it "expands target and source paths starting with ^/ to be relative to the build root" do
|
||||||
test_dir('build_dir')
|
test_dir("typical")
|
||||||
result = run_rscons(rsconscript: "carat.rb")
|
result = run_rscons(rsconscript: "carat.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to include *[
|
expect(lines(result.stdout)).to include *[
|
||||||
%q{gcc -c -o build/e.1/one.o -MMD -MF build/e.1/one.mf -Isrc -Isrc/one -Isrc/two build/e.1/one.c},
|
%q{gcc -c -o build/e.1/one.o -MMD -MF build/e.1/one.mf -Isrc -Isrc/one -Isrc/two build/e.1/one.c},
|
||||||
%q{gcc -c -o build/e.1/src/two/two.o -MMD -MF build/e.1/src/two/two.mf -Isrc -Isrc/one -Isrc/two src/two/two.c},
|
%q{gcc -c -o build/e.1/src/two/two.o -MMD -MF build/e.1/src/two/two.mf -Isrc -Isrc/one -Isrc/two src/two/two.c},
|
||||||
%Q{gcc -o build_dir.exe build/e.1/src/two/two.o build/e.1/one.o},
|
%Q{gcc -o program.exe build/e.1/src/two/two.o build/e.1/one.o},
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -317,36 +277,28 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'cleans built files' do
|
it 'cleans built files' do
|
||||||
test_dir('build_dir')
|
test_dir("simple")
|
||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(`./build_dir.exe`).to eq "Hello from two()\n"
|
expect(`./simple.exe`).to match /This is a simple C program/
|
||||||
expect(File.exists?('build_one/one.o')).to be_truthy
|
expect(File.exists?('build/e.1/simple.o')).to be_truthy
|
||||||
expect(File.exists?('build_two/two.o')).to be_truthy
|
|
||||||
result = run_rscons(op: %w[clean])
|
result = run_rscons(op: %w[clean])
|
||||||
expect(File.exists?('build_one/one.o')).to be_falsey
|
expect(File.exists?('build/e.1/simple.o')).to be_falsey
|
||||||
expect(File.exists?('build_two/two.o')).to be_falsey
|
expect(File.exists?('build/e.1')).to be_falsey
|
||||||
expect(File.exists?('build_one')).to be_falsey
|
expect(File.exists?('simple.exe')).to be_falsey
|
||||||
expect(File.exists?('build_two')).to be_falsey
|
expect(File.exists?('simple.c')).to be_truthy
|
||||||
expect(File.exists?('build_dir.exe')).to be_falsey
|
|
||||||
expect(File.exists?('src/one/one.c')).to be_truthy
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not clean created directories if other non-rscons-generated files reside there' do
|
it 'does not clean created directories if other non-rscons-generated files reside there' do
|
||||||
test_dir('build_dir')
|
test_dir("simple")
|
||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(`./build_dir.exe`).to eq "Hello from two()\n"
|
expect(`./simple.exe`).to match /This is a simple C program/
|
||||||
expect(File.exists?('build_one/one.o')).to be_truthy
|
expect(File.exists?('build/e.1/simple.o')).to be_truthy
|
||||||
expect(File.exists?('build_two/two.o')).to be_truthy
|
File.open('build/e.1/dum', 'w') { |fh| fh.puts "dum" }
|
||||||
File.open('build_two/tmp', 'w') { |fh| fh.puts "dum" }
|
|
||||||
result = run_rscons(op: %w[clean])
|
result = run_rscons(op: %w[clean])
|
||||||
expect(File.exists?('build_one/one.o')).to be_falsey
|
expect(File.exists?('build/e.1')).to be_truthy
|
||||||
expect(File.exists?('build_two/two.o')).to be_falsey
|
expect(File.exists?('build/e.1/dum')).to be_truthy
|
||||||
expect(File.exists?('build_one')).to be_falsey
|
|
||||||
expect(File.exists?('build_two')).to be_truthy
|
|
||||||
expect(File.exists?('build_dir.exe')).to be_falsey
|
|
||||||
expect(File.exists?('src/one/one.c')).to be_truthy
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'allows Ruby classes as custom builders to be used to construct files' do
|
it 'allows Ruby classes as custom builders to be used to construct files' do
|
||||||
@@ -380,10 +332,10 @@ EOF
|
|||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to include *[
|
expect(lines(result.stdout)).to include *[
|
||||||
%q{gcc -c -o debug/program.o -MMD -MF debug/program.mf '-DSTRING="Debug Version"' -O2 src/program.c},
|
%q{gcc -c -o build/e.1/src/program.o -MMD -MF build/e.1/src/program.mf '-DSTRING="Debug Version"' -O2 src/program.c},
|
||||||
%Q{gcc -o program-debug.exe debug/program.o},
|
%Q{gcc -o program-debug.exe build/e.1/src/program.o},
|
||||||
%q{gcc -c -o release/program.o -MMD -MF release/program.mf '-DSTRING="Release Version"' -O2 src/program.c},
|
%q{gcc -c -o build/e.2/src/program.o -MMD -MF build/e.2/src/program.mf '-DSTRING="Release Version"' -O2 src/program.c},
|
||||||
%Q{gcc -o program-release.exe release/program.o},
|
%Q{gcc -o program-release.exe build/e.2/src/program.o},
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -392,12 +344,12 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "clone_all.rb")
|
result = run_rscons(rsconscript: "clone_all.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to include *[
|
expect(lines(result.stdout)).to include *[
|
||||||
%q{gcc -c -o build/program.o -MMD -MF build/program.mf -DSTRING="Hello" -O2 src/program.c},
|
%q{gcc -c -o build/e.1/src/program.o -MMD -MF build/e.1/src/program.mf -DSTRING="Hello" -O2 src/program.c},
|
||||||
%q{post build/program.o},
|
%q{post build/e.1/src/program.o},
|
||||||
%Q{gcc -o program.exe build/program.o},
|
%Q{gcc -o program.exe build/e.1/src/program.o},
|
||||||
%q{post program.exe},
|
%q{post program.exe},
|
||||||
%q{post build/program.o},
|
%q{post build/e.2/src/program.o},
|
||||||
%Q{gcc -o program2.exe build/program.o},
|
%Q{gcc -o program2.exe build/e.2/src/program.o},
|
||||||
%q{post program2.exe},
|
%q{post program2.exe},
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@@ -439,13 +391,13 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'supports build hooks to override construction variables' do
|
it 'supports build hooks to override construction variables' do
|
||||||
test_dir("build_dir")
|
test_dir("typical")
|
||||||
result = run_rscons(rsconscript: "build_hooks.rb")
|
result = run_rscons(rsconscript: "build_hooks.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to include *[
|
expect(lines(result.stdout)).to include *[
|
||||||
'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/e.1/src/one/one.o -MMD -MF build/e.1/src/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 -Isrc/one -Isrc/two -O2 src/two/two.c',
|
'gcc -c -o build/e.1/src/two/two.o -MMD -MF build/e.1/src/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/e.1/src/one/one.o build/e.1/src/two/two.o',
|
||||||
]
|
]
|
||||||
expect(`./build_hook.exe`).to eq "Hello from two()\n"
|
expect(`./build_hook.exe`).to eq "Hello from two()\n"
|
||||||
end
|
end
|
||||||
@@ -596,13 +548,13 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "supports multiple values for CSUFFIX" do
|
it "supports multiple values for CSUFFIX" do
|
||||||
test_dir("build_dir")
|
test_dir("typical")
|
||||||
FileUtils.mv("src/one/one.c", "src/one/one.yargh")
|
FileUtils.mv("src/one/one.c", "src/one/one.yargh")
|
||||||
result = run_rscons(rsconscript: "csuffix.rb")
|
result = run_rscons(rsconscript: "csuffix.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("build/e.1/src/one/one.o")).to be_truthy
|
expect(File.exists?("build/e.1/src/one/one.o")).to be_truthy
|
||||||
expect(File.exists?("build/e.1/src/two/two.o")).to be_truthy
|
expect(File.exists?("build/e.1/src/two/two.o")).to be_truthy
|
||||||
expect(`./build_dir.exe`).to eq "Hello from two()\n"
|
expect(`./program.exe`).to eq "Hello from two()\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports multiple values for OBJSUFFIX" do
|
it "supports multiple values for OBJSUFFIX" do
|
||||||
@@ -678,7 +630,7 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "supports registering multiple build targets with the same target path" do
|
it "supports registering multiple build targets with the same target path" do
|
||||||
test_dir("build_dir")
|
test_dir("typical")
|
||||||
result = run_rscons(rsconscript: "multiple_targets_same_name.rb")
|
result = run_rscons(rsconscript: "multiple_targets_same_name.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("one.o")).to be_truthy
|
expect(File.exists?("one.o")).to be_truthy
|
||||||
@@ -689,7 +641,7 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "expands target and source paths when builders are registered in build hooks" do
|
it "expands target and source paths when builders are registered in build hooks" do
|
||||||
test_dir("build_dir")
|
test_dir("typical")
|
||||||
result = run_rscons(rsconscript: "post_build_hook_expansion.rb")
|
result = run_rscons(rsconscript: "post_build_hook_expansion.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("one.o")).to be_truthy
|
expect(File.exists?("one.o")).to be_truthy
|
||||||
@@ -841,7 +793,7 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "prints a builder's short description with 'command' echo mode if there is no command" do
|
it "prints a builder's short description with 'command' echo mode if there is no command" do
|
||||||
test_dir("build_dir")
|
test_dir("typical")
|
||||||
|
|
||||||
result = run_rscons(rsconscript: "echo_command_ruby_builder.rb")
|
result = run_rscons(rsconscript: "echo_command_ruby_builder.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
@@ -849,7 +801,7 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "supports a string for a builder's echoed 'command' with Environment#print_builder_run_message" do
|
it "supports a string for a builder's echoed 'command' with Environment#print_builder_run_message" do
|
||||||
test_dir("build_dir")
|
test_dir("typical")
|
||||||
|
|
||||||
result = run_rscons(rsconscript: "echo_command_string.rb")
|
result = run_rscons(rsconscript: "echo_command_string.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
@@ -940,7 +892,7 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'supports build hooks to override construction variables' do
|
it 'supports build hooks to override construction variables' do
|
||||||
test_dir("build_dir")
|
test_dir("typical")
|
||||||
result = run_rscons(rsconscript: "backward_compatible_build_hooks.rb")
|
result = run_rscons(rsconscript: "backward_compatible_build_hooks.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to include *[
|
expect(lines(result.stdout)).to include *[
|
||||||
@@ -1031,7 +983,7 @@ EOF
|
|||||||
|
|
||||||
context "Install buildler" do
|
context "Install buildler" do
|
||||||
it "copies a file to the target file name" do
|
it "copies a file to the target file name" do
|
||||||
test_dir("build_dir")
|
test_dir("typical")
|
||||||
|
|
||||||
result = run_rscons(rsconscript: "install.rb")
|
result = run_rscons(rsconscript: "install.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
@@ -1051,7 +1003,7 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "operates the same as a Copy builder" do
|
it "operates the same as a Copy builder" do
|
||||||
test_dir("build_dir")
|
test_dir("typical")
|
||||||
|
|
||||||
result = run_rscons(rsconscript: "copy.rb")
|
result = run_rscons(rsconscript: "copy.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
@@ -1071,7 +1023,7 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "copies a file to the target directory name" do
|
it "copies a file to the target directory name" do
|
||||||
test_dir "build_dir"
|
test_dir("typical")
|
||||||
|
|
||||||
result = run_rscons(rsconscript: "install_directory.rb")
|
result = run_rscons(rsconscript: "install_directory.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
@@ -1085,7 +1037,7 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "copies a directory to the non-existent target directory name" do
|
it "copies a directory to the non-existent target directory name" do
|
||||||
test_dir "build_dir"
|
test_dir("typical")
|
||||||
result = run_rscons(rsconscript: "install_directory.rb")
|
result = run_rscons(rsconscript: "install_directory.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to include("Install noexist/src")
|
expect(lines(result.stdout)).to include("Install noexist/src")
|
||||||
@@ -1096,7 +1048,7 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "copies a directory to the existent target directory name" do
|
it "copies a directory to the existent target directory name" do
|
||||||
test_dir "build_dir"
|
test_dir("typical")
|
||||||
result = run_rscons(rsconscript: "install_directory.rb")
|
result = run_rscons(rsconscript: "install_directory.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(lines(result.stdout)).to include("Install exist/src")
|
expect(lines(result.stdout)).to include("Install exist/src")
|
||||||
|
|||||||
Reference in new issue
Block a user