blib/lib/App/hopen/Gen/MSBuild/AssetGraphNode.pm

filter: Statementstmt 88.7% 55 / 62 Branchbran 100% 6 / 6 Conditioncond 55.5% 5 / 9 MC/DCmcdc 40.0% 2 / 5 Subroutinesub 78.5% 11 / 14 Podpod n/a totaltotal 82.2% 79 / 96 CC 8 SCAR 13.2
CC
8
Cov
86%
_run
7.7
__ANON__
6.0
__ANON__
1.1
CRAP 3.7
« blib/lib/App/hopen/AppUtil.pm ↑ Summary blib/lib/App/hopen/Phases.pm »
1 # App::hopen::Gen::MSBuild::AssetGraphNode - AssetOp for Gen::MSBuild
2 package App::hopen::Gen::MSBuild::AssetGraphNode;
3 1 ▶use Data::Hopen qw(hlog getparameters *VERBOSE);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Data::Hopen::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '0.000013'; # TRIAL
8  
9 1 ▶use parent 'App::hopen::G::AssetOp';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Class::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use App::hopen::BuildSystemGlobals; # for $DestDir
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Quote::Code;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use String::Print;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # Docs {{{1
17  
18 =head1 NAME
19  
20 App::hopen::Gen::MSBuild::AssetGraphNode - AssetOp for Gen::MSBuild
21  
22 =head1 SYNOPSIS
23  
24 TODO
25  
26 =head1 FUNCTIONS
27  
28 =cut
29  
30 # }}}1
31  
32 1 ▶use vars::i '*OUTPUT' => eval "\\'__R_MSBuildXML'";
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 =head2 _run
35  
36 Add to the XML hashref being built up in C<__R_MSBuildXML>.
37  
38 If the `how` of a node is defined but falsy, it's a goal.
39 If `how` is defined and truthy, it's a file.
40  
41 =cut
42  
43 sub _run {
44 4 ▶ my ($self, %args) = getparameters('self', [qw(; phase visitor)], @_);
Subroutine _run: called CC=7 SCAR=20.4
45 4 my $lrXML = $self->scope->find($OUTPUT);
46 # TODO deal with multiple inputs being merged in DAG::_run()
47  
48 4 my @inputs = $self->input_assets;
49 4 my $output = $self->asset->target;
50 4 ▶ $output = $output->path_wrt($DestDir) if eval { $output->DOES('App::hopen::Util::BasedPath') };
Branch: 1 branch
BranchTrueFalseTotal
if eval { do { $output->DOES("App::hopen::Util::BasedPath") } } 3 1 4
51 # TODO refactor this processing into a utility module/function
52  
53 # Debugging output
54 hlog {;
55 0 qc'Project piece from node {$self->name}',
56 0 ▶ qc'{$self->how//"<nothing to be done>"}',
Condition0%0/2
$self->how // "<nothing to be done>"
l!l
00
MC/DC0%0/1
$self->how // "<nothing to be done>"
$self->how
Truth table0%0/2
A
A= $self->how
Aresult
11
00
57 0 ▶ map { qc'Depends on {$_->target}' } @inputs,
Subroutine __ANON__: not called CC=2 SCAR=17.9
58 4 };
59  
60 4 ▶ if(defined $self->how && !$self->how) { # goal = MSBuild <Target>
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->how and not $self->how) { } 1 3 4
elsif (defined $self->how) { } 2 1 3
Condition100%3/3
defined $self->how and not $self->how
!ll&&!rl&&r
121
MC/DC100%2/2
defined $self->how and not $self->how
defined $self->how not $self->how
Truth table100%3/3
A and not(B)
A= defined $self->howB= not $self->how
ABresult
0X0
100
111
61 1 ▶ hlog { Goal => $output };
Subroutine __ANON__: not called CC=1 SCAR=1.2
62 1 $lrXML = [ Target => { Name => $output },
63 $lrXML ];
64  
65 } elsif(defined $self->how) { # file = MSBuild task
66 2 ▶ hlog { File => $output };
Subroutine __ANON__: not called CC=1 SCAR=1.2
67 2 my @paths = map { $_->target->path_wrt($DestDir) } @inputs;
68 2 my $recipe = $self->how;
69  
70 # TODO refactor this processing into a utility module/function
71 2 ▶ $recipe =~ s<#first\b><$paths[0] // ''>ge; # first input
Condition50%1/2
$paths[0] // ""
l!l
10
MC/DC0%0/1
$paths[0] // ""
$paths[0]
Truth table50%1/2
A
A= $paths[0]
Aresult
11
00
72 2 $recipe =~ s<#all\b><join(' ', @paths)>ge; # all inputs
73 2 ▶ $recipe =~ s<#out\b><$output // ''>ge;
Condition50%1/2
$output // ""
l!l
20
MC/DC0%0/1
$output // ""
$output
Truth table50%1/2
A
A= $output
Aresult
11
00
74  
75 2 $lrXML = [ TODO => { Name => $output },
76 $lrXML ];
77 }
78  
79 4 $self->make($self->asset);
80 4 return {$OUTPUT=>$lrXML};
81 } #_run()
82  
83 1 1;
84 __END__
85 # vi: set fdm=marker: #
« blib/lib/App/hopen/AppUtil.pm ↑ Summary blib/lib/App/hopen/Phases.pm »