line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TeamCity::BuildMessages; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
84075
|
use 5.008004; |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
208
|
|
4
|
3
|
|
|
3
|
|
19
|
use utf8; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
24
|
|
5
|
3
|
|
|
3
|
|
122
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
103
|
|
6
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
100
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
1075
|
use version; our $VERSION = qv('v0.999.3'); |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
24
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
2624
|
use autodie qw< :default >; |
|
3
|
|
|
|
|
53078
|
|
|
3
|
|
|
|
|
32
|
|
13
|
3
|
|
|
3
|
|
23081
|
use Carp qw< croak >; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
240
|
|
14
|
3
|
|
|
3
|
|
1523
|
use Readonly; |
|
3
|
|
|
|
|
4140
|
|
|
3
|
|
|
|
|
183
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
3
|
|
3856
|
use IO::Handle; # Create methods on standard filehandles like STDOUT. |
|
3
|
|
|
|
|
32936
|
|
|
3
|
|
|
|
|
212
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
|
61
|
use Exporter qw< import >; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1960
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our @EXPORT_OK = |
23
|
|
|
|
|
|
|
qw< |
24
|
|
|
|
|
|
|
teamcity_escape |
25
|
|
|
|
|
|
|
teamcity_emit_build_message |
26
|
|
|
|
|
|
|
>; |
27
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
28
|
|
|
|
|
|
|
all => [@EXPORT_OK], |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Readonly::Scalar my $IDENTIFIER_REGEX => qr< \A \w [\w\d]* \z >xms; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub teamcity_escape { |
36
|
15
|
|
|
15
|
1
|
13250
|
my ($original) = @_; |
37
|
|
|
|
|
|
|
|
38
|
15
|
|
|
|
|
74
|
(my $escaped = $original) =~ s< ( ['|\]] ) ><|$1>xmsg; |
39
|
15
|
|
|
|
|
33
|
$escaped =~ s< \n ><|n>xmsg; |
40
|
15
|
|
|
|
|
30
|
$escaped =~ s< \r ><|r>xmsg; |
41
|
|
|
|
|
|
|
|
42
|
15
|
|
|
|
|
84
|
return $escaped; |
43
|
|
|
|
|
|
|
} # end teamcity_escape() |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub teamcity_emit_build_message { ## no critic (RequireArgUnpacking) |
47
|
0
|
|
|
0
|
1
|
0
|
_emit_build_message_to_handle(\*STDOUT, @_); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
0
|
return; |
50
|
|
|
|
|
|
|
} # end teamcity_emit_build_message() |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _emit_build_message_to_handle { |
54
|
10
|
|
|
10
|
|
23317
|
my ($handle, $message, @values) = @_; |
55
|
|
|
|
|
|
|
|
56
|
10
|
100
|
|
|
|
71
|
croak 'No message specified.' if not $message; |
57
|
9
|
100
|
|
|
|
33
|
croak 'No values specified.' if not @values; |
58
|
8
|
100
|
|
|
|
69
|
croak qq<"$message" is not a valid message name.> |
59
|
|
|
|
|
|
|
if $message !~ $IDENTIFIER_REGEX; |
60
|
|
|
|
|
|
|
|
61
|
7
|
|
|
|
|
10
|
print {$handle} "##teamcity[$message"; |
|
7
|
|
|
|
|
28
|
|
62
|
|
|
|
|
|
|
|
63
|
7
|
100
|
|
|
|
24
|
if (@values == 1) { |
64
|
3
|
|
|
|
|
4
|
print {$handle} q< '>, teamcity_escape($values[0]), q<'>; |
|
3
|
|
|
|
|
13
|
|
65
|
|
|
|
|
|
|
} else { |
66
|
4
|
100
|
|
|
|
14
|
if (@values % 2) { |
67
|
1
|
|
|
|
|
10
|
croak 'Message property given without a value.'; |
68
|
|
|
|
|
|
|
} # end if |
69
|
|
|
|
|
|
|
|
70
|
3
|
|
|
|
|
11
|
while (@values) { |
71
|
4
|
|
|
|
|
8
|
my $name = shift @values; |
72
|
4
|
|
|
|
|
8
|
my $value = shift @values; |
73
|
|
|
|
|
|
|
|
74
|
4
|
100
|
|
|
|
33
|
croak qq<"$name" is not a valid property name.> |
75
|
|
|
|
|
|
|
if $name !~ $IDENTIFIER_REGEX; |
76
|
|
|
|
|
|
|
|
77
|
3
|
|
|
|
|
6
|
print {$handle} qq< $name='>, teamcity_escape($value), q<'>; |
|
3
|
|
|
|
|
33
|
|
78
|
|
|
|
|
|
|
} # end while |
79
|
|
|
|
|
|
|
} # end if |
80
|
|
|
|
|
|
|
|
81
|
5
|
|
|
|
|
11
|
print {$handle} "]\n"; |
|
5
|
|
|
|
|
10
|
|
82
|
|
|
|
|
|
|
|
83
|
5
|
|
|
|
|
14
|
return; |
84
|
|
|
|
|
|
|
} # end _emit_build_message_to_handle() |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; # Magic true value required at end of module. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |