Add 'build' DSL method.

Disallow processing Environments until configuration is performed.
This commit is contained in:
josh committed 2018-12-17 22:14:35 -05:00
1 parent 5720662b7c
commit f8e6666a2c
90 files changed
+637 -434

No files matched your search

+1
View File
@@ -68,6 +68,7 @@ module Rscons
# Exit code.
def build(options)
begin
@script.build
Environment.environments.each do |env|
env.process
end
+11 -2
View File
@@ -15,6 +15,11 @@ module Rscons
# All Environments.
attr_reader :environments
# Initialize class instance variables.
def class_init
@environments = []
end
# Get an ID for a new Environment. This is a monotonically increasing
# integer.
#
@@ -77,8 +82,7 @@ module Rscons
end
end
@echo = options[:echo] || :short
# TODO: remove the || "build" below when autoconf is turned on for build test specs
@build_root = "#{Cache.instance.configuration_data["build_dir"] || "build"}/e.#{@id}"
@build_root = "#{Cache.instance.configuration_data["build_dir"]}/e.#{@id}"
load_configuration_data!
if block_given?
@@ -273,6 +277,9 @@ module Rscons
# @return [void]
def process
cache = Cache.instance
unless cache.configuration_data["configured"]
raise "Project must be configured before processing an Environment"
end
failure = nil
begin
while @job_set.size > 0 or @threaded_commands.size > 0
@@ -1083,4 +1090,6 @@ module Rscons
end
end
Environment.class_init
end
+12
View File
@@ -19,6 +19,11 @@ module Rscons
@script.autoconf = autoconf
end
# Enter build block.
def build(&block)
@script.operations["build"] = block
end
# Enter configuration block.
def configure(&block)
@script.operations["configure"] = block
@@ -81,6 +86,13 @@ module Rscons
Dsl.new(self).instance_eval(script_contents, path, 1)
end
# Perform build operation.
def build
if build_proc = @operations["build"]
build_proc.call
end
end
# Perform configure operation.
def configure(configure_op)
if operation_lambda = @operations["configure"]