The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Build::Hopen::Gen - Base class for hopen generators

SYNOPSIS

The code that generates blueprints for specific build systems lives under Build::Hopen::Gen. Build::Hopen::Phase::Gen calls modules under Build::Hopen::Gen to create the blueprints. Those modules must implement the interface defined here.

ATTRIBUTES

proj_dir

(Required) A Path::Class::Dir instance specifying the root directory of the project.

dest_dir

(Required) A Path::Class::Dir instance specifying where the generated output (e.g., blueprint or other files) should be written.

FUNCTIONS

A generator (Build::Hopen::Gen subclass) is a Visitor.

Note: The generator does not have access to Build::Hopen::G::Link instances. That lack of access is the primary distinction between Ops and Links.

visit_goal

Do whatever the generator wants to do with a Build::Hopen::G::Goal. For example, the generator may change the goal's outputs. By default, no-op. Usage:

$generator->visit_goal($goal);

visit_node

Do whatever the generator wants to do with a Build::Hopen::G::Node that is not a Goal (see "visit_goal"). By default, no-op. Usage:

$generator->visit_node($node)

finalize

Do whatever the generator wants to do to finish up. By default, no-op. Is provided the Build::Hopen::G::DAG instance as a parameter. Usage:

$generator->finalize(-phase=>$Phase, -graph=>$dag)

default_toolset

Returns the package stem of the default toolset for this generator. Must be implemented by subclasses.

When a hopen file invokes use language "Foo", hopen will load Build::Hopen::T::<stem>::Foo, where <stem> is the return value of this function.

As a sanity check, hopen will first try to load Build::Hopen::T::<stem>, so make sure that is a valid package.

also_require

Returns the names of the packages, if any, that should be loaded along with this generator.

run_build

Runs the build tool for which this generator has created blueprint files.

BUILD

Enforces the required arguments.