Store configure task parameters in configuration cache data - close #151
This commit is contained in:
1 parent
7e5c6e6b12
commit
5b6353395d
10 files changed
+102
-8
No files matched your search
@@ -31,7 +31,6 @@ module Rscons
|
||||
|
||||
# Create Application instance.
|
||||
def _initialize
|
||||
@script = Script.new
|
||||
@silent_configure = true
|
||||
@build_dir = ENV["RSCONS_BUILD_DIR"] || "build"
|
||||
ENV.delete("RSCONS_BUILD_DIR")
|
||||
@@ -55,6 +54,7 @@ module Rscons
|
||||
# Process exit code (0 on success).
|
||||
def run(rsconscript, tasks_and_params, show_tasks)
|
||||
Cache.instance["failed_commands"] = []
|
||||
@script = Script.new
|
||||
@script.load(rsconscript)
|
||||
if show_tasks
|
||||
show_script_tasks
|
||||
|
||||
@@ -12,6 +12,7 @@ module Rscons
|
||||
def initialize(options = {})
|
||||
@varset = VarSet.new(Rscons::DEFAULT_CONSTRUCTION_VARIABLES)
|
||||
load_configuration_data!(options)
|
||||
load_task_param_variables!
|
||||
end
|
||||
|
||||
# Access the value of a construction variable.
|
||||
@@ -271,5 +272,14 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
# Load task parameters as construction variables.
|
||||
def load_task_param_variables!
|
||||
Task[].each do |task_name, task|
|
||||
task.param_values.each do |param_name, param_value|
|
||||
self["#{task.name}:#{param_name}"] = param_value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -44,6 +44,7 @@ module Rscons
|
||||
@log_fh = nil
|
||||
cache = Cache.instance
|
||||
cache["configuration_data"]["configured"] = success
|
||||
cache["configuration_data"]["params"] = Task["configure"].param_values
|
||||
cache.write
|
||||
end
|
||||
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ module Rscons
|
||||
unless param
|
||||
raise RsconsError.new("Could not find parameter '#{param_name}'")
|
||||
end
|
||||
param.value
|
||||
@param_values[param_name]
|
||||
end
|
||||
|
||||
# Execute a task's actions.
|
||||
|
||||
@@ -206,6 +206,11 @@ module Rscons
|
||||
else
|
||||
task = Task.new(name, options, &block)
|
||||
end
|
||||
if name == "configure"
|
||||
if configuration_params = Cache.instance["configuration_data"]["params"]
|
||||
task.param_values.merge!(configuration_params)
|
||||
end
|
||||
end
|
||||
task
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user