#!/usr/bin/env perl

# Script to convert generated coverage data to readable coverage
# report (HTML).

# Does not need Java8
my $JAVA = "c:/apps/Java/jdk1.8.0/bin/java" ;
# used separator in class-path
my $CPseparator = ";" ;

my $targetHome = "joda-time-2.3" ;
my $targetClassDir = "../" . $targetHome . "/classes" ;
my $targetSrcDir = "../" . $targetHome . "/src/main/java" ;

my $coberturaHome = "c:/apps/cobertura" ;
my $coberturaJar  = $coberturaHome . "/cobertura-2.0.3.jar" ;
my $reportTool = "net.sourceforge.cobertura.reporting.Main" ;

my $classpath = "\'" . $coberturaJar
                . $CPseparator 
                . $targetClassDir
                . $CPseparator 
                . $coberturaHome . "/lib/*"
                . "\'" ;
                
              
sub mkReport {
 system(
     $JAVA . " -cp " . $classpath
     . " " . $reportTool 
     . " --format html"
     . " --datafile ./coverage/joda.ser"
     . " --destination ./report/joda"
     . " " . $targetSrcDir
    ) ;
}

# to produce report:
mkReport()