BuildTools/Base.pm

filter: Statementstmt 87.6% 57 / 65 Branchbran 59.0% 13 / 22 Conditioncond 66.6% 12 / 18 MC/DCmcdc 40.0% 4 / 10 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 1 totaltotal 76.1% 96 / 126 CC 23 SCAR 19.5
CC
23
Cov
78%
__ANON__
10.8
link
9.3
add_methods
6.6
CRAP 7.0
« Linker/XCOFF.pm ↑ Summary Linker/PE/MSVC.pm »
1 package ExtUtils::Builder::BuildTools::Base;
2 1 $ExtUtils::Builder::BuildTools::Base::VERSION = '0.038';
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  
6 2 ▶use parent 'ExtUtils::Builder::Planner::Extension';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use File::Spec::Functions 'catfile';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶sub add_methods {
Subroutine add_methods: called CC=6 SCAR=18.9
Pod undocumented
12 2 my ($class, $planner, %opts) = @_;
13  
14 2 ▶ $opts{type} //= 'executable';
Condition50%1/2
$opts{"type"} //= "executable"
l!l
20
MC/DC0%0/1
$opts{"type"} //= "executable"
$opts{"type"}
Truth table50%1/2
A
A= $opts{"type"}
Aresult
11
00
15  
16 2 ▶ my $compiler_as = delete $opts{compiler_as} // 'compile';
Condition50%1/2
delete $opts{"compiler_as"} // "compile"
l!l
02
MC/DC0%0/1
delete $opts{"compiler_as"} // "compile"
delete $opts{"compiler_as"}
Truth table50%1/2
A
A= delete $opts{"compiler_as"}
Aresult
11
00
17 2 ▶ $planner->add_delegate($compiler_as, sub {
Subroutine __ANON__: called CC=9 SCAR=23.8
18 2 my ($planner, $from, $to, %extra) = @_;
19 2 my %args = (%opts, %extra);
20  
21 2 my $compiler = $class->make_compiler(\%args);
22  
23 2 ▶ $args{profiles} = [ delete $args{profile} ] if $args{profile} and not $args{profiles};
Branch: 1 branch
BranchTrueFalseTotal
if $args{"profile"} and not $args{"profiles"} 1 1 2
Condition66%2/3
$args{"profile"} and not $args{"profiles"}
!ll&&!rl&&r
101
MC/DC50%1/2
$args{"profile"} and not $args{"profiles"}
$args{"profile"} not $args{"profiles"}
Truth table66%2/3
A and not(B)
A= $args{"profile"}B= not $args{"profiles"}
ABresult
0X0
100
111
24 2 ▶ for my $profile (@{ $args{profiles} // [] }) {
Condition100%2/2
$args{"profiles"} // []
l!l
11
MC/DC100%1/1
$args{"profiles"} // []
$args{"profiles"}
Truth table100%2/2
A
A= $args{"profiles"}
Aresult
11
00
25 1 $compiler->add_profile($profile, %args);
26 }
27  
28 2 ▶ if (my $include_dirs = $args{include_dirs}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $include_dirs = $args{"include_dirs"}) 0 2 2
29 0 $compiler->add_include_dirs($include_dirs);
30 }
31 2 ▶ if (my $defines = $args{defines}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $defines = $args{"defines"}) 0 2 2
32 0 $compiler->add_defines($defines);
33 }
34 2 ▶ if (my $extra = $args{extra_args}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $extra = $args{"extra_args"}) 0 2 2
35 0 $compiler->add_argument(value => $extra);
36 }
37 2 ▶ if (my $standard = $args{standard}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $standard = $args{"standard"}) 0 2 2
38 0 $compiler->set_standard($standard);
39 }
40  
41 2 my $node = $compiler->compile($from, $to, %args);
42 2 return $planner->add_node($node);
43 2 });
44  
45 2 ▶ my $linker_as = delete $opts{linker_as} // 'link';
Condition50%1/2
delete $opts{"linker_as"} // "link"
l!l
02
MC/DC0%0/1
delete $opts{"linker_as"} // "link"
delete $opts{"linker_as"}
Truth table50%1/2
A
A= delete $opts{"linker_as"}
Aresult
11
00
46 2 ▶ $planner->add_delegate($linker_as, sub {
Subroutine link: called CC=8 SCAR=22.3
47 2 my ($planner, $from, $to, %extra) = @_;
48 2 my %args = (%opts, %extra);
49  
50 2 my $linker = $class->make_linker(\%args);
51  
52 2 ▶ $args{profiles} = [ delete $args{profile} ] if $args{profile} and not $args{profiles};
Branch: 1 branch
BranchTrueFalseTotal
if $args{"profile"} and not $args{"profiles"} 1 1 2
Condition66%2/3
$args{"profile"} and not $args{"profiles"}
!ll&&!rl&&r
101
MC/DC50%1/2
$args{"profile"} and not $args{"profiles"}
$args{"profile"} not $args{"profiles"}
Truth table66%2/3
A and not(B)
A= $args{"profile"}B= not $args{"profiles"}
ABresult
0X0
100
111
53 2 ▶ for my $profile (@{ $args{profiles} // [] }) {
Condition100%2/2
$args{"profiles"} // []
l!l
11
MC/DC100%1/1
$args{"profiles"} // []
$args{"profiles"}
Truth table100%2/2
A
A= $args{"profiles"}
Aresult
11
00
54 1 $linker->add_profile($profile, %args);
55 }
56  
57 2 ▶ if (my $library_dirs = $args{library_dirs}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $library_dirs = $args{"library_dirs"}) 0 2 2
58 0 $linker->add_library_dirs($library_dirs);
59 }
60 2 ▶ if (my $libraries = $args{libraries}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $libraries = $args{"libraries"}) 0 2 2
61 0 $linker->add_libraries($libraries);
62 }
63 2 ▶ if (my $extra_args = $args{extra_args}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $extra_args = $args{"extra_args"}) 0 2 2
64 0 $linker->add_argument(ranking => 85, value => [ @{$extra_args} ]);
65 }
66  
67 2 my $node = $linker->link($from, $to, %args);
68 2 return $planner->add_node($node);
69 2 });
70  
71 2 for my $name (qw/object_file library_file static_library_file loadable_file executable_file/) {
72 10 ▶ my $format = delete $opts{$name} // croak "No known extension for $name";
Condition50%1/2
delete $opts{$name} // croak("No known extension for $name")
l!l
100
MC/DC0%0/1
delete $opts{$name} // croak("No known extension for $name")
delete $opts{$name}
Truth table50%1/2
A
A= delete $opts{$name}
Aresult
11
00
73 2 ▶ $planner->add_delegate($name, sub {
Subroutine executable_file: called CC=2 SCAR=7.1
Subroutine library_file: called CC=2 SCAR=7.1
74 2 my ($planner, $file, $dir) = @_;
75 2 my $filename = sprintf $format, $file;
76 2 ▶ return defined $dir ? catfile($dir, $filename) : $filename;
Branch: 2 branches
BranchTrueFalseTotal
defined $dir ? : 0 2 2
defined $dir ? : 0 2 2
77 10 });
78 }
79 }
80  
81 1 1;
82  
83 # ABSTRACT: A base class for BuildTools implementations.
84  
85 __END__
« Linker/XCOFF.pm ↑ Summary Linker/PE/MSVC.pm »