diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index b73ef35..b2f8f3a 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -6,7 +6,7 @@ module Rscons # contains a collection of construction variables, options, builders, and # rules for building targets. class Environment - # [Array] of {Builder} objects. + # [Hash] of {"builder_name" => builder_object} pairs. attr_reader :builders # Create an Environment object. @@ -53,7 +53,7 @@ module Rscons @builders.each do |builder_name, builder| env.add_builder(builder) end - env.append(@varset) + env.append(@varset.clone) env.append(variables) if block_given? diff --git a/spec/rscons/environment_spec.rb b/spec/rscons/environment_spec.rb index 2e0d6dc..a362a8c 100644 --- a/spec/rscons/environment_spec.rb +++ b/spec/rscons/environment_spec.rb @@ -1,5 +1,16 @@ module Rscons describe Environment do + describe '.clone' do + it 'should create unique copies of each construction variable' do + env = Environment.new + env["CPPPATH"] << "path1" + env2 = env.clone + env2["CPPPATH"] << "path2" + env["CPPPATH"].should == ["path1"] + env2["CPPPATH"].should == ["path1", "path2"] + end + end + describe '.parse_makefile_deps' do it 'handles dependencies on one line' do File.should_receive(:read).with('makefile').and_return(<