use Cwd qw(abs_path getcwd);
use File::Path qw(make_path remove_tree);
print("configring casaviewer for building...\n");
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
$File::Fetch::BLACKLIST = [qw|lwp httptiny httplite|];
$path = abs_path(dirname($exe));
$jarfile_name = "create-app-assembly-1.12.jar";
open(JAVAVER, "$java -version 2>&1 |");
if ( m|version "?(\d+)\.(\d+)|i ) {
print "found java version ", join('.',@java_version), "\n";
die "cannot run $java" unless scalar(@java_version) > 0;
die "java version 1.8 or greater is required\n" unless $java_version[0] == 1 && $java_version[1] >= 8;
$distro_jarfile = $jarfile = "$path/java/$jarfile_name";
$jarfile = "$path/../target/scala-2.12/$jarfile_name";
$jarfile = $distro_jarfile;
### pull from download url
my $jardir = dirname($jarfile);
my $ff = File::Fetch->new(uri => "http://casa.nrao.edu/download/devel/xml-casa/java/$jarfile_name");
my $where = $ff->fetch( to => $jardir );
die "configuration error, cannot find jar file ($jarfile_name)" unless -e $jarfile;
if ( $Config{osname} eq "darwin" && ! -e "casaviewer.icns" ) {
my $ff = File::Fetch->new(uri => "http://casa.nrao.edu/download/devel/xml-casa/viewer/casaviewer.icns");
open(VER,"cd casa-source/casa5 && code/install/resolvegitrevision.sh --pretty-print 2>&1 |");