line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
13076
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
2
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Maven::Command; |
5
|
|
|
|
|
|
|
$Maven::Command::VERSION = '1.13'; |
6
|
|
|
|
|
|
|
# ABSTRACT: A command builder for mvn |
7
|
|
|
|
|
|
|
# PODNAME: Maven::Command |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
277
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
12
|
|
|
|
|
|
|
mvn_artifact_params |
13
|
|
|
|
|
|
|
mvn_command |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _escape_and_quote { |
17
|
12
|
|
|
12
|
|
10
|
my ($value) = @_; |
18
|
12
|
|
|
|
|
8
|
$value =~ s/\\/\\\\/g; |
19
|
12
|
|
|
|
|
10
|
$value =~ s/"/\\"/g; |
20
|
12
|
|
|
|
|
29
|
return "\"$value\""; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub mvn_artifact_params { |
24
|
1
|
|
|
1
|
1
|
3
|
my ($artifact) = @_; |
25
|
|
|
|
|
|
|
return ( |
26
|
1
|
50
|
|
|
|
5
|
groupId => $artifact->get_groupId(), |
27
|
|
|
|
|
|
|
artifactId => $artifact->get_artifactId(), |
28
|
|
|
|
|
|
|
packaging => $artifact->get_packaging(), |
29
|
|
|
|
|
|
|
( $artifact->get_classifier() |
30
|
|
|
|
|
|
|
? ( classifier => $artifact->get_classifier() ) |
31
|
|
|
|
|
|
|
: () |
32
|
|
|
|
|
|
|
), |
33
|
|
|
|
|
|
|
version => $artifact->get_version() |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub mvn_command { |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# [\%mvn_options], @goals_and_phases, [\%parameters] |
40
|
5
|
100
|
|
5
|
1
|
37
|
my $mvn_options = ref( $_[0] ) eq 'HASH' ? shift : {}; |
41
|
5
|
100
|
|
|
|
15
|
my $parameters = ref( $_[$#_] ) eq 'HASH' ? pop : {}; |
42
|
5
|
|
|
|
|
11
|
my @goals_and_phases = @_; |
43
|
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
6
|
my $mvn_options_string = ''; |
45
|
5
|
|
|
|
|
17
|
foreach my $key ( sort keys(%$mvn_options) ) { |
46
|
5
|
|
|
|
|
9
|
$mvn_options_string .= " $key"; |
47
|
5
|
|
|
|
|
5
|
my $value = $mvn_options->{$key}; |
48
|
5
|
100
|
|
|
|
11
|
if ( defined($value) ) { |
49
|
2
|
50
|
|
|
|
6
|
my $separator = ( $key =~ /^\-D/ ) ? '=' : ' '; |
50
|
2
|
|
|
|
|
4
|
$mvn_options_string .= $separator . _escape_and_quote($value); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $params_string = join( '', |
55
|
5
|
|
|
|
|
18
|
map { " -D$_=" . _escape_and_quote( $parameters->{$_} ); } sort keys(%$parameters) ); |
|
10
|
|
|
|
|
16
|
|
56
|
|
|
|
|
|
|
|
57
|
5
|
|
|
|
|
33
|
return "mvn$mvn_options_string " . join( ' ', @goals_and_phases ) . $params_string; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |