line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
27921
|
use strict; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
193
|
|
2
|
7
|
|
|
7
|
|
40
|
use warnings; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
350
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Maven::Artifact; |
5
|
|
|
|
|
|
|
$Maven::Artifact::VERSION = '1.13'; |
6
|
|
|
|
|
|
|
# ABSTRACT: An maven artifact definition |
7
|
|
|
|
|
|
|
# PODNAME: Maven::Artifact |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload |
10
|
7
|
|
|
|
|
45
|
fallback => 1, |
11
|
7
|
|
|
7
|
|
1646
|
q{""} => 'to_string'; |
|
7
|
|
|
|
|
780
|
|
12
|
7
|
|
|
7
|
|
1270
|
use parent qw(Class::Accessor); |
|
7
|
|
|
|
|
500
|
|
|
7
|
|
|
|
|
27
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->follow_best_practice; |
14
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(groupId artifactId version classifier artifact_name url)); |
15
|
|
|
|
|
|
|
|
16
|
7
|
|
|
7
|
|
3865
|
use Carp qw(croak); |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
319
|
|
17
|
7
|
|
|
7
|
|
2288
|
use File::Copy; |
|
7
|
|
|
|
|
9755
|
|
|
7
|
|
|
|
|
395
|
|
18
|
7
|
|
|
7
|
|
5254
|
use File::Temp; |
|
7
|
|
|
|
|
119204
|
|
|
7
|
|
|
|
|
502
|
|
19
|
7
|
|
|
7
|
|
841
|
use Log::Any; |
|
7
|
|
|
|
|
17569
|
|
|
7
|
|
|
|
|
54
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
2
|
|
|
2
|
1
|
15
|
my ( $class, @args ) = @_; |
25
|
2
|
|
|
|
|
9
|
return bless( {}, $class )->_init(@args); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub get_coordinate { |
29
|
1
|
|
|
1
|
1
|
2
|
my ($self) = @_; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
33
|
|
|
3
|
return join( ':', |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
32
|
|
|
|
|
|
|
$self->get_groupId() || (), |
33
|
|
|
|
|
|
|
$self->get_artifactId() || (), |
34
|
|
|
|
|
|
|
$self->get_packaging() || (), |
35
|
|
|
|
|
|
|
$self->get_classifier() || (), |
36
|
|
|
|
|
|
|
$self->get_version() || () ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub get_packaging { |
40
|
3
|
|
100
|
3
|
1
|
1044
|
return shift->{packaging} || 'jar'; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub get_uri { |
44
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
0
|
if ( !$self->{uri} ) { |
47
|
0
|
|
|
|
|
0
|
$self->{uri} = URI->new( $self->{url} ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
0
|
return $self->{uri}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _init { |
54
|
2
|
|
|
2
|
|
5
|
my ( $self, $coordinate, %parts ) = @_; |
55
|
|
|
|
|
|
|
|
56
|
2
|
50
|
|
|
|
7
|
if ( !( ref($coordinate) eq 'HASH' ) ) { |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# coordinate order is specified per |
59
|
|
|
|
|
|
|
# https://maven.apache.org/pom.html#Maven_Coordinates |
60
|
2
|
|
|
|
|
10
|
my @parts = split( /:/, $coordinate, -1 ); |
61
|
2
|
|
|
|
|
3
|
my $count = scalar(@parts); |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
5
|
$coordinate = { |
64
|
|
|
|
|
|
|
groupId => $parts[0], |
65
|
|
|
|
|
|
|
artifactId => $parts[1] |
66
|
|
|
|
|
|
|
}; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Version could be empty string implying we should detect the latest |
69
|
|
|
|
|
|
|
# so dont set it here. |
70
|
2
|
100
|
|
|
|
11
|
if ( $count == 3 ) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
71
|
1
|
50
|
|
|
|
6
|
$coordinate->{version} = $parts[2] if ( $parts[2] ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
elsif ( $count == 4 ) { |
74
|
0
|
|
|
|
|
0
|
$coordinate->{packaging} = $parts[2]; |
75
|
0
|
0
|
|
|
|
0
|
$coordinate->{version} = $parts[3] if ( $parts[3] ); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
elsif ( $count == 5 ) { |
78
|
1
|
|
|
|
|
2
|
$coordinate->{packaging} = $parts[2]; |
79
|
1
|
50
|
|
|
|
3
|
$coordinate->{classifier} = $parts[3] if ( $parts[3] ); |
80
|
1
|
50
|
|
|
|
4
|
$coordinate->{version} = $parts[4] if ( $parts[4] ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
7
|
foreach my $part ( keys(%parts) ) { |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# only set the part if it has a non-empty value |
86
|
0
|
|
|
|
|
0
|
my $part_value = $parts{$part}; |
87
|
0
|
0
|
|
|
|
0
|
if ($part_value) { |
88
|
0
|
|
|
|
|
0
|
$logger->tracef( 'setting %s to \'%s\'', $part, $part_value ); |
89
|
0
|
|
|
|
|
0
|
$coordinate->{$part} = $part_value; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
2
|
|
|
|
|
74
|
$self->{groupId} = $coordinate->{groupId}; |
95
|
2
|
|
|
|
|
3
|
$self->{artifactId} = $coordinate->{artifactId}; |
96
|
2
|
|
|
|
|
4
|
$self->{version} = $coordinate->{version}; |
97
|
2
|
|
|
|
|
2
|
$self->{packaging} = $coordinate->{packaging}; |
98
|
2
|
|
|
|
|
3
|
$self->{classifier} = $coordinate->{classifier}; |
99
|
|
|
|
|
|
|
|
100
|
2
|
|
|
|
|
10
|
return $self; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub set_packaging { |
104
|
0
|
|
|
0
|
1
|
0
|
my ( $self, $packaging ) = @_; |
105
|
0
|
|
|
|
|
0
|
$self->{packaging} = $packaging; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub to_string { |
109
|
1
|
|
|
1
|
1
|
652
|
return $_[0]->get_coordinate(); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |