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)
|
def run(operation, script)
|
||||||
@script = script
|
@script = script
|
||||||
case operation
|
case operation
|
||||||
|
when "build"
|
||||||
|
# TODO
|
||||||
|
0
|
||||||
when "clean"
|
when "clean"
|
||||||
clean
|
clean
|
||||||
when "configure"
|
when "configure"
|
||||||
configure
|
configure
|
||||||
|
else
|
||||||
|
$stderr.puts "Unknown operation: #{operation}"
|
||||||
|
1
|
||||||
end
|
end
|
||||||
0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -70,16 +75,24 @@ module Rscons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
cache.clear
|
cache.clear
|
||||||
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
# Configure the project.
|
# Configure the project.
|
||||||
#
|
#
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def configure
|
def configure
|
||||||
|
rv = 0
|
||||||
co = ConfigureOp.new("#{@build_dir}/configure")
|
co = ConfigureOp.new("#{@build_dir}/configure")
|
||||||
if ccc = @script.check_c_compiler
|
begin
|
||||||
co.check_c_compiler(ccc)
|
if ccc = @script.check_c_compiler
|
||||||
|
co.check_c_compiler(ccc)
|
||||||
|
end
|
||||||
|
rescue ConfigureOp::ConfigFailure
|
||||||
|
rv = 1
|
||||||
end
|
end
|
||||||
|
co.close
|
||||||
|
rv
|
||||||
end
|
end
|
||||||
|
|
||||||
# Determine the number of threads to use by default.
|
# Determine the number of threads to use by default.
|
||||||
|
@ -4,6 +4,9 @@ module Rscons
|
|||||||
# Class to manage a configure operation.
|
# Class to manage a configure operation.
|
||||||
class ConfigureOp
|
class ConfigureOp
|
||||||
|
|
||||||
|
# Exception raised when a configuration error occurs.
|
||||||
|
class ConfigFailure < Exception; end
|
||||||
|
|
||||||
# Create a ConfigureOp.
|
# Create a ConfigureOp.
|
||||||
#
|
#
|
||||||
# @param work_dir [String]
|
# @param work_dir [String]
|
||||||
@ -11,6 +14,15 @@ module Rscons
|
|||||||
def initialize(work_dir)
|
def initialize(work_dir)
|
||||||
@work_dir = work_dir
|
@work_dir = work_dir
|
||||||
FileUtils.mkdir_p(@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
|
end
|
||||||
|
|
||||||
# Check for a working C compiler.
|
# Check for a working C compiler.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user