line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Workflow::Build; |
2
|
46
|
|
|
46
|
|
352
|
use strict; |
|
46
|
|
|
|
|
92
|
|
|
46
|
|
|
|
|
1959
|
|
3
|
46
|
|
|
46
|
|
235
|
use warnings; |
|
46
|
|
|
|
|
138
|
|
|
46
|
|
|
|
|
1909
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000155'; |
6
|
|
|
|
|
|
|
|
7
|
46
|
|
|
46
|
|
19351
|
use Test2::Workflow::Task::Group; |
|
46
|
|
|
|
|
135
|
|
|
46
|
|
|
|
|
2447
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @BUILD_FIELDS; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
46
|
|
|
46
|
|
1016
|
@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
|
|
|
|
|
108
|
|
|
46
|
|
|
|
|
4493
|
|
22
|
46
|
|
|
46
|
|
312
|
use Test2::Util::HashBase @BUILD_FIELDS, qw/events defaults stack_stop/; |
|
46
|
|
|
|
|
114
|
|
|
46
|
|
|
|
|
214
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub init { |
25
|
135
|
|
|
135
|
0
|
2955
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
{ |
28
|
135
|
|
|
|
|
256
|
local $Carp::CarpLevel = $Carp::CarpLevel + 1; |
|
135
|
|
|
|
|
399
|
|
29
|
135
|
|
|
|
|
726
|
$self->SUPER::init(); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
135
|
|
50
|
|
|
2683
|
$self->{$_} ||= [] for @BUILD_FIELDS; |
33
|
135
|
|
50
|
|
|
869
|
$self->{+DEFAULTS} ||= {}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
for my $field (@BUILD_FIELDS) { |
37
|
|
|
|
|
|
|
my $code = sub { |
38
|
782
|
|
|
782
|
|
1374
|
my $self = shift; |
39
|
782
|
|
|
|
|
1095
|
push @{$self->{$field}} => @_; |
|
782
|
|
|
|
|
4695
|
|
40
|
|
|
|
|
|
|
}; |
41
|
46
|
|
|
46
|
|
34670
|
no strict 'refs'; |
|
46
|
|
|
|
|
124
|
|
|
46
|
|
|
|
|
24590
|
|
42
|
|
|
|
|
|
|
*{"add_$field"} = $code; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub populated { |
46
|
184
|
|
|
184
|
0
|
384
|
my $self = shift; |
47
|
184
|
|
|
|
|
527
|
for my $field (@BUILD_FIELDS) { |
48
|
240
|
100
|
|
|
|
391
|
return 1 if @{$self->{$field}}; |
|
240
|
|
|
|
|
1240
|
|
49
|
|
|
|
|
|
|
} |
50
|
7
|
|
|
|
|
95
|
return 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub compile { |
54
|
145
|
|
|
145
|
0
|
386
|
my $self = shift; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
warn "Workflow build '$self->{+NAME}' is empty " . $self->debug . "\n" |
57
|
145
|
50
|
66
|
|
|
459
|
unless $self->populated || $self->{+SKIP}; |
58
|
|
|
|
|
|
|
|
59
|
145
|
|
|
|
|
449
|
my ($primary_setup, $primary_teardown) = @_; |
60
|
145
|
|
100
|
|
|
947
|
$primary_setup ||= []; |
61
|
145
|
|
100
|
|
|
935
|
$primary_teardown ||= []; |
62
|
|
|
|
|
|
|
|
63
|
145
|
|
|
|
|
417
|
my $variant = $self->{+VARIANT}; |
64
|
145
|
|
|
|
|
392
|
my $setup = $self->{+SETUP}; |
65
|
145
|
|
|
|
|
373
|
my $teardown = $self->{+TEARDOWN}; |
66
|
145
|
|
|
|
|
300
|
my $variant_setup = $self->{+VARIANT_SETUP}; |
67
|
145
|
|
|
|
|
327
|
my $variant_teardown = $self->{+VARIANT_TEARDOWN}; |
68
|
|
|
|
|
|
|
|
69
|
145
|
|
|
|
|
400
|
$primary_setup = [@$primary_setup, @{$self->{+PRIMARY_SETUP}}]; |
|
145
|
|
|
|
|
452
|
|
70
|
145
|
|
|
|
|
309
|
$primary_teardown = [@{$self->{+PRIMARY_TEARDOWN}}, @$primary_teardown]; |
|
145
|
|
|
|
|
413
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Get primaries in order. |
73
|
|
|
|
|
|
|
my $primary = [ |
74
|
|
|
|
|
|
|
map { |
75
|
528
|
100
|
|
|
|
2703
|
$_->isa(__PACKAGE__) |
76
|
|
|
|
|
|
|
? $_->compile($primary_setup, $primary_teardown) |
77
|
|
|
|
|
|
|
: $_; |
78
|
145
|
|
|
|
|
273
|
} @{$self->{+PRIMARY}}, |
|
145
|
|
|
|
|
400
|
|
79
|
|
|
|
|
|
|
]; |
80
|
|
|
|
|
|
|
|
81
|
145
|
100
|
66
|
|
|
1654
|
if (@$primary_setup || @$primary_teardown) { |
82
|
|
|
|
|
|
|
$primary = [ |
83
|
|
|
|
|
|
|
map { |
84
|
83
|
|
|
|
|
234
|
my $p = $_->clone; |
|
311
|
|
|
|
|
1728
|
|
85
|
311
|
100
|
|
|
|
2152
|
$_->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
|
|
|
|
917
|
if (@$variant) { |
97
|
|
|
|
|
|
|
$primary = [ |
98
|
|
|
|
|
|
|
map { |
99
|
54
|
|
|
|
|
319
|
my $v = $_->clone; |
|
108
|
|
|
|
|
463
|
|
100
|
108
|
|
|
|
|
485
|
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
|
|
|
|
1308
|
my %params = map { Test2::Workflow::Task::Group->can($_) ? ($_ => $self->{$_}) : () } keys %$self; |
|
2339
|
|
|
|
|
9681
|
|
112
|
145
|
|
|
|
|
1258
|
delete $params{$_} for @BUILD_FIELDS; |
113
|
|
|
|
|
|
|
|
114
|
145
|
|
|
|
|
830
|
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__ |