line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
15490
|
use strict; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
157
|
|
2
|
7
|
|
|
7
|
|
39
|
use warnings; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
290
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Maven::Artifact; |
5
|
|
|
|
|
|
|
$Maven::Artifact::VERSION = '1.12'; |
6
|
|
|
|
|
|
|
# ABSTRACT: An maven artifact definition |
7
|
|
|
|
|
|
|
# PODNAME: Maven::Artifact |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload |
10
|
7
|
|
|
|
|
46
|
fallback => 1, |
11
|
7
|
|
|
7
|
|
952
|
q{""} => 'to_string'; |
|
7
|
|
|
|
|
740
|
|
12
|
7
|
|
|
7
|
|
1192
|
use parent qw(Class::Accessor); |
|
7
|
|
|
|
|
455
|
|
|
7
|
|
|
|
|
25
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->follow_best_practice; |
14
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(groupId artifactId version classifier artifact_name url)); |
15
|
|
|
|
|
|
|
|
16
|
7
|
|
|
7
|
|
3701
|
use Carp qw(croak); |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
301
|
|
17
|
7
|
|
|
7
|
|
2369
|
use File::Copy; |
|
7
|
|
|
|
|
8875
|
|
|
7
|
|
|
|
|
324
|
|
18
|
7
|
|
|
7
|
|
4582
|
use File::Temp; |
|
7
|
|
|
|
|
100127
|
|
|
7
|
|
|
|
|
441
|
|
19
|
7
|
|
|
7
|
|
803
|
use Log::Any; |
|
7
|
|
|
|
|
16760
|
|
|
7
|
|
|
|
|
42
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
2
|
|
|
2
|
1
|
14
|
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
|
|
|
2
|
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
|
731
|
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
|
|
|
|
6
|
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
|
|
|
|
|
4
|
my $count = scalar(@parts); |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
7
|
$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
|
|
|
|
10
|
if ( $count == 3 ) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
71
|
1
|
50
|
|
|
|
5
|
$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
|
|
|
|
4
|
$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
|
|
|
|
|
67
|
$self->{groupId} = $coordinate->{groupId}; |
95
|
2
|
|
|
|
|
4
|
$self->{artifactId} = $coordinate->{artifactId}; |
96
|
2
|
|
|
|
|
4
|
$self->{version} = $coordinate->{version}; |
97
|
2
|
|
|
|
|
4
|
$self->{packaging} = $coordinate->{packaging}; |
98
|
2
|
|
|
|
|
2
|
$self->{classifier} = $coordinate->{classifier}; |
99
|
|
|
|
|
|
|
|
100
|
2
|
|
|
|
|
8
|
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
|
438
|
return $_[0]->get_coordinate(); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |