builder/MyBuilder.pm

filter: Statementstmt 82.8% 29 / 35 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 3 totaltotal 77.0% 37 / 48 CC 3 SCAR 4.5
CC
3
Cov
81%
compile_c
2.3
new
2.0
ACTION_code
2.0
CRAP 1.6
« blib/lib/Text/Sass/XS.pm ↑ Summary lib/Text/Sass/XS.xs »
1 package builder::MyBuilder;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw(Module::Build);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Devel::PPPort;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
9 0 my ( $self, %args ) = @_;
10  
11 0 print "Writing ppport.h\n";
12 0 Devel::PPPort::WriteFile(
13 File::Spec->catfile(qw/lib Text Sass ppport.h/) );
14  
15 0 $self->SUPER::new(
16 %args,
17 c_source => ['libsass'],
18 extra_compiler_flags => [ '-x', 'c++' ],
19 extra_linker_flags => ['-lstdc++'],
20 );
21 }
22  
23 1 ▶sub ACTION_code {
Subroutine ACTION_code: called CC=2 SCAR=6.9
Pod undocumented
24 1 my ($self) = @_;
25  
26 # libsass@7779ab5 includes lots of files that are not required.
27  
28 1 my $p = $self->{properties};
29  
30 1 my ($dir) = @{delete $p->{c_source}};
31 1 push @{$p->{include_dirs}}, $dir;
32  
33 1 foreach my $file (glob("$dir/*.cpp")) {
34 23 push @{$p->{objects}}, $self->compile_c($file);
35 }
36  
37 1 $self->SUPER::ACTION_code();
38 }
39  
40 24 ▶sub compile_c {
Subroutine compile_c: called CC=2 SCAR=8.4
Pod undocumented
41 24 my $self = shift;
42  
43 # This logic is copied from M::B::Pluggable::XSUtil
44 24 ▶ unless ($self->cbuilder->have_cplusplus) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->cbuilder->have_cplusplus) 0 24 24
45 0 warn
46 "This environment does not have a C++ compiler(OS unsupported)\n";
47 0 exit 0;
48 };
49  
50 24 $self->SUPER::compile_c(@_);
51 }
52 1 1;
« blib/lib/Text/Sass/XS.pm ↑ Summary lib/Text/Sass/XS.xs »