line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
19624
|
use strict; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
189
|
|
2
|
7
|
|
|
7
|
|
54
|
use warnings; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
409
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Maven::Artifact; |
5
|
|
|
|
|
|
|
$Maven::Artifact::VERSION = '1.14'; |
6
|
|
|
|
|
|
|
# ABSTRACT: An maven artifact definition |
7
|
|
|
|
|
|
|
# PODNAME: Maven::Artifact |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload |
10
|
7
|
|
|
|
|
39
|
fallback => 1, |
11
|
7
|
|
|
7
|
|
1132
|
q{""} => 'to_string'; |
|
7
|
|
|
|
|
1014
|
|
12
|
7
|
|
|
7
|
|
1420
|
use parent qw(Class::Accessor); |
|
7
|
|
|
|
|
572
|
|
|
7
|
|
|
|
|
45
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->follow_best_practice; |
14
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(groupId artifactId version classifier artifact_name url)); |
15
|
|
|
|
|
|
|
|
16
|
7
|
|
|
7
|
|
4930
|
use Carp qw(croak); |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
359
|
|
17
|
7
|
|
|
7
|
|
2791
|
use File::Copy; |
|
7
|
|
|
|
|
11342
|
|
|
7
|
|
|
|
|
448
|
|
18
|
7
|
|
|
7
|
|
6089
|
use File::Temp; |
|
7
|
|
|
|
|
130931
|
|
|
7
|
|
|
|
|
542
|
|
19
|
7
|
|
|
7
|
|
948
|
use Log::Any; |
|
7
|
|
|
|
|
20994
|
|
|
7
|
|
|
|
|
43
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
2
|
|
|
2
|
1
|
25
|
my ( $class, @args ) = @_; |
25
|
2
|
|
|
|
|
14
|
return bless( {}, $class )->_init(@args); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub get_coordinate { |
29
|
1
|
|
|
1
|
1
|
3
|
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
|
2116
|
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
|
|
7
|
my ( $self, $coordinate, %parts ) = @_; |
55
|
|
|
|
|
|
|
|
56
|
2
|
50
|
|
|
|
11
|
if ( !( ref($coordinate) eq 'HASH' ) ) { |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# coordinate order is specified per |
59
|
|
|
|
|
|
|
# https://maven.apache.org/pom.html#Maven_Coordinates |
60
|
2
|
|
|
|
|
17
|
my @parts = split( /:/, $coordinate, -1 ); |
61
|
2
|
|
|
|
|
5
|
my $count = scalar(@parts); |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
11
|
$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
|
|
|
|
16
|
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
|
|
|
|
|
5
|
$coordinate->{packaging} = $parts[2]; |
79
|
1
|
50
|
|
|
|
7
|
$coordinate->{classifier} = $parts[3] if ( $parts[3] ); |
80
|
1
|
50
|
|
|
|
19
|
$coordinate->{version} = $parts[4] if ( $parts[4] ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
11
|
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
|
|
|
|
|
99
|
$self->{groupId} = $coordinate->{groupId}; |
95
|
2
|
|
|
|
|
6
|
$self->{artifactId} = $coordinate->{artifactId}; |
96
|
2
|
|
|
|
|
5
|
$self->{version} = $coordinate->{version}; |
97
|
2
|
|
|
|
|
5
|
$self->{packaging} = $coordinate->{packaging}; |
98
|
2
|
|
|
|
|
4
|
$self->{classifier} = $coordinate->{classifier}; |
99
|
|
|
|
|
|
|
|
100
|
2
|
|
|
|
|
12
|
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
|
1367
|
return $_[0]->get_coordinate(); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |