allow configure to fail; application should return error code from operation
This commit is contained in:
parent
64caaa9a53
commit
c9de4f37e6
@ -43,12 +43,17 @@ module Rscons
|
||||
def run(operation, script)
|
||||
@script = script
|
||||
case operation
|
||||
when "build"
|
||||
# TODO
|
||||
0
|
||||
when "clean"
|
||||
clean
|
||||
when "configure"
|
||||
configure
|
||||
else
|
||||
$stderr.puts "Unknown operation: #{operation}"
|
||||
1
|
||||
end
|
||||
0
|
||||
end
|
||||
|
||||
private
|
||||
@ -70,16 +75,24 @@ module Rscons
|
||||
end
|
||||
end
|
||||
cache.clear
|
||||
0
|
||||
end
|
||||
|
||||
# Configure the project.
|
||||
#
|
||||
# @return [void]
|
||||
def configure
|
||||
rv = 0
|
||||
co = ConfigureOp.new("#{@build_dir}/configure")
|
||||
if ccc = @script.check_c_compiler
|
||||
co.check_c_compiler(ccc)
|
||||
begin
|
||||
if ccc = @script.check_c_compiler
|
||||
co.check_c_compiler(ccc)
|
||||
end
|
||||
rescue ConfigureOp::ConfigFailure
|
||||
rv = 1
|
||||
end
|
||||
co.close
|
||||
rv
|
||||
end
|
||||
|
||||
# Determine the number of threads to use by default.
|
||||
|
@ -4,6 +4,9 @@ module Rscons
|
||||
# Class to manage a configure operation.
|
||||
class ConfigureOp
|
||||
|
||||
# Exception raised when a configuration error occurs.
|
||||
class ConfigFailure < Exception; end
|
||||
|
||||
# Create a ConfigureOp.
|
||||
#
|
||||
# @param work_dir [String]
|
||||
@ -11,6 +14,15 @@ module Rscons
|
||||
def initialize(work_dir)
|
||||
@work_dir = work_dir
|
||||
FileUtils.mkdir_p(@work_dir)
|
||||
@log_fh = File.open("#{@work_dir}/config.log", "wb")
|
||||
end
|
||||
|
||||
# Close the log file handle.
|
||||
#
|
||||
# @return [void]
|
||||
def close
|
||||
@log_fh.close
|
||||
@log_fh = nil
|
||||
end
|
||||
|
||||
# Check for a working C compiler.
|
||||
|
Loading…
x
Reference in New Issue
Block a user