Replace specialized Cache accessors with general #[]/#[]= methods.
This commit is contained in:
parent
68118c2707
commit
ab2fa1662f
@ -45,7 +45,7 @@ module Rscons
|
||||
@script = script
|
||||
case operation
|
||||
when "build"
|
||||
unless Cache.instance.configuration_data["configured"]
|
||||
unless Cache.instance["configuration_data"]["configured"]
|
||||
if @script.autoconf
|
||||
rv = configure(operation_options)
|
||||
if rv != 0
|
||||
@ -118,7 +118,7 @@ module Rscons
|
||||
# Exit code.
|
||||
def distclean
|
||||
cache = Cache.instance
|
||||
build_dir = cache.configuration_data["build_dir"]
|
||||
build_dir = cache["configuration_data"]["build_dir"]
|
||||
clean
|
||||
FileUtils.rm_rf(build_dir)
|
||||
cache.clear
|
||||
@ -137,7 +137,7 @@ module Rscons
|
||||
options[:build_dir] ||= "build"
|
||||
options[:prefix] ||= "/usr/local"
|
||||
cache = Cache.instance
|
||||
cache.configuration_data = {}
|
||||
cache["configuration_data"] = {}
|
||||
if project_name = @script.project_name
|
||||
Ansi.write($stdout, "Configuring ", :cyan, project_name, :reset, "...\n")
|
||||
else
|
||||
@ -153,9 +153,9 @@ module Rscons
|
||||
rv = 1
|
||||
end
|
||||
co.close
|
||||
cache.configuration_data["build_dir"] = options[:build_dir]
|
||||
cache.configuration_data["prefix"] = options[:prefix]
|
||||
cache.configuration_data["configured"] = rv == 0
|
||||
cache["configuration_data"]["build_dir"] = options[:build_dir]
|
||||
cache["configuration_data"]["prefix"] = options[:prefix]
|
||||
cache["configuration_data"]["configured"] = rv == 0
|
||||
cache.write
|
||||
rv
|
||||
end
|
||||
|
@ -193,7 +193,7 @@ module Rscons
|
||||
|
||||
# Load all construction variables saved from the configure operation.
|
||||
def load_configuration_data!(options)
|
||||
if vars = Cache.instance.configuration_data["vars"]
|
||||
if vars = Cache.instance["configuration_data"]["vars"]
|
||||
if default_vars = vars["_default_"]
|
||||
apply_configuration_data!(default_vars)
|
||||
end
|
||||
|
@ -70,6 +70,16 @@ module Rscons
|
||||
initialize!
|
||||
end
|
||||
|
||||
# Access cache value.
|
||||
def [](key)
|
||||
@cache[key]
|
||||
end
|
||||
|
||||
# Assign cache value.
|
||||
def []=(key, value)
|
||||
@cache[key] = value
|
||||
end
|
||||
|
||||
# Remove the cache file.
|
||||
#
|
||||
# @return [void]
|
||||
@ -85,19 +95,6 @@ module Rscons
|
||||
@lookup_checksums = {}
|
||||
end
|
||||
|
||||
# Access configuration data.
|
||||
def configuration_data
|
||||
@cache["configuration_data"]
|
||||
end
|
||||
|
||||
# Set configuration data.
|
||||
#
|
||||
# @param value [Hash]
|
||||
# Configuration data.
|
||||
def configuration_data=(value)
|
||||
@cache["configuration_data"] = value
|
||||
end
|
||||
|
||||
# Write the cache to disk.
|
||||
#
|
||||
# @return [void]
|
||||
|
@ -367,8 +367,8 @@ module Rscons
|
||||
"_default_"
|
||||
end
|
||||
cache = Cache.instance
|
||||
cache.configuration_data["vars"] ||= {}
|
||||
cache.configuration_data["vars"][usename] ||= {}
|
||||
cache["configuration_data"]["vars"] ||= {}
|
||||
cache["configuration_data"]["vars"][usename] ||= {}
|
||||
end
|
||||
|
||||
# Perform processing common to several configure checks.
|
||||
|
@ -90,7 +90,7 @@ module Rscons
|
||||
else
|
||||
:short
|
||||
end
|
||||
@build_root = "#{Cache.instance.configuration_data["build_dir"]}/e.#{@id}"
|
||||
@build_root = "#{Cache.instance["configuration_data"]["build_dir"]}/e.#{@id}"
|
||||
@n_threads = Rscons.application.n_threads
|
||||
|
||||
if block_given?
|
||||
@ -258,7 +258,7 @@ module Rscons
|
||||
#
|
||||
# @return [void]
|
||||
def process
|
||||
unless Cache.instance.configuration_data["configured"]
|
||||
unless Cache.instance["configuration_data"]["configured"]
|
||||
raise "Project must be configured before processing an Environment"
|
||||
end
|
||||
@process_failure = nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user