LegacyBuild

=title class Zef::Service::Shell::LegacyBuild
=subtitle A raku based implementation of the Builder interface

Synopsis

    use Zef;
    use Zef::Service::Shell::LegacyBuild;
    my $builder = Zef::Service::Shell::LegacyBuild.new;
    # Add logging if we want to see output
    my $stdout = Supplier.new;
    my $stderr = Supplier.new;
    $stdout.Supply.tap: { say $_ };
    $stderr.Supply.tap: { note $_ };
    # Assuming our current directory is a raku distribution with a
    # Build.rakumod and has no dependencies (or all dependencies
    # already installed)...
    my $dist-to-build = Zef::Distribution::Local.new($*CWD);
    my Str @includes = $*CWD.absolute;
    my $built-ok = so $builder.build($dist-to-build, :@includes, :$stdout, :$stderr);
    say $built-ok ?? "OK" !! "Something went wrong";

Description

Builder class for handling local distributions that include a .rakumod / .pm6 / .pm alongside their META6.json. Launches an e.g. 'Build.rakumod' file of the provided distribution with the raku executable.

Note: These type of build files will be deprecated one day in the (possibly far) future. Prefer build tools like Distribution::Builder::MakeFromJSON (which uses Zef::Service::Shell::DistributionBuilder) if possible.

Methods

method probe

method probe(--> Bool:D)

Returns True if this module can successfully launch the raku command (i.e. always returns True).

method build-matcher

method build-matcher(Zef::Distribution::Local $dist --> Bool:D)

Returns True if this module knows how to test $uri, which it decides based on if the files extracted from $dist contains any of Build.rakumod Build.pm6 or Build.pm (must be extracted as these do not get declared in a META6.json file).

method build

method build(Zef::Distribution::Local $dist, Str :@includes, Supplier :$stdout, Supplier :$stderr --> Bool:D)

Launch the e.g. Build.rakumod module in the root directory of an extracted $dist using the provided @includes (e.g. /foo/bar or inst#/foo/bar) via the raku command (essentially doing ::(Build).new.build($dist-dir)). A Supplier can be supplied as :$stdout and :$stderr to receive any output.

Returns True if the raku process spawned to run the build module exits 0.

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.