Class: Rscons::Builders::SimpleBuilder

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

Overview

A Generic builder which has its operation is defined at instantiation.

Instance Attribute Summary collapse

Attributes inherited from Rscons::Builder

#build_step, #cache, #env, #preferred_ld, #side_effects, #sources, #target, #vars

Instance Method Summary collapse

Methods inherited from Rscons::Builder

#depends, extra_path, #finalize_command, name, #print_run_message, #produces, #register_command, #standard_command, #wait_for

Constructor Details

#initialize(name, options, &run_proc) ⇒ SimpleBuilder

Create an instance of the Builder to build a target.

Parameters:

  • name (String)

    User-provided builder name.

  • options (Hash)

    Options.

  • run_proc (Proc)

    A Proc to execute when the builder runs. The provided block must provide the have the same signature as Rscons::Builder#run.

Options Hash (options):

  • :target (String)

    Target file name.

  • :sources (Array<String>)

    Source file name(s).

  • :env (Environment)

    The Environment executing the builder.

  • :vars (Hash, VarSet)

    Extra construction variables.



27
28
29
30
31
# File 'lib/rscons/builders/simple_builder.rb', line 27

def initialize(name, options, &run_proc)
  @name = name
  super(options)
  @run_proc = run_proc
end

Instance Attribute Details

#nameString (readonly)

Returns User-provided builder name.

Returns:

  • (String)

    User-provided builder name.



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

def name
  @name
end

Instance Method Details

#run(*args) ⇒ Object

Run the builder to produce a build target.

Method signature described by Rscons::Builder#run.



36
37
38
# File 'lib/rscons/builders/simple_builder.rb', line 36

def run(*args)
  instance_exec(*args, &@run_proc)
end