Alien-Xrepo

 view release on metacpan or  search on metacpan

eg/examples/Exotic-SDL3/inc/MyBuilder.pm  view on Meta::CPAN

        my $snapshot = path( $self->xrepo_snapshot );
        if ( $self->_snapshot_stale($snapshot) ) {
            my $recipe = $self->_recipe;
            $snapshot->parent->mkpath;
            say "=> xrepo: writing $snapshot";
            Alien::Xrepo::Build->new( recipe => $recipe, snapshot => $snapshot, )->run;
        }
        else {
            $self->log_verbose("=> xrepo: $snapshot is up to date\n");
        }
        return $self->SUPER::ACTION_code;
    }
    sub _recipe ($self) { Exotic::SDL3->new->recipe }

    # Inputs whose freshness determines whether the snapshot needs regenerating.
    my @_xrepo_inputs = qw[Build.PL inc/MyBuilder.pm lib/Exotic/SDL3.pm];

    sub _snapshot_stale( $self, $snapshot ) {
        return 1 unless -e $snapshot;
        my $mtime = _mtime($snapshot);
        my $base  = path( $self->base_dir );

lib/Alien/Xrepo/MB.pm  view on Meta::CPAN

                recipe      => $dist->recipe,
                snapshot    => $snapshot,
                share_dir   => $share->stringify,
                cache       => $self->xrepo_cache,
                update_repo => $self->xrepo_update_repo
            )->run;
        }
        else {
            $self->log_verbose("=> xrepo: $snapshot is up to date\n");
        }
        return $self->SUPER::ACTION_code;
    }

    # The record of facts the two builders share: this dist root, the module, and the build script whose mtime counts as a freshness input.
    sub _dist ($self) {
        my $class = $self->module_name or die 'Alien::Xrepo::MB: module_name is required';
        return Alien::Xrepo::Build::Dist->new( base_dir => $self->base_dir, module_name => $class, script => 'Build.PL', );
    }

    # Engine modules that count as recipe inputs when loaded into this process.
    sub _engine_mods {qw[Alien/Xrepo/MB.pm Alien/Xrepo/Build.pm Alien/Xrepo/Runtime.pm Alien/Xrepo/Build/Recipe.pm]}

t/052_runtime.t  view on Meta::CPAN

}

# A spy that records the opts each fetch was called with, so recipe defaults
# flowing into dynamic resolution can be checked.
class Alien::Xrepo::Runtime::TestOpts : isa(Alien::Xrepo::Runtime::TestSpy) {
    field $seen = [];
    method seen {$seen}

    method fetch ( $name, $version, %opts ) {
        push @$seen, { name => $name, opts => {%opts} };
        $self->SUPER::fetch( $name, $version, %opts );
    }
}

# The single-source pattern: the whole dist description (name, packages,
# defaults, local_repos) lives in one subclass method.
class Alien::Xrepo::Runtime::TestFull : isa(Alien::Xrepo::Runtime) {

    method recipe {
        return {
            name        => 'Alien-TestFull',



( run in 3.269 seconds using v1.01-cache-2.11-cpan-54e63673c56 )