line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
19
|
|
|
19
|
|
555982
|
use strict; |
|
19
|
|
|
|
|
34
|
|
|
19
|
|
|
|
|
728
|
|
2
|
19
|
|
|
19
|
|
113
|
use warnings FATAL => 'recursion'; |
|
19
|
|
|
|
|
27
|
|
|
19
|
|
|
|
|
1192
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Daiku; |
5
|
19
|
|
|
19
|
|
455
|
use 5.008001; |
|
19
|
|
|
|
|
53
|
|
|
19
|
|
|
|
|
870
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.004'; |
7
|
19
|
|
|
19
|
|
5868
|
use Daiku::Registry; |
|
19
|
|
|
|
|
1097
|
|
|
19
|
|
|
|
|
526
|
|
8
|
19
|
|
|
19
|
|
10648
|
use IPC::System::Simple (); |
|
19
|
|
|
|
|
199894
|
|
|
19
|
|
|
|
|
564
|
|
9
|
19
|
|
|
19
|
|
131
|
use Exporter qw(import); |
|
19
|
|
|
|
|
28
|
|
|
19
|
|
|
|
|
8796
|
|
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
|
|
210
|
my ($caller_package) = @_; |
18
|
135
|
|
66
|
|
|
1077
|
return ($engine_for{$caller_package} ||= Daiku::Registry->new()); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub engine { |
22
|
17
|
|
|
17
|
0
|
1043
|
return _engine(caller(0)); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub desc($) { |
26
|
8
|
|
|
8
|
1
|
640
|
my $desc = shift; |
27
|
|
|
|
|
|
|
|
28
|
8
|
|
|
|
|
45
|
_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
|
2198
|
my %args; |
35
|
45
|
|
|
|
|
99
|
$args{dst} = shift @_; |
36
|
45
|
100
|
|
|
|
150
|
if (ref($_[-1]) eq 'CODE') { |
37
|
42
|
|
|
|
|
83
|
$args{code} = pop @_; |
38
|
|
|
|
|
|
|
} |
39
|
45
|
100
|
|
|
|
108
|
if (@_) { |
40
|
6
|
|
|
|
|
11
|
$args{deps} = shift @_; |
41
|
6
|
100
|
|
|
|
31
|
$args{deps} = [$args{deps}] if !ref $args{deps}; |
42
|
|
|
|
|
|
|
} |
43
|
45
|
|
|
|
|
273
|
my $engine = _engine(caller(0)); |
44
|
45
|
|
|
|
|
151
|
my $desc = $engine->clear_temporary_desc; |
45
|
45
|
100
|
|
|
|
105
|
if (defined $desc) { |
46
|
8
|
|
|
|
|
16
|
$args{desc} = $desc; |
47
|
|
|
|
|
|
|
} |
48
|
45
|
|
|
|
|
53
|
$args{dst} = join ':', @{ $engine->namespaces }, $args{dst}; |
|
45
|
|
|
|
|
175
|
|
49
|
|
|
|
|
|
|
|
50
|
45
|
|
|
|
|
439
|
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
|
2587
|
my %args; |
59
|
14
|
|
|
|
|
34
|
$args{dst} = shift @_; |
60
|
14
|
50
|
|
|
|
51
|
if (ref($_[-1]) eq 'CODE') { |
61
|
14
|
|
|
|
|
31
|
$args{code} = pop @_; |
62
|
|
|
|
|
|
|
} |
63
|
14
|
100
|
|
|
|
36
|
if (@_) { |
64
|
13
|
|
|
|
|
30
|
$args{deps} = shift @_; |
65
|
13
|
100
|
|
|
|
52
|
$args{deps} = [$args{deps}] if !ref $args{deps}; |
66
|
|
|
|
|
|
|
} |
67
|
14
|
|
|
|
|
191
|
my $file = Daiku::File->new( %args ); |
68
|
14
|
|
|
|
|
631
|
_engine(caller(0))->register($file); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# rule '.c' => '.o' => sub { ... }; |
72
|
|
|
|
|
|
|
sub rule($$;&) { |
73
|
9
|
|
|
9
|
1
|
793
|
my %args; |
74
|
9
|
|
|
|
|
36
|
@args{qw/dst src code/} = @_; |
75
|
9
|
50
|
|
|
|
34
|
delete $args{code} unless defined $args{code}; |
76
|
9
|
|
|
|
|
118
|
my $rule = Daiku::SuffixRule->new( %args ); |
77
|
9
|
|
|
|
|
66
|
_engine(caller(0))->register($rule); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub namespace($$) { |
81
|
2
|
|
|
2
|
1
|
29
|
my ($namespace, $code) = @_; |
82
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
19
|
my $engine = _engine(caller(0)); |
84
|
2
|
|
|
|
|
4
|
push @{ $engine->namespaces }, $namespace; |
|
2
|
|
|
|
|
6
|
|
85
|
2
|
|
|
|
|
6
|
$code->(); |
86
|
2
|
|
|
|
|
2
|
pop @{ $engine->namespaces }; |
|
2
|
|
|
|
|
5
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub build { |
90
|
40
|
|
|
40
|
1
|
78225
|
_engine(caller(0))->build(@_); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
*sh = *IPC::System::Simple::run; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
__END__ |