line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Workflow::Build; |
2
|
46
|
|
|
46
|
|
316
|
use strict; |
|
46
|
|
|
|
|
97
|
|
|
46
|
|
|
|
|
1424
|
|
3
|
46
|
|
|
46
|
|
231
|
use warnings; |
|
46
|
|
|
|
|
105
|
|
|
46
|
|
|
|
|
2027
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000153'; |
6
|
|
|
|
|
|
|
|
7
|
46
|
|
|
46
|
|
18958
|
use Test2::Workflow::Task::Group; |
|
46
|
|
|
|
|
137
|
|
|
46
|
|
|
|
|
2807
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @BUILD_FIELDS; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
46
|
|
|
46
|
|
1011
|
@BUILD_FIELDS = qw{ |
13
|
|
|
|
|
|
|
primary variant |
14
|
|
|
|
|
|
|
setup teardown |
15
|
|
|
|
|
|
|
variant_setup variant_teardown |
16
|
|
|
|
|
|
|
primary_setup primary_teardown |
17
|
|
|
|
|
|
|
stash |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
46
|
|
|
46
|
|
349
|
use base 'Test2::Workflow::Task'; |
|
46
|
|
|
|
|
167
|
|
|
46
|
|
|
|
|
4722
|
|
22
|
46
|
|
|
46
|
|
359
|
use Test2::Util::HashBase @BUILD_FIELDS, qw/events defaults stack_stop/; |
|
46
|
|
|
|
|
87
|
|
|
46
|
|
|
|
|
212
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub init { |
25
|
135
|
|
|
135
|
0
|
2808
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
{ |
28
|
135
|
|
|
|
|
221
|
local $Carp::CarpLevel = $Carp::CarpLevel + 1; |
|
135
|
|
|
|
|
325
|
|
29
|
135
|
|
|
|
|
755
|
$self->SUPER::init(); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
135
|
|
50
|
|
|
2804
|
$self->{$_} ||= [] for @BUILD_FIELDS; |
33
|
135
|
|
50
|
|
|
884
|
$self->{+DEFAULTS} ||= {}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
for my $field (@BUILD_FIELDS) { |
37
|
|
|
|
|
|
|
my $code = sub { |
38
|
782
|
|
|
782
|
|
1473
|
my $self = shift; |
39
|
782
|
|
|
|
|
1229
|
push @{$self->{$field}} => @_; |
|
782
|
|
|
|
|
4702
|
|
40
|
|
|
|
|
|
|
}; |
41
|
46
|
|
|
46
|
|
34305
|
no strict 'refs'; |
|
46
|
|
|
|
|
175
|
|
|
46
|
|
|
|
|
24162
|
|
42
|
|
|
|
|
|
|
*{"add_$field"} = $code; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub populated { |
46
|
184
|
|
|
184
|
0
|
380
|
my $self = shift; |
47
|
184
|
|
|
|
|
453
|
for my $field (@BUILD_FIELDS) { |
48
|
240
|
100
|
|
|
|
373
|
return 1 if @{$self->{$field}}; |
|
240
|
|
|
|
|
1218
|
|
49
|
|
|
|
|
|
|
} |
50
|
7
|
|
|
|
|
111
|
return 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub compile { |
54
|
145
|
|
|
145
|
0
|
325
|
my $self = shift; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
warn "Workflow build '$self->{+NAME}' is empty " . $self->debug . "\n" |
57
|
145
|
50
|
66
|
|
|
391
|
unless $self->populated || $self->{+SKIP}; |
58
|
|
|
|
|
|
|
|
59
|
145
|
|
|
|
|
460
|
my ($primary_setup, $primary_teardown) = @_; |
60
|
145
|
|
100
|
|
|
641
|
$primary_setup ||= []; |
61
|
145
|
|
100
|
|
|
760
|
$primary_teardown ||= []; |
62
|
|
|
|
|
|
|
|
63
|
145
|
|
|
|
|
444
|
my $variant = $self->{+VARIANT}; |
64
|
145
|
|
|
|
|
371
|
my $setup = $self->{+SETUP}; |
65
|
145
|
|
|
|
|
302
|
my $teardown = $self->{+TEARDOWN}; |
66
|
145
|
|
|
|
|
416
|
my $variant_setup = $self->{+VARIANT_SETUP}; |
67
|
145
|
|
|
|
|
439
|
my $variant_teardown = $self->{+VARIANT_TEARDOWN}; |
68
|
|
|
|
|
|
|
|
69
|
145
|
|
|
|
|
316
|
$primary_setup = [@$primary_setup, @{$self->{+PRIMARY_SETUP}}]; |
|
145
|
|
|
|
|
417
|
|
70
|
145
|
|
|
|
|
266
|
$primary_teardown = [@{$self->{+PRIMARY_TEARDOWN}}, @$primary_teardown]; |
|
145
|
|
|
|
|
438
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Get primaries in order. |
73
|
|
|
|
|
|
|
my $primary = [ |
74
|
|
|
|
|
|
|
map { |
75
|
528
|
100
|
|
|
|
2792
|
$_->isa(__PACKAGE__) |
76
|
|
|
|
|
|
|
? $_->compile($primary_setup, $primary_teardown) |
77
|
|
|
|
|
|
|
: $_; |
78
|
145
|
|
|
|
|
287
|
} @{$self->{+PRIMARY}}, |
|
145
|
|
|
|
|
367
|
|
79
|
|
|
|
|
|
|
]; |
80
|
|
|
|
|
|
|
|
81
|
145
|
100
|
66
|
|
|
1346
|
if (@$primary_setup || @$primary_teardown) { |
82
|
|
|
|
|
|
|
$primary = [ |
83
|
|
|
|
|
|
|
map { |
84
|
83
|
|
|
|
|
194
|
my $p = $_->clone; |
|
311
|
|
|
|
|
1688
|
|
85
|
311
|
100
|
|
|
|
2286
|
$_->isa('Test2::Workflow::Task::Action') ? Test2::Workflow::Task::Group->new( |
86
|
|
|
|
|
|
|
before => $primary_setup, |
87
|
|
|
|
|
|
|
primary => [ $p ], |
88
|
|
|
|
|
|
|
take => $p, |
89
|
|
|
|
|
|
|
after => $primary_teardown, |
90
|
|
|
|
|
|
|
) : $_; |
91
|
|
|
|
|
|
|
} @$primary |
92
|
|
|
|
|
|
|
]; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Build variants |
96
|
145
|
100
|
|
|
|
802
|
if (@$variant) { |
97
|
|
|
|
|
|
|
$primary = [ |
98
|
|
|
|
|
|
|
map { |
99
|
54
|
|
|
|
|
198
|
my $v = $_->clone; |
|
108
|
|
|
|
|
592
|
|
100
|
108
|
|
|
|
|
574
|
Test2::Workflow::Task::Group->new( |
101
|
|
|
|
|
|
|
before => $variant_setup, |
102
|
|
|
|
|
|
|
primary => $primary, |
103
|
|
|
|
|
|
|
after => $variant_teardown, |
104
|
|
|
|
|
|
|
variant => $v, |
105
|
|
|
|
|
|
|
take => $v, |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
} @$variant |
108
|
|
|
|
|
|
|
]; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
145
|
100
|
|
|
|
1314
|
my %params = map { Test2::Workflow::Task::Group->can($_) ? ($_ => $self->{$_}) : () } keys %$self; |
|
2339
|
|
|
|
|
10051
|
|
112
|
145
|
|
|
|
|
1177
|
delete $params{$_} for @BUILD_FIELDS; |
113
|
|
|
|
|
|
|
|
114
|
145
|
|
|
|
|
855
|
return Test2::Workflow::Task::Group->new( |
115
|
|
|
|
|
|
|
%params, |
116
|
|
|
|
|
|
|
before => $setup, |
117
|
|
|
|
|
|
|
after => $teardown, |
118
|
|
|
|
|
|
|
primary => $primary, |
119
|
|
|
|
|
|
|
); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__END__ |