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