line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Enbld::Config; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1278
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
101
|
|
4
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
131
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
17
|
use Carp; |
|
3
|
|
|
|
|
56
|
|
|
3
|
|
|
|
|
2586
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Enbld::Exception; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
47
|
|
|
47
|
0
|
11257
|
my $class = shift; |
12
|
|
|
|
|
|
|
|
13
|
47
|
|
|
|
|
290
|
my $self = { |
14
|
|
|
|
|
|
|
name => undef, |
15
|
|
|
|
|
|
|
enabled => undef, |
16
|
|
|
|
|
|
|
installed => {}, |
17
|
|
|
|
|
|
|
@_, |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
47
|
|
|
|
|
125
|
bless $self, $class; |
21
|
|
|
|
|
|
|
|
22
|
47
|
|
|
|
|
180
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub name { |
26
|
22
|
|
|
22
|
0
|
327
|
return $_[0]->{name}; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub installed { |
30
|
4
|
|
|
4
|
0
|
34
|
return $_[0]->{installed}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub condition { |
34
|
29
|
|
|
29
|
0
|
81
|
my ( $self, $version ) = @_; |
35
|
|
|
|
|
|
|
|
36
|
29
|
|
|
|
|
147
|
require Enbld::Condition; |
37
|
|
|
|
|
|
|
|
38
|
29
|
100
|
|
|
|
168
|
if ( ! $version ) { |
39
|
25
|
|
|
|
|
97
|
return Enbld::Condition->new( |
40
|
25
|
|
|
|
|
148
|
%{ $self->{installed}{$self->enabled} } |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
4
|
100
|
|
|
|
25
|
if ( exists $self->{installed}{$version} ) { |
45
|
3
|
|
|
|
|
31
|
return Enbld::Condition->new( |
46
|
3
|
|
|
|
|
9
|
%{ $self->{installed}{$version} } |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
5
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub is_installed_version { |
54
|
7
|
|
|
7
|
0
|
28
|
my ( $self, $version ) = @_; |
55
|
|
|
|
|
|
|
|
56
|
7
|
100
|
|
|
|
24
|
return unless $version; |
57
|
6
|
100
|
|
|
|
12
|
return unless keys %{ $self->{installed} }; |
|
6
|
|
|
|
|
29
|
|
58
|
|
|
|
|
|
|
|
59
|
5
|
100
|
|
|
|
26
|
return $version if ( exists $self->{installed}{$version} ); |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
|
|
|
7
|
return; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub enabled { |
65
|
98
|
|
|
98
|
0
|
1663
|
return $_[0]->{enabled}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub drop_enabled { |
69
|
2
|
|
|
2
|
0
|
7
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
2
|
|
|
|
|
8
|
return ( $self->{enabled} = undef ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub set_enabled { |
75
|
48
|
|
|
48
|
0
|
5699
|
my ( $self, $version, $condition ) = @_; |
76
|
|
|
|
|
|
|
|
77
|
48
|
|
|
|
|
175
|
$self->{enabled} = $version; |
78
|
48
|
|
|
|
|
260
|
$self->{installed}{$version} = $condition->serialize; |
79
|
|
|
|
|
|
|
|
80
|
48
|
|
|
|
|
580
|
return $self->{enabled}; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub serialize { |
84
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
2
|
my $serialized; |
87
|
1
|
|
|
|
|
2
|
foreach my $key ( sort keys %{ $self } ) { |
|
1
|
|
|
|
|
4
|
|
88
|
3
|
|
|
|
|
7
|
$serialized->{$key} = $self->{$key}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
1
|
|
|
|
|
5
|
return $serialized; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub DSL { |
95
|
3
|
|
|
3
|
0
|
9
|
my $self = shift; |
96
|
|
|
|
|
|
|
|
97
|
3
|
|
|
|
|
5
|
my @config; |
98
|
|
|
|
|
|
|
|
99
|
3
|
|
|
|
|
683
|
require Enbld::Feature; |
100
|
3
|
100
|
|
|
|
12
|
my $version = Enbld::Feature->is_current_mode ? |
101
|
|
|
|
|
|
|
$self->enabled : $self->condition->version; |
102
|
|
|
|
|
|
|
|
103
|
3
|
|
|
|
|
9
|
push @config, "target '" . $self->name . "' => define {\n"; |
104
|
3
|
|
|
|
|
7
|
push @config, " version '". $version . "';\n"; |
105
|
3
|
100
|
|
|
|
7
|
if ( $self->condition->make_test ) { |
106
|
1
|
|
|
|
|
3
|
push @config, " make_test '" . $self->condition->make_test . "';\n"; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
3
|
50
|
|
|
|
13
|
if ( $self->condition->arguments ) { |
110
|
0
|
|
|
|
|
0
|
push @config, " arguments '" . $self->condition->arguments . "';\n"; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
3
|
50
|
|
|
|
9
|
if ( $self->condition->annotation ) { |
114
|
0
|
|
|
|
|
0
|
push @config, " annotation '" . $self->condition->annotation ."';\n"; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
3
|
50
|
|
|
|
10
|
if ( $self->condition->module_file ) { |
118
|
0
|
|
|
|
|
0
|
push @config, " module_file '" . $self->condition->module_file ."';\n"; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
3
|
|
|
|
|
8
|
push @config, "};\n"; |
123
|
|
|
|
|
|
|
|
124
|
3
|
|
|
|
|
11
|
return \@config; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; |