line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
20
|
|
|
20
|
|
18186
|
use strict; |
|
20
|
|
|
|
|
30
|
|
|
20
|
|
|
|
|
695
|
|
2
|
20
|
|
|
20
|
|
83
|
use warnings FATAL => 'recursion'; |
|
20
|
|
|
|
|
25
|
|
|
20
|
|
|
|
|
613
|
|
3
|
20
|
|
|
20
|
|
79
|
use utf8; |
|
20
|
|
|
|
|
166
|
|
|
20
|
|
|
|
|
96
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This is .PHONY target. |
6
|
|
|
|
|
|
|
package Daiku::Task; |
7
|
20
|
|
|
20
|
|
22499
|
use File::stat; |
|
20
|
|
|
|
|
131804
|
|
|
20
|
|
|
|
|
129
|
|
8
|
20
|
|
|
20
|
|
10881
|
use Mouse; |
|
20
|
|
|
|
|
399978
|
|
|
20
|
|
|
|
|
103
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Daiku::Role'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has dst => ( |
13
|
|
|
|
|
|
|
is => 'rw', |
14
|
|
|
|
|
|
|
isa => 'Str', |
15
|
|
|
|
|
|
|
required => 1, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
has deps => ( |
18
|
|
|
|
|
|
|
is => 'rw', |
19
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
20
|
|
|
|
|
|
|
default => sub { +[ ] }, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
has code => ( |
23
|
|
|
|
|
|
|
is => 'rw', |
24
|
|
|
|
|
|
|
isa => 'CodeRef', |
25
|
|
|
|
|
|
|
default => sub { |
26
|
|
|
|
|
|
|
sub { } |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
has desc => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# @return affected things |
35
|
|
|
|
|
|
|
sub build { |
36
|
21
|
|
|
21
|
1
|
43
|
my ($self, $target, @args) = @_; |
37
|
21
|
|
|
|
|
121
|
$self->log("Building Task: $self->{dst}"); |
38
|
|
|
|
|
|
|
|
39
|
21
|
|
|
|
|
91
|
my $built = $self->_build_deps(); |
40
|
|
|
|
|
|
|
|
41
|
21
|
|
|
|
|
88
|
$self->code->($self, @args); |
42
|
20
|
|
|
|
|
7065
|
$built++; |
43
|
|
|
|
|
|
|
|
44
|
20
|
|
|
|
|
82
|
return $built; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub match { |
48
|
207
|
|
|
207
|
0
|
1041
|
my ($self, $target) = @_; |
49
|
207
|
100
|
|
|
|
704
|
return 1 if $self->dst eq $target; |
50
|
177
|
|
|
|
|
467
|
return 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# @return the number of built tasks |
54
|
|
|
|
|
|
|
sub _build_deps { |
55
|
21
|
|
|
21
|
|
38
|
my ($self) = @_; |
56
|
|
|
|
|
|
|
|
57
|
21
|
|
|
|
|
26
|
my $ret = 0; |
58
|
21
|
|
|
|
|
24
|
for my $target (@{$self->deps}) { |
|
21
|
|
|
|
|
96
|
|
59
|
9
|
|
|
|
|
48
|
my $task = $self->registry->find_task($target); |
60
|
9
|
50
|
|
|
|
33
|
if ($task) { |
61
|
9
|
|
|
|
|
30
|
$ret += $task->build($target); |
62
|
|
|
|
|
|
|
} else { |
63
|
0
|
|
|
|
|
0
|
die "I don't know to build '$target' depended by '$self->{dst}'\n"; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
21
|
|
|
|
|
43
|
return $ret; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
20
|
|
|
20
|
|
11594
|
no Mouse; |
|
20
|
|
|
|
|
35
|
|
|
20
|
|
|
|
|
86
|
|
70
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
__END__ |