line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Workflow::Build; |
2
|
46
|
|
|
46
|
|
306
|
use strict; |
|
46
|
|
|
|
|
101
|
|
|
46
|
|
|
|
|
1437
|
|
3
|
46
|
|
|
46
|
|
227
|
use warnings; |
|
46
|
|
|
|
|
109
|
|
|
46
|
|
|
|
|
1734
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000156'; |
6
|
|
|
|
|
|
|
|
7
|
46
|
|
|
46
|
|
18592
|
use Test2::Workflow::Task::Group; |
|
46
|
|
|
|
|
128
|
|
|
46
|
|
|
|
|
2671
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @BUILD_FIELDS; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
46
|
|
|
46
|
|
983
|
@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
|
|
293
|
use base 'Test2::Workflow::Task'; |
|
46
|
|
|
|
|
114
|
|
|
46
|
|
|
|
|
4376
|
|
22
|
46
|
|
|
46
|
|
319
|
use Test2::Util::HashBase @BUILD_FIELDS, qw/events defaults stack_stop/; |
|
46
|
|
|
|
|
83
|
|
|
46
|
|
|
|
|
211
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub init { |
25
|
135
|
|
|
135
|
0
|
2339
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
{ |
28
|
135
|
|
|
|
|
244
|
local $Carp::CarpLevel = $Carp::CarpLevel + 1; |
|
135
|
|
|
|
|
292
|
|
29
|
135
|
|
|
|
|
709
|
$self->SUPER::init(); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
135
|
|
50
|
|
|
2487
|
$self->{$_} ||= [] for @BUILD_FIELDS; |
33
|
135
|
|
50
|
|
|
937
|
$self->{+DEFAULTS} ||= {}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
for my $field (@BUILD_FIELDS) { |
37
|
|
|
|
|
|
|
my $code = sub { |
38
|
782
|
|
|
782
|
|
1379
|
my $self = shift; |
39
|
782
|
|
|
|
|
1062
|
push @{$self->{$field}} => @_; |
|
782
|
|
|
|
|
4008
|
|
40
|
|
|
|
|
|
|
}; |
41
|
46
|
|
|
46
|
|
33953
|
no strict 'refs'; |
|
46
|
|
|
|
|
108
|
|
|
46
|
|
|
|
|
24582
|
|
42
|
|
|
|
|
|
|
*{"add_$field"} = $code; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub populated { |
46
|
184
|
|
|
184
|
0
|
360
|
my $self = shift; |
47
|
184
|
|
|
|
|
512
|
for my $field (@BUILD_FIELDS) { |
48
|
240
|
100
|
|
|
|
353
|
return 1 if @{$self->{$field}}; |
|
240
|
|
|
|
|
1308
|
|
49
|
|
|
|
|
|
|
} |
50
|
7
|
|
|
|
|
96
|
return 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub compile { |
54
|
145
|
|
|
145
|
0
|
332
|
my $self = shift; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
warn "Workflow build '$self->{+NAME}' is empty " . $self->debug . "\n" |
57
|
145
|
50
|
66
|
|
|
409
|
unless $self->populated || $self->{+SKIP}; |
58
|
|
|
|
|
|
|
|
59
|
145
|
|
|
|
|
389
|
my ($primary_setup, $primary_teardown) = @_; |
60
|
145
|
|
100
|
|
|
618
|
$primary_setup ||= []; |
61
|
145
|
|
100
|
|
|
617
|
$primary_teardown ||= []; |
62
|
|
|
|
|
|
|
|
63
|
145
|
|
|
|
|
402
|
my $variant = $self->{+VARIANT}; |
64
|
145
|
|
|
|
|
281
|
my $setup = $self->{+SETUP}; |
65
|
145
|
|
|
|
|
318
|
my $teardown = $self->{+TEARDOWN}; |
66
|
145
|
|
|
|
|
278
|
my $variant_setup = $self->{+VARIANT_SETUP}; |
67
|
145
|
|
|
|
|
330
|
my $variant_teardown = $self->{+VARIANT_TEARDOWN}; |
68
|
|
|
|
|
|
|
|
69
|
145
|
|
|
|
|
321
|
$primary_setup = [@$primary_setup, @{$self->{+PRIMARY_SETUP}}]; |
|
145
|
|
|
|
|
453
|
|
70
|
145
|
|
|
|
|
251
|
$primary_teardown = [@{$self->{+PRIMARY_TEARDOWN}}, @$primary_teardown]; |
|
145
|
|
|
|
|
362
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Get primaries in order. |
73
|
|
|
|
|
|
|
my $primary = [ |
74
|
|
|
|
|
|
|
map { |
75
|
528
|
100
|
|
|
|
2707
|
$_->isa(__PACKAGE__) |
76
|
|
|
|
|
|
|
? $_->compile($primary_setup, $primary_teardown) |
77
|
|
|
|
|
|
|
: $_; |
78
|
145
|
|
|
|
|
280
|
} @{$self->{+PRIMARY}}, |
|
145
|
|
|
|
|
413
|
|
79
|
|
|
|
|
|
|
]; |
80
|
|
|
|
|
|
|
|
81
|
145
|
100
|
66
|
|
|
1312
|
if (@$primary_setup || @$primary_teardown) { |
82
|
|
|
|
|
|
|
$primary = [ |
83
|
|
|
|
|
|
|
map { |
84
|
83
|
|
|
|
|
198
|
my $p = $_->clone; |
|
311
|
|
|
|
|
1411
|
|
85
|
311
|
100
|
|
|
|
1915
|
$_->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
|
|
|
|
723
|
if (@$variant) { |
97
|
|
|
|
|
|
|
$primary = [ |
98
|
|
|
|
|
|
|
map { |
99
|
54
|
|
|
|
|
167
|
my $v = $_->clone; |
|
108
|
|
|
|
|
474
|
|
100
|
108
|
|
|
|
|
769
|
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
|
|
|
|
1290
|
my %params = map { Test2::Workflow::Task::Group->can($_) ? ($_ => $self->{$_}) : () } keys %$self; |
|
2339
|
|
|
|
|
9945
|
|
112
|
145
|
|
|
|
|
1101
|
delete $params{$_} for @BUILD_FIELDS; |
113
|
|
|
|
|
|
|
|
114
|
145
|
|
|
|
|
809
|
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__ |