BuildTools/Base.pm

filter: Statementstmt 81.6% 80 / 98 Branchbran 50.0% 20 / 40 Conditioncond 42.8% 12 / 28 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 1 totaltotal 63.5% 124 / 195 CC 38 SCAR 23.2
CC
38
Cov
67%
__ANON__
13.8
compile
13.8
__ANON__
12.0
CRAP 10.2
« Linker/XCOFF.pm ↑ Summary Linker/PE/MSVC.pm »
1 package ExtUtils::Builder::BuildTools::Base;
2 1 $ExtUtils::Builder::BuildTools::Base::VERSION = '0.037';
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=20.4
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 1 ▶ $planner->add_delegate($compiler_as, sub {
Subroutine __ANON__: called CC=9 SCAR=26.3
Subroutine compile: called CC=9 SCAR=26.3
18 1 my ($planner, $from, $to, %extra) = @_;
19 1 my %args = (%opts, %extra);
20  
21 1 my $compiler = $class->make_compiler(\%args);
22  
23 1 ▶ $args{profiles} = [ delete $args{profile} ] if $args{profile} and not $args{profiles};
Branch: 2 branches
BranchTrueFalseTotal
if $args{"profile"} and not $args{"profiles"} 0 1 1
if $args{"profile"} and not $args{"profiles"} 1 0 1
Condition33%2/6
$args{"profile"} and not $args{"profiles"}
!ll&&!rl&&r
100
$args{"profile"} and not $args{"profiles"}
!ll&&!rl&&r
001
MC/DC0%0/2
$args{"profile"} and not $args{"profiles"}
$args{"profile"} not $args{"profiles"}
MC/DC0%0/2
$args{"profile"} and not $args{"profiles"}
$args{"profile"} not $args{"profiles"}
Truth table33%1/3
A and not(B)
A= $args{"profile"}B= not $args{"profiles"}
ABresult
0X0
100
111
Truth table33%1/3
A and not(B)
A= $args{"profile"}B= not $args{"profiles"}
ABresult
0X0
100
111
24 1 ▶ for my $profile (@{ $args{profiles} // [] }) {
Condition50%2/4
$args{"profiles"} // []
l!l
01
$args{"profiles"} // []
l!l
10
MC/DC0%0/1
$args{"profiles"} // []
$args{"profiles"}
MC/DC0%0/1
$args{"profiles"} // []
$args{"profiles"}
Truth table50%1/2
A
A= $args{"profiles"}
Aresult
11
00
Truth table50%1/2
A
A= $args{"profiles"}
Aresult
11
00
25 0 $compiler->add_profile($profile, %args);
26 }
27  
28 1 ▶ if (my $include_dirs = $args{include_dirs}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $include_dirs = $args{"include_dirs"}) 0 1 1
if (my $include_dirs = $args{"include_dirs"}) 0 1 1
29 0 $compiler->add_include_dirs($include_dirs);
30 }
31 1 ▶ if (my $defines = $args{defines}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $defines = $args{"defines"}) 0 1 1
if (my $defines = $args{"defines"}) 0 1 1
32 0 $compiler->add_defines($defines);
33 }
34 1 ▶ if (my $extra = $args{extra_args}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $extra = $args{"extra_args"}) 0 1 1
if (my $extra = $args{"extra_args"}) 0 1 1
35 0 $compiler->add_argument(value => $extra);
36 }
37 1 ▶ if (my $standard = $args{standard}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $standard = $args{"standard"}) 0 1 1
if (my $standard = $args{"standard"}) 0 1 1
38 0 $compiler->set_standard($standard);
39 }
40  
41 1 my $node = $compiler->compile($from, $to, %args);
42 1 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 1 ▶ $planner->add_delegate($linker_as, sub {
Subroutine __ANON__: called CC=8 SCAR=24.8
Subroutine link: called CC=8 SCAR=24.8
47 1 my ($planner, $from, $to, %extra) = @_;
48 1 my %args = (%opts, %extra);
49  
50 1 my $linker = $class->make_linker(\%args);
51  
52 1 ▶ $args{profiles} = [ delete $args{profile} ] if $args{profile} and not $args{profiles};
Branch: 2 branches
BranchTrueFalseTotal
if $args{"profile"} and not $args{"profiles"} 0 1 1
if $args{"profile"} and not $args{"profiles"} 1 0 1
Condition33%2/6
$args{"profile"} and not $args{"profiles"}
!ll&&!rl&&r
100
$args{"profile"} and not $args{"profiles"}
!ll&&!rl&&r
001
MC/DC0%0/2
$args{"profile"} and not $args{"profiles"}
$args{"profile"} not $args{"profiles"}
MC/DC0%0/2
$args{"profile"} and not $args{"profiles"}
$args{"profile"} not $args{"profiles"}
Truth table33%1/3
A and not(B)
A= $args{"profile"}B= not $args{"profiles"}
ABresult
0X0
100
111
Truth table33%1/3
A and not(B)
A= $args{"profile"}B= not $args{"profiles"}
ABresult
0X0
100
111
53 1 ▶ for my $profile (@{ $args{profiles} // [] }) {
Condition50%2/4
$args{"profiles"} // []
l!l
01
$args{"profiles"} // []
l!l
10
MC/DC0%0/1
$args{"profiles"} // []
$args{"profiles"}
MC/DC0%0/1
$args{"profiles"} // []
$args{"profiles"}
Truth table50%1/2
A
A= $args{"profiles"}
Aresult
11
00
Truth table50%1/2
A
A= $args{"profiles"}
Aresult
11
00
54 0 $linker->add_profile($profile, %args);
55 }
56  
57 1 ▶ if (my $library_dirs = $args{library_dirs}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $library_dirs = $args{"library_dirs"}) 0 1 1
if (my $library_dirs = $args{"library_dirs"}) 0 1 1
58 0 $linker->add_library_dirs($library_dirs);
59 }
60 1 ▶ if (my $libraries = $args{libraries}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $libraries = $args{"libraries"}) 0 1 1
if (my $libraries = $args{"libraries"}) 0 1 1
61 0 $linker->add_libraries($libraries);
62 }
63 1 ▶ if (my $extra_args = $args{extra_args}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $extra_args = $args{"extra_args"}) 0 1 1
if (my $extra_args = $args{"extra_args"}) 0 1 1
64 0 $linker->add_argument(ranking => 85, value => [ @{$extra_args} ]);
65 }
66  
67 1 my $node = $linker->link($from, $to, %args);
68 1 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 library_file: called CC=2 SCAR=7.1
Subroutine static_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 »