Avoid running configure operation twice - close #156

This commit is contained in:
Josh Holtrop 2022-03-11 21:17:07 -05:00
parent e3ea429253
commit b932380b3b
3 changed files with 25 additions and 8 deletions

View File

@ -0,0 +1,5 @@
configure do
check_c_compiler
end
env do |env|
end

View File

@ -207,15 +207,18 @@ module Rscons
# #
# @return [void] # @return [void]
def configure def configure
co = ConfigureOp.new(@script) unless @_configured
begin @_configured = true
@script.configure(co) co = ConfigureOp.new(@script)
rescue RsconsError => e begin
co.close(false) @script.configure(co)
raise e rescue RsconsError => e
co.close(false)
raise e
end
Cache.instance["configuration_data"]["enabled_variants"] = @enabled_variants
co.close(true)
end end
Cache.instance["configuration_data"]["enabled_variants"] = @enabled_variants
co.close(true)
end end
# Remove installed files. # Remove installed files.

View File

@ -1836,6 +1836,15 @@ EOF
expect(result.status).to_not eq 0 expect(result.status).to_not eq 0
end end
it "only runs the configure operation once" do
test_dir "configure"
result = run_rscons(args: %w[-f configure_with_top_level_env.rb configure])
expect(result.stderr).to eq ""
expect(result.status).to eq 0
expect(result.stdout).to_not match %r{Configuring project.*Configuring project}m
end
it "automatically runs the configure task if the project is not yet configured in the given build directory" do it "automatically runs the configure task if the project is not yet configured in the given build directory" do
test_dir "configure" test_dir "configure"