Skip to content

Commit 17523cc

Browse files
committed
sj-hierarchy.pl: add mode for reporting CI URLs
1 parent 16ef595 commit 17523cc

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

sj-hierarchy.pl

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# -- Main --
4040

4141
{
42+
my $doCI;
4243
my $doHelp;
4344
my $doList;
4445
my $doParents;
@@ -49,7 +50,8 @@
4950
for my $cmd (@ARGV) {
5051
if ($cmd =~ /^-\w+$/) {
5152
for my $c (split(//, $cmd)) {
52-
if ($c eq 'g') { $doSCM = 1; }
53+
if ($c eq 'c') { $doCI = 1; }
54+
elsif ($c eq 'g') { $doSCM = 1; }
5355
elsif ($c eq 'l') { $doList = 1; }
5456
elsif ($c eq 'p') { $doParents = 1; }
5557
elsif ($c eq 's') { $doStats = 1; }
@@ -58,6 +60,7 @@
5860
elsif ($c eq 'v') { $verbose = 1; }
5961
}
6062
}
63+
elsif ($cmd eq '--ci') { $doCI = 1; }
6164
elsif ($cmd eq '--help') { $doHelp = 1; }
6265
elsif ($cmd eq '--list') { $doList = 1; }
6366
elsif ($cmd eq '--parents') { $doParents = 1; }
@@ -69,11 +72,13 @@
6972
else { warning("Invalid argument: $cmd"); }
7073
}
7174

72-
$doList || $doParents || $doSCM || $doStats || $doTree || ($doHelp = 1);
75+
$doCI || $doList || $doParents || $doSCM || $doStats || $doTree ||
76+
($doHelp = 1);
7377

7478
if ($doHelp) {
7579
print STDERR "Usage: sj-hierachy.pl [-glstqv]\n";
7680
print STDERR "\n";
81+
print STDERR " -c, --ci : list involved CI URLs\n";
7782
print STDERR " -g, --scm : list involved SCM URLs\n";
7883
print STDERR " -l, --list : list SciJava artifacts\n";
7984
print STDERR " -p, --parents : show table of artifact parents\n";
@@ -87,6 +92,9 @@
8792
parse_blacklist();
8893
resolve_artifacts();
8994

95+
if ($doCI) {
96+
list_cis();
97+
}
9098
if ($doList) {
9199
show_list();
92100
}
@@ -211,6 +219,20 @@ ()
211219
dump_tree("org.scijava:pom-scijava", 0);
212220
}
213221

222+
# Makes a list of CIs associated with the artifacts.
223+
sub list_cis() {
224+
for my $ga (keys %versions) {
225+
my $version = version($ga);
226+
$version || next;
227+
my $ci = ci($ga);
228+
if (!$ci) {
229+
warning("No CI for artifact: $ga:$version");
230+
next;
231+
}
232+
output("$ga: $ci");
233+
}
234+
}
235+
214236
# Makes a list of SCMs associated with the artifacts.
215237
sub list_scms() {
216238
my %scms;
@@ -315,6 +337,18 @@ ($)
315337
return "$groupId:$artifactId";
316338
}
317339

340+
# Computes the CI of a GA.
341+
sub ci($) {
342+
my ($ga) = @_;
343+
my $xml = pom_xml($ga);
344+
my $ci = $xml->{ciManagement}->{url};
345+
if (!$ci) {
346+
my $parent = parent($ga);
347+
return $parent && $parent ne ':' ? ci($parent) : undef;
348+
}
349+
return $ci;
350+
}
351+
318352
# Computes the SCM of a GA.
319353
sub scm($) {
320354
my ($ga) = @_;

0 commit comments

Comments
 (0)