| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
19
|
|
|
19
|
|
656931
|
use strict; |
|
|
19
|
|
|
|
|
42
|
|
|
|
19
|
|
|
|
|
685
|
|
|
2
|
19
|
|
|
19
|
|
96
|
use warnings FATAL => 'recursion'; |
|
|
19
|
|
|
|
|
28
|
|
|
|
19
|
|
|
|
|
1241
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Daiku; |
|
5
|
19
|
|
|
19
|
|
406
|
use 5.008001; |
|
|
19
|
|
|
|
|
52
|
|
|
|
19
|
|
|
|
|
824
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.002'; |
|
7
|
19
|
|
|
19
|
|
6172
|
use Daiku::Registry; |
|
|
19
|
|
|
|
|
1251
|
|
|
|
19
|
|
|
|
|
546
|
|
|
8
|
19
|
|
|
19
|
|
10952
|
use IPC::System::Simple (); |
|
|
19
|
|
|
|
|
204663
|
|
|
|
19
|
|
|
|
|
610
|
|
|
9
|
19
|
|
|
19
|
|
161
|
use Exporter qw(import); |
|
|
19
|
|
|
|
|
31
|
|
|
|
19
|
|
|
|
|
8987
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT = our @EXPORT_OK = |
|
12
|
|
|
|
|
|
|
qw(desc task file rule sh namespace engine build); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my %engine_for = (); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _engine { |
|
17
|
135
|
|
|
135
|
|
209
|
my ($caller_package) = @_; |
|
18
|
135
|
|
66
|
|
|
1083
|
return ($engine_for{$caller_package} ||= Daiku::Registry->new()); |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub engine { |
|
22
|
17
|
|
|
17
|
0
|
1012
|
return _engine(caller(0)); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub desc($) { |
|
26
|
8
|
|
|
8
|
1
|
671
|
my $desc = shift; |
|
27
|
|
|
|
|
|
|
|
|
28
|
8
|
|
|
|
|
41
|
_engine(caller(0))->temporary_desc($desc); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# task 'all' => ['a', 'b']; |
|
32
|
|
|
|
|
|
|
# task 'all' => ['a', 'b'] => sub { ... }; |
|
33
|
|
|
|
|
|
|
sub task($$;&) { |
|
34
|
45
|
|
|
45
|
1
|
1882
|
my %args; |
|
35
|
45
|
|
|
|
|
100
|
$args{dst} = shift @_; |
|
36
|
45
|
100
|
|
|
|
138
|
if (ref($_[-1]) eq 'CODE') { |
|
37
|
42
|
|
|
|
|
85
|
$args{code} = pop @_; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
45
|
100
|
|
|
|
121
|
if (@_) { |
|
40
|
6
|
|
|
|
|
12
|
$args{deps} = shift @_; |
|
41
|
6
|
100
|
|
|
|
35
|
$args{deps} = [$args{deps}] if !ref $args{deps}; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
45
|
|
|
|
|
289
|
my $engine = _engine(caller(0)); |
|
44
|
45
|
|
|
|
|
146
|
my $desc = $engine->clear_temporary_desc; |
|
45
|
45
|
100
|
|
|
|
100
|
if (defined $desc) { |
|
46
|
8
|
|
|
|
|
17
|
$args{desc} = $desc; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
45
|
|
|
|
|
47
|
$args{dst} = join ':', @{ $engine->namespaces }, $args{dst}; |
|
|
45
|
|
|
|
|
162
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
45
|
|
|
|
|
406
|
my $task = Daiku::Task->new( %args ); |
|
51
|
45
|
|
|
|
|
207
|
$engine->register($task); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# file 'all' => ['a', 'b']; |
|
55
|
|
|
|
|
|
|
# file 'all' => 'a'; |
|
56
|
|
|
|
|
|
|
# file 'all' => ['a', 'b'] => sub { ... }; |
|
57
|
|
|
|
|
|
|
sub file($$;&) { |
|
58
|
14
|
|
|
14
|
1
|
2938
|
my %args; |
|
59
|
14
|
|
|
|
|
31
|
$args{dst} = shift @_; |
|
60
|
14
|
50
|
|
|
|
44
|
if (ref($_[-1]) eq 'CODE') { |
|
61
|
14
|
|
|
|
|
28
|
$args{code} = pop @_; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
14
|
100
|
|
|
|
35
|
if (@_) { |
|
64
|
13
|
|
|
|
|
29
|
$args{deps} = shift @_; |
|
65
|
13
|
100
|
|
|
|
51
|
$args{deps} = [$args{deps}] if !ref $args{deps}; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
14
|
|
|
|
|
182
|
my $file = Daiku::File->new( %args ); |
|
68
|
14
|
|
|
|
|
577
|
_engine(caller(0))->register($file); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# rule '.c' => '.o' => sub { ... }; |
|
72
|
|
|
|
|
|
|
sub rule($$;&) { |
|
73
|
9
|
|
|
9
|
1
|
608
|
my %args; |
|
74
|
9
|
|
|
|
|
40
|
@args{qw/dst src code/} = @_; |
|
75
|
9
|
50
|
|
|
|
29
|
delete $args{code} unless defined $args{code}; |
|
76
|
9
|
|
|
|
|
124
|
my $rule = Daiku::SuffixRule->new( %args ); |
|
77
|
9
|
|
|
|
|
90
|
_engine(caller(0))->register($rule); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub namespace($$) { |
|
81
|
2
|
|
|
2
|
1
|
22
|
my ($namespace, $code) = @_; |
|
82
|
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
16
|
my $engine = _engine(caller(0)); |
|
84
|
2
|
|
|
|
|
3
|
push @{ $engine->namespaces }, $namespace; |
|
|
2
|
|
|
|
|
6
|
|
|
85
|
2
|
|
|
|
|
6
|
$code->(); |
|
86
|
2
|
|
|
|
|
3
|
pop @{ $engine->namespaces }; |
|
|
2
|
|
|
|
|
4
|
|
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub build { |
|
90
|
40
|
|
|
40
|
1
|
238434
|
_engine(caller(0))->build(@_); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
*sh = *IPC::System::Simple::run; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
|
97
|
|
|
|
|
|
|
__END__ |