blib/lib/Alien/Build/Plugin/Build/Make.pm

filter: Statementstmt 86.3% 38 / 44 Branchbran 75.0% 12 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 10 / 12 Podpod 100% 1 / 1 totaltotal 79.4% 62 / 78 CC 11 SCAR 20.0
CC
11
Cov
81%
init
13.6
__ANON__
2.0
__ANON__
1.1
CRAP 7.4
« blib/lib/Alien/Build/Plugin/PkgConfig/PP.pm ↑ Summary blib/lib/Test/Alien/Run.pm »
1 package Alien::Build::Plugin::Build::Make;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use 5.008004;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Capture::Tiny qw( capture );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Alien::Build::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # ABSTRACT: Make plugin for Alien::Build
11 2 our $VERSION = '2.88'; # VERSION
12  
13  
14 2 has '+make_type' => undef;
15  
16 sub init
17 5 ▶{
Subroutine init: called CC=11 SCAR=26.1
Pod documented
18 5 my($self, $meta) = @_;
19  
20 5 $meta->add_requires('configure', 'Alien::Build::Plugin::Build::Make', '0.99');
21  
22 5 my $type = $self->make_type;
23  
24 5 ▶ return unless defined $type;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 0 5 5
25  
26 5 ▶ $type = 'gmake' if $^O eq 'MSWin32' && $type eq 'umake';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "MSWin32" and $type eq "umake" 0 5 5
Condition33%1/3
$^O eq "MSWin32" and $type eq "umake"
!ll&&!rl&&r
500
MC/DC0%0/2
$^O eq "MSWin32" and $type eq "umake"
$^O eq "MSWin32" $type eq "umake"
Truth table33%1/3
A and B
A= $^O eq "MSWin32"B= $type eq "umake"
ABresult
0X0
100
111
27  
28 5 ▶ if($type eq 'nmake')
Branch: 4 branches
BranchTrueFalseTotal
if ($type eq 'nmake') { } 1 4 5
elsif ($type eq 'dmake') { } 1 3 4
elsif ($type eq 'gmake') { } 2 1 3
elsif ($type eq 'umake') { } 1 0 1
29 {
30 1 ▶ $meta->interpolator->replace_helper( make => sub { 'nmake' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
31 }
32  
33 elsif($type eq 'dmake')
34 {
35 1 ▶ $meta->interpolator->replace_helper( make => sub { 'dmake' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
36 }
37  
38 elsif($type eq 'gmake')
39 {
40 2 my $found = 0;
41 2 foreach my $make (qw( gmake make mingw32-make ))
42 {
43 6 ▶ my($out, $err) = capture { system $make, '--version' };
Subroutine __ANON__: called CC=1 SCAR=0.0
44 6 ▶ if($out =~ /GNU Make/)
Branch: 1 branch
BranchTrueFalseTotal
if ($out =~ /GNU Make/) 4 2 6
45 {
46 0 ▶ $meta->interpolator->replace_helper( make => sub { $make } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
47 4 $found = 1;
48 }
49 }
50 2 ▶ unless($found)
Branch: 1 branch
BranchTrueFalseTotal
unless ($found) 0 2 2
51 {
52 0 $meta->add_requires('share' => 'Alien::gmake' => '0.20');
53 0 ▶ $meta->interpolator->replace_helper('make' => sub { require Alien::gmake; Alien::gmake->exe });
Subroutine __ANON__: not called CC=1 SCAR=6.9
54 }
55 }
56  
57 elsif($type eq 'umake')
58 {
59 # nothing
60 }
61  
62 else
63 {
64 0 Carp::croak("unknown make type = ", $self->make_type);
65 }
66 }
67  
68 2 1;
69  
70 __END__
« blib/lib/Alien/Build/Plugin/PkgConfig/PP.pm ↑ Summary blib/lib/Test/Alien/Run.pm »