add ThreadedCommand class

This commit is contained in:
Josh Holtrop 2017-05-15 10:57:34 -04:00
parent ef4f9882cd
commit 6b8fda706d
2 changed files with 32 additions and 0 deletions

View File

@ -3,6 +3,7 @@ require_relative "rscons/builder"
require_relative "rscons/cache" require_relative "rscons/cache"
require_relative "rscons/environment" require_relative "rscons/environment"
require_relative "rscons/job_set" require_relative "rscons/job_set"
require_relative "rscons/threaded_command"
require_relative "rscons/varset" require_relative "rscons/varset"
require_relative "rscons/version" require_relative "rscons/version"

View File

@ -0,0 +1,31 @@
module Rscons
# If a builder returns an instance of this class from its #run method, then
# Rscons will execute the command specified in a thread and allow other
# builders to continue executing in parallel.
class ThreadedCommand
# @return [Array<String>]
# The command to execute.
attr_reader :command
# @return [Object]
# Arbitrary object to store builder-specific info. This object value will
# be passed back into the builder's #finalize method.
attr_reader :builder_info
# Create a ThreadedCommand object.
#
# @param command [Array<String>]
# The command to execute.
# @param options [Hash]
# Optional parameters.
# @option options [Object] :builder_info
# Arbitrary object to store builder-specific info. This object value will
# be passed back into the builder's #finalize method.
def initialize(command, options = {})
@command = command
@builder_info = options[:builder_info]
end
end
end