diff --git a/build_tests/library/override_arcmd.rb b/build_tests/library/override_arcmd.rb new file mode 100644 index 0000000..29e39d3 --- /dev/null +++ b/build_tests/library/override_arcmd.rb @@ -0,0 +1,4 @@ +Rscons::Environment.new(echo: :command) do |env| + env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}] + env.Library("lib.a", Dir["*.c"].sort) +end diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index d60f406..b8e87c5 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -960,4 +960,13 @@ EOF expect(result.stderr).to match /unknown input file type: "foo.xyz"/ end end + + context "Library builder" do + it "allows overriding ARCMD construction variable" do + test_dir("library") + result = run_test(rsconsfile: "override_arcmd.rb") + expect(result.stderr).to eq "" + expect(lines(result.stdout)).to include "ar rcf lib.a one.o three.o two.o" + end + end end diff --git a/spec/rscons/builders/library_spec.rb b/spec/rscons/builders/library_spec.rb deleted file mode 100644 index 6885322..0000000 --- a/spec/rscons/builders/library_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Rscons - module Builders - describe Library do - let(:env) {Environment.new} - subject {Library.new} - - it "supports overriding AR construction variable" do - expect(subject).to receive(:standard_build).with("AR prog.a", "prog.a", ["sp-ar", "rcs", "prog.a", "prog.o"], ["prog.o"], env, :cache) - subject.run( - target: "prog.a", - sources: ["prog.o"], - cache: :cache, - env: env, - vars: {"AR" => "sp-ar"}) - end - - it "supports overriding ARCMD construction variable" do - expect(subject).to receive(:standard_build).with("AR prog.a", "prog.a", ["special", "AR!", "prog.o"], ["prog.o"], env, :cache) - subject.run( - target: "prog.a", - sources: ["prog.o"], - cache: :cache, - env: env, - vars: {"ARCMD" => ["special", "AR!", "${_SOURCES}"]}) - end - end - end -end