File: Builder.pm

package info (click to toggle)
libcode-tidyall-plugin-clangformat-perl 0.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 152 kB
  • sloc: perl: 103; makefile: 2
file content (83 lines) | stat: -rw-r--r-- 1,815 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package Test::Run::Builder;

use strict;
use warnings;

use Module::Build;

use vars qw(@ISA);

@ISA = (qw(Module::Build));

sub ACTION_runtest
{
    my ($self) = @_;
    my $p = $self->{properties};

    $self->depends_on('code');

    local @INC = @INC;

    # Make sure we test the module in blib/
    unshift @INC,
        (
        File::Spec->catdir( $p->{base_dir}, $self->blib, 'lib' ),
        File::Spec->catdir( $p->{base_dir}, $self->blib, 'arch' )
        );

    $self->do_test_run_tests;
}

sub ACTION_distruntest
{
    my ($self) = @_;

    $self->depends_on('distdir');

    my $start_dir = $self->cwd;
    my $dist_dir  = $self->dist_dir;
    chdir $dist_dir or die "Cannot chdir to $dist_dir: $!";

    # XXX could be different names for scripts

    $self->run_perl_script(
        'Build.PL')    # XXX Should this be run w/ --nouse-rcfile
        or die "Error executing 'Build.PL' in dist directory: $!";
    $self->run_perl_script('Build')
        or die "Error executing 'Build' in dist directory: $!";
    $self->run_perl_script( 'Build', [], ['runtest'] )
        or die "Error executing 'Build test' in dist directory";
    chdir $start_dir;
}

sub do_test_run_tests
{
    my $self = shift;

    require Test::Run::CmdLine::Iface;

    my $test_run = Test::Run::CmdLine::Iface->new(
        {
            'test_files' => [ glob("t/*.t") ],
        }

        # 'backend_params' => $self->_get_backend_params(),
    );

    return $test_run->run();
}

sub ACTION_tags
{
    my $self = shift;
    return $self->do_system(
        "ctags",
        qw(-f tags --recurse --totals
            --exclude=blib/** --exclude=t/lib/**
            --exclude=**/.svn/** --exclude='*~'),
        "--exclude=" . $self->dist_name() . "-*/**",
        qw(--languages=Perl --langmap=Perl:+.t)
    );
}

1;