forked from OpenNMS/opennms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
assemble.pl
executable file
·63 lines (54 loc) · 1.61 KB
/
assemble.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env perl
use Cwd qw(abs_path);
use File::Basename qw(dirname);
use File::Spec;
# include script functions
use vars qw(
$PREFIX
);
$PREFIX = abs_path(dirname($0));
require(File::Spec->catfile($PREFIX, 'bin', 'functions.pl'));
@profiles = ('default', 'full', 'dir');
my $assembly = File::Spec->catdir($PREFIX, 'opennms-full-assembly');
my $pomfile = File::Spec->catfile($assembly, 'pom.xml');
if (-f $pomfile) {
if (open (FILEIN, $pomfile)) {
@profiles = ();
my $lastline = "";
while (my $line = <FILEIN>) {
chomp($line);
if ($lastline =~ /<name>build.profile<\/name>/) {
if ($line =~ /<value>(.*?)<\/value>/) {
push(@profiles, $1);
}
}
$lastline = $line;
}
close(FILEIN);
} else {
warning("unable to read from $pomfile: $!");
}
}
if (not grep { $_ =~ /^-Dbuild.profile=/ } @ARGS) {
info("No build profile set, using the default. Possible profiles are: " . join(", ", @profiles));
push(@ARGS, '-Dbuild.profile=default');
}
if (not grep { $_ =~ /^[^-]/ } @ARGS) {
debug("no maven targets specified, adding 'install' to the command-line");
push(@ARGS, "install");
}
my @command = ($MVN, @ARGS);
my $corebuilddir = File::Spec->catdir($PREFIX, 'core', 'build');
info("building in $corebuilddir");
chdir($corebuilddir);
info("running:", @command);
handle_errors(system(@command));
my $containerdir = File::Spec->catdir($PREFIX, 'container', 'features');
info("building in $containerdir");
chdir($containerdir);
info("running:", @command);
handle_errors(system(@command));
info("building in $assembly");
chdir($assembly);
info("running:", @command);
handle_errors_and_exit(system(@command));