Class: Rscons::Builders::SimpleBuilder

Inherits:
Rscons::Builder show all
Defined in:
lib/rscons/builders/simple_builder.rb

Overview

A Generic builder class whose name and operation is defined at instantiation.

Since:

  • 1.8.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Rscons::Builder

#create_build_target, #default_variables, #features, #finalize, #produces?, #setup, #standard_build, #standard_finalize, #standard_threaded_build

Constructor Details

#initialize(name, &block) ⇒ SimpleBuilder

Create a new builder with the given name and action.

Parameters:

  • name (String, Symbol)

    The name of the builder when registered.

  • block (Block)

    The action to perform when the builder is processed. The provided block must return the target file on success or false on failure. The provided block should have the same signature as Rscons::Builder#run.

Since:

  • 1.8.0


18
19
20
21
# File 'lib/rscons/builders/simple_builder.rb', line 18

def initialize(name, &block)
  @name  = name.to_s
  @block = block
end

Instance Attribute Details

#nameString (readonly)

Returns The name of this builder.

Returns:

  • (String)

    The name of this builder.

Since:

  • 1.8.0


9
10
11
# File 'lib/rscons/builders/simple_builder.rb', line 9

def name
  @name
end

Instance Method Details

#run(target, sources, cache, env, vars) ⇒ String, false

Run the builder to produce a build target.

Parameters:

  • target (String)

    Target file name.

  • sources (Array<String>)

    Source file name(s).

  • cache (Cache)

    The Cache object.

  • env (Environment)

    The Environment executing the builder.

  • vars (Hash, VarSet)

    Extra construction variables.

Returns:

  • (String, false)

    Name of the target file on success or false on failure.

Since:

  • 1.8.0


33
34
35
# File 'lib/rscons/builders/simple_builder.rb', line 33

def run(target, sources, cache, env, vars)
  @block.call(target, sources, cache, env, vars)
end