| 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"
MC/DC0%0/1
$opts{"type"} //= "executable"
$opts{"type"}
Truth table50%1/2
A
A= $opts{"type"}
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | my $compiler_as = delete $opts{compiler_as} // 'compile'; | ||||||||||||||||||||||||||
|
Condition50%1/2
delete $opts{"compiler_as"} // "compile"
MC/DC0%0/1
delete $opts{"compiler_as"} // "compile"
delete $opts{"compiler_as"}
Truth table50%1/2
A
A= delete $opts{"compiler_as"}
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$args{"profile"} and not $args{"profiles"}
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"}
| |||||||||||||||||||||||||||||
| 24 | 2 | ▶ | for my $profile (@{ $args{profiles} // [] }) { | ||||||||||||||||||||||||||
|
Condition100%2/2
$args{"profiles"} // []
MC/DC100%1/1
$args{"profiles"} // []
$args{"profiles"}
Truth table100%2/2
A
A= $args{"profiles"}
| |||||||||||||||||||||||||||||
| 25 | 1 | $compiler->add_profile($profile, %args); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 2 | ▶ | if (my $include_dirs = $args{include_dirs}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | $compiler->add_include_dirs($include_dirs); | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | 2 | ▶ | if (my $defines = $args{defines}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 0 | $compiler->add_defines($defines); | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | 2 | ▶ | if (my $extra = $args{extra_args}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | $compiler->add_argument(value => $extra); | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | 2 | ▶ | if (my $standard = $args{standard}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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"
MC/DC0%0/1
delete $opts{"linker_as"} // "link"
delete $opts{"linker_as"}
Truth table50%1/2
A
A= delete $opts{"linker_as"}
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$args{"profile"} and not $args{"profiles"}
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"}
| |||||||||||||||||||||||||||||
| 53 | 2 | ▶ | for my $profile (@{ $args{profiles} // [] }) { | ||||||||||||||||||||||||||
|
Condition100%2/2
$args{"profiles"} // []
MC/DC100%1/1
$args{"profiles"} // []
$args{"profiles"}
Truth table100%2/2
A
A= $args{"profiles"}
| |||||||||||||||||||||||||||||
| 54 | 1 | $linker->add_profile($profile, %args); | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 2 | ▶ | if (my $library_dirs = $args{library_dirs}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 0 | $linker->add_library_dirs($library_dirs); | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | 2 | ▶ | if (my $libraries = $args{libraries}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 0 | $linker->add_libraries($libraries); | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | 2 | ▶ | if (my $extra_args = $args{extra_args}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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")
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}
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 77 | 10 | }); | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 1 | 1; | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | # ABSTRACT: A base class for BuildTools implementations. | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | __END__ | ||||||||||||||||||||||||||||