line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Workflow::Build; |
2
|
45
|
|
|
45
|
|
93065
|
use strict; |
|
45
|
|
|
|
|
47
|
|
|
45
|
|
|
|
|
874
|
|
3
|
45
|
|
|
45
|
|
121
|
use warnings; |
|
45
|
|
|
|
|
29
|
|
|
45
|
|
|
|
|
800
|
|
4
|
|
|
|
|
|
|
|
5
|
45
|
|
|
45
|
|
13517
|
use Test2::Workflow::Task::Group; |
|
45
|
|
|
|
|
68
|
|
|
45
|
|
|
|
|
1591
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @BUILD_FIELDS; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
45
|
|
|
45
|
|
639
|
@BUILD_FIELDS = qw{ |
11
|
|
|
|
|
|
|
primary variant |
12
|
|
|
|
|
|
|
setup teardown |
13
|
|
|
|
|
|
|
variant_setup variant_teardown |
14
|
|
|
|
|
|
|
primary_setup primary_teardown |
15
|
|
|
|
|
|
|
stash |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
45
|
|
|
45
|
|
179
|
use base 'Test2::Workflow::Task'; |
|
45
|
|
|
|
|
28
|
|
|
45
|
|
|
|
|
2562
|
|
20
|
45
|
|
|
45
|
|
172
|
use Test2::Util::HashBase @BUILD_FIELDS, qw/events defaults stack_stop/; |
|
45
|
|
|
|
|
38
|
|
|
45
|
|
|
|
|
151
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub init { |
23
|
133
|
|
|
133
|
0
|
1134
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
{ |
26
|
133
|
|
|
|
|
103
|
local $Carp::CarpLevel = $Carp::CarpLevel + 1; |
|
133
|
|
|
|
|
193
|
|
27
|
133
|
|
|
|
|
492
|
$self->SUPER::init(); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
133
|
|
50
|
|
|
2887
|
$self->{$_} ||= [] for @BUILD_FIELDS; |
31
|
133
|
|
50
|
|
|
597
|
$self->{+DEFAULTS} ||= {}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
for my $field (@BUILD_FIELDS) { |
35
|
|
|
|
|
|
|
my $code = sub { |
36
|
777
|
|
|
777
|
|
1769
|
my $self = shift; |
37
|
777
|
|
|
|
|
585
|
push @{$self->{$field}} => @_; |
|
777
|
|
|
|
|
3055
|
|
38
|
|
|
|
|
|
|
}; |
39
|
45
|
|
|
45
|
|
14659
|
no strict 'refs'; |
|
45
|
|
|
|
|
55
|
|
|
45
|
|
|
|
|
15299
|
|
40
|
|
|
|
|
|
|
*{"add_$field"} = $code; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub populated { |
44
|
181
|
|
|
181
|
0
|
177
|
my $self = shift; |
45
|
181
|
|
|
|
|
273
|
for my $field (@BUILD_FIELDS) { |
46
|
237
|
100
|
|
|
|
188
|
return 1 if @{$self->{$field}}; |
|
237
|
|
|
|
|
880
|
|
47
|
|
|
|
|
|
|
} |
48
|
7
|
|
|
|
|
57
|
return 0; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub compile { |
52
|
143
|
|
|
143
|
0
|
154
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
warn "Workflow build '$self->{+NAME}' is empty " . $self->debug . "\n" |
55
|
143
|
50
|
66
|
|
|
316
|
unless $self->populated || $self->{+SKIP}; |
56
|
|
|
|
|
|
|
|
57
|
143
|
|
|
|
|
224
|
my ($primary_setup, $primary_teardown) = @_; |
58
|
143
|
|
100
|
|
|
410
|
$primary_setup ||= []; |
59
|
143
|
|
100
|
|
|
329
|
$primary_teardown ||= []; |
60
|
|
|
|
|
|
|
|
61
|
143
|
|
|
|
|
257
|
my $variant = $self->{+VARIANT}; |
62
|
143
|
|
|
|
|
157
|
my $setup = $self->{+SETUP}; |
63
|
143
|
|
|
|
|
122
|
my $teardown = $self->{+TEARDOWN}; |
64
|
143
|
|
|
|
|
175
|
my $variant_setup = $self->{+VARIANT_SETUP}; |
65
|
143
|
|
|
|
|
162
|
my $variant_teardown = $self->{+VARIANT_TEARDOWN}; |
66
|
|
|
|
|
|
|
|
67
|
143
|
|
|
|
|
172
|
$primary_setup = [@$primary_setup, @{$self->{+PRIMARY_SETUP}}]; |
|
143
|
|
|
|
|
242
|
|
68
|
143
|
|
|
|
|
173
|
$primary_teardown = [@{$self->{+PRIMARY_TEARDOWN}}, @$primary_teardown]; |
|
143
|
|
|
|
|
225
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Get primaries in order. |
71
|
|
|
|
|
|
|
my $primary = [ |
72
|
|
|
|
|
|
|
map { |
73
|
524
|
100
|
|
|
|
1806
|
$_->isa(__PACKAGE__) |
74
|
|
|
|
|
|
|
? $_->compile($primary_setup, $primary_teardown) |
75
|
|
|
|
|
|
|
: $_; |
76
|
143
|
|
|
|
|
115
|
} @{$self->{+PRIMARY}}, |
|
143
|
|
|
|
|
215
|
|
77
|
|
|
|
|
|
|
]; |
78
|
|
|
|
|
|
|
|
79
|
143
|
100
|
66
|
|
|
695
|
if (@$primary_setup || @$primary_teardown) { |
80
|
|
|
|
|
|
|
$primary = [ |
81
|
|
|
|
|
|
|
map { |
82
|
83
|
|
|
|
|
111
|
my $p = $_->clone; |
|
311
|
|
|
|
|
1200
|
|
83
|
311
|
100
|
|
|
|
1474
|
$_->isa('Test2::Workflow::Task::Action') ? Test2::Workflow::Task::Group->new( |
84
|
|
|
|
|
|
|
before => $primary_setup, |
85
|
|
|
|
|
|
|
primary => [ $p ], |
86
|
|
|
|
|
|
|
take => $p, |
87
|
|
|
|
|
|
|
after => $primary_teardown, |
88
|
|
|
|
|
|
|
) : $_; |
89
|
|
|
|
|
|
|
} @$primary |
90
|
|
|
|
|
|
|
]; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# Build variants |
94
|
143
|
100
|
|
|
|
504
|
if (@$variant) { |
95
|
|
|
|
|
|
|
$primary = [ |
96
|
|
|
|
|
|
|
map { |
97
|
54
|
|
|
|
|
89
|
my $v = $_->clone; |
|
108
|
|
|
|
|
733
|
|
98
|
108
|
|
|
|
|
311
|
Test2::Workflow::Task::Group->new( |
99
|
|
|
|
|
|
|
before => $variant_setup, |
100
|
|
|
|
|
|
|
primary => $primary, |
101
|
|
|
|
|
|
|
after => $variant_teardown, |
102
|
|
|
|
|
|
|
variant => $v, |
103
|
|
|
|
|
|
|
take => $v, |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
} @$variant |
106
|
|
|
|
|
|
|
]; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
143
|
100
|
|
|
|
680
|
my %params = map { Test2::Workflow::Task::Group->can($_) ? ($_ => $self->{$_}) : () } keys %$self; |
|
2306
|
|
|
|
|
6431
|
|
110
|
143
|
|
|
|
|
779
|
delete $params{$_} for @BUILD_FIELDS; |
111
|
|
|
|
|
|
|
|
112
|
143
|
|
|
|
|
532
|
return Test2::Workflow::Task::Group->new( |
113
|
|
|
|
|
|
|
%params, |
114
|
|
|
|
|
|
|
before => $setup, |
115
|
|
|
|
|
|
|
after => $teardown, |
116
|
|
|
|
|
|
|
primary => $primary, |
117
|
|
|
|
|
|
|
); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
__END__ |