Build

=title class Zef::Build
=subtitle A configurable implementation of the Builder interface

Synopsis

    use Zef;
    use Zef::Build;
    use Zef::Distribution::Local;
    # Setup with a single builder backend
    my $builder = Zef::Build.new(
        backends => [
            { module => "Zef::Service::Shell::LegacyBuild" },
        ],
    );
    # Assuming our current directory is a raku distribution with a Build.rakumod file...
    my $dist-to-build = Zef::Distribution::Local.new($*CWD);
    my $candidate     = Candidate.new(dist => $dist-to-build);
    my $logger        = Supplier.new andthen *.Supply.tap: -> $m { say $m.<message> }
    my $build-ok = so all $builder.build($candidate, :$logger);
    say $build-ok ?? "Build OK" !! "Something went wrong...";

Description

A Builder that uses 1 or more other Builder instances as backends. It abstracts the logic to do 'build this distribution with the first backend that supports the given distribution'.

Methods

method build-matcher

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

Returns True if any of the probeable self.plugins know how to build $dist.

method build

method build(Candidate $candi, Str :@includes, Supplier :$logger, Int :$timeout, :$meta --> Array[Bool])

Builds the distribution for $candi. For more info see Zef::Service::Shell::LegacyBuild and Zef::Service::Shell::DistributionBuilder since the build step process is coupled tightly to the backend used.

An optional :$logger can be supplied to receive events about what is occuring.

An optional :$timeout can be passed to denote the number of seconds after which we'll assume failure.

Returns an Array with some number of Bool (which depends on the backend used). If there are no False items in the returned Array then we assume success.

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