raise error if user constructs an Environment before configuration is complete
This commit is contained in:
parent
3115e55739
commit
787b3249a7
@ -1,4 +1,3 @@
|
|||||||
Environment.new do |env|
|
Environment.new do |env|
|
||||||
env.Object("simple.o", "simple.cc")
|
env.Object("simple.o", "simple.cc")
|
||||||
env.process
|
|
||||||
end
|
end
|
@ -63,6 +63,9 @@ module Rscons
|
|||||||
# 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
|
||||||
# when the block returns, the {#process} method is automatically called.
|
# when the block returns, the {#process} method is automatically called.
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
|
unless Cache.instance["configuration_data"]["configured"]
|
||||||
|
raise "Project must be configured before creating an Environment"
|
||||||
|
end
|
||||||
super(options)
|
super(options)
|
||||||
@id = self.class.get_id
|
@id = self.class.get_id
|
||||||
self.class.register(self)
|
self.class.register(self)
|
||||||
@ -258,9 +261,6 @@ module Rscons
|
|||||||
#
|
#
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def process
|
def process
|
||||||
unless Cache.instance["configuration_data"]["configured"]
|
|
||||||
raise "Project must be configured before processing an Environment"
|
|
||||||
end
|
|
||||||
@process_failures = []
|
@process_failures = []
|
||||||
@process_blocking_wait = false
|
@process_blocking_wait = false
|
||||||
@process_commands_waiting_to_run = []
|
@process_commands_waiting_to_run = []
|
||||||
|
@ -2012,10 +2012,10 @@ EOF
|
|||||||
expect(result.status).to_not eq 0
|
expect(result.status).to_not eq 0
|
||||||
end
|
end
|
||||||
|
|
||||||
it "exits with an error if configuration has not been performed before attempting to process an environment" do
|
it "exits with an error if configuration has not been performed before attempting to create an environment" do
|
||||||
test_dir "configure"
|
test_dir "configure"
|
||||||
result = run_rscons(rsconscript: "error_env_process_before_configure.rb")
|
result = run_rscons(rsconscript: "error_env_construction_before_configure.rb")
|
||||||
expect(result.stderr).to match /Project must be configured before processing an Environment/
|
expect(result.stderr).to match /Project must be configured before creating an Environment/
|
||||||
expect(result.status).to_not eq 0
|
expect(result.status).to_not eq 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
module Rscons
|
module Rscons
|
||||||
describe Environment do
|
describe Environment do
|
||||||
|
before(:each) do
|
||||||
|
Cache.instance["configuration_data"] = {"configured" => true}
|
||||||
|
end
|
||||||
|
|
||||||
describe "#initialize" do
|
describe "#initialize" do
|
||||||
it "adds the default builders when they are not excluded" do
|
it "adds the default builders when they are not excluded" do
|
||||||
env = Environment.new
|
env = Environment.new
|
||||||
|
Loading…
x
Reference in New Issue
Block a user