#!/usr/bin/perl

# Internal command - do not use directly.
#
# Finds Dependencies of javadocs.

use strict;
use warnings;
use autodie;

use Debian::Javahelper::Java qw(find_package_for_existing_files scan_javadoc);

my @dep = ();

foreach my $doclink ( map { scan_javadoc($_) } @ARGV){
    next unless ( -f "$doclink/package-list" );
    $doclink = "$doclink/package-list" unless ( -l $doclink);
    push(@dep, $doclink);
}

print join(', ', find_package_for_existing_files(@dep)), "\n" if(@dep);
