<?xml version="1.0" encoding="UTF-8"?>
<project name="common build script" default="all" basedir=".">
    <description>Builds project</description>      
    
      
    
    <property name="DISTLIBRARIESFULLDIR" value="${DISTRIBUTIONDIR}/${DISTLIBRARIESDIRNAME}"/>    
    <patternset id="compiler.resources">
        <include name="**/?*.properties"/>        
        <include name="**/?*.bin"/>
        <include name="**/?*.xml"/>
        <include name="**/?*.txt"/>
        <include name="**/?*.gif"/>
        <include name="**/?*.png"/>
        <include name="**/?*.jpeg"/>
        <include name="**/?*.jpg"/>
        <include name="**/?*.html"/>
        <include name="**/?*.dtd"/>
        <include name="**/?*.tld"/>
        <include name="**/?*.mid"/>
        <include name="**/?*.wav"/>
        <include name="**/?*.js"/>
        <include name="**/?*.swf"/>
    </patternset>
    
    <path id="emma.lib">
        <pathelement location="${TESTLIBDIR}/emma.jar"/>
        <pathelement location="${TESTLIBDIR}/emma_ant.jar"/>
    </path>
    <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>

    <target name="-loadversion" depends="-loadversion-prop,-loadversion-private">
        
    </target>
    <target name="-loadversion-private" unless="newversion.type">
        <property name="version.major" value="0" />
        <property name="version.minor" value="0" />
        <property name="version.release" value="0" />
        <property name="version.major" value="0" />
        <property name="version.build" value="0" />
        <!-- <property name="version.revision" value="" /> -->
        <property name="version.debug" value="true" />
        
        <property name="VERSION" value="${version.major}.${version.minor}.${version.release}" />
        <property name="VERSIONNUMBER" value="${version.major}.${version.minor}.${version.release}.${version.build}" />  
        <property name="PRIVATE" value="true" />        
    </target>
    <target name="-loadversion-prop" if="newversion.type">
        <loadproperties srcfile="version.properties" prefix="version"/> 
        <property name="VERSION" value="${version.major}.${version.minor}.${version.release}" />
        <property name="VERSIONNUMBER" value="${version.major}.${version.minor}.${version.release}.${version.build}" />  
        <script language="javascript">
            if(project.getProperty("version.debug")=="true"){
                project.setProperty("NIGHTLY",true);
            }
        </script>
        <echo level="info" message="Loaded Version:${version.major}.${version.minor}.${version.release}.${version.build}"/>
    </target>
    
    <target name="coverage.instrumentation">
        <mkdir dir="${INSTRDIR}"/>
        <mkdir dir="${COVERAGEDIR}"/>
        <emma>
            <instr instrpath="${COMPILEDIR}" destdir="${INSTRDIR}" metadatafile="${COVERAGEDIR}/metadata.emma"
                   mode="copy">
            </instr>
        </emma>
        <copy todir="${INSTRDIR}">
            <fileset dir="${SOURCEDIR}">
                <patternset refid="compiler.resources" />
                <type type="file" />
            </fileset>
        </copy>
    </target>

    <target name="compile">
        <!--<delete dir="${COMPILEDIR}"/>-->        
        <mkdir dir="${COMPILEDIR}"/>
        <javac srcdir="${SOURCEDIR}" destdir="${COMPILEDIR}" includes="**/*.java" target="${TARGETJAVA}" source="${TARGETJAVA}" debug="true"
               debuglevel="lines,vars,source" includeantruntime="false" encoding="utf-8">
            <compilerarg line="-Xlint:unchecked"/> <!-- For Java 8: -Xdiags:verbose -->
            <classpath>
                <fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
            </classpath>
        </javac>
        <copy todir="${COMPILEDIR}">
            <fileset dir="${SOURCEDIR}">
                <patternset refid="compiler.resources"/>
                <type type="file"/>
            </fileset>
        </copy>
    </target>
    
    <target name="compile-tests">
        <delete dir="${COMPILETESTSDIR}"/>
        <mkdir dir="${COMPILETESTSDIR}"/>
        <javac srcdir="${TESTDIR}" destdir="${COMPILETESTSDIR}" includes="**/*.java" target="${TARGETJAVA}" source="${TARGETJAVA}" debug="true" includeantruntime="false" encoding="utf-8">                        
            <classpath>
                <pathelement path="${COMPILEDIR}"/>
                <fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
                <fileset dir="${TESTLIBDIR}" includes="**/*.jar"/>
            </classpath>
        </javac>
    </target>

    <target name="test" depends="test_lib,compile,compile-tests">
        <delete dir="${TESTRESULTSDIR}"/>
        <mkdir dir="${TESTRESULTSDIR}"/>
        <mkdir dir="${TESTRESULTSDIR}/raw/"/>
        
        <antcall target="coverage.instrumentation"/>
        
        <taskdef classname="org.testng.TestNGAntTask" classpath="${TESTLIBDIR}/testng-6.8.jar" name="testng" />
    
        
        <testng 
            outputDir="${TESTRESULTSDIR}"
            haltOnFailure="false" verbose="2" workingDir="${basedir}" >
        
            <classpath>
                <pathelement path="${COMPILETESTSDIR}"/>
                <pathelement path="${INSTRDIR}"/>
                <pathelement path="${COMPILEDIR}"/>
                <fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
                <fileset dir="${TESTLIBDIR}" includes="**/*.jar"/>
            </classpath>
            <jvmarg value="-noverify" />
            <jvmarg value="-Demma.coverage.out.file=${COVERAGEDIR}/coverage.emma"/>
            <jvmarg value="-Demma.coverage.out.merge=true"/>
            <classfileset dir="${COMPILETESTSDIR}" includes="**/*.class" />                        
            
        </testng>                
        <!-- Coverage report -->
        <mkdir dir="${COVERAGERESULTSDIR}"/>
        <emma>
            <report sourcepath="${SOURCEDIR}" depth="method">
                <fileset dir="${COVERAGEDIR}">
                    <include name="*.emma"/>
                </fileset>
                <html outfile="${COVERAGERESULTSDIR}/index.html" />
            </report>
        </emma>
    </target>
    
    <condition property="is_windows">
        <os family="windows"/>
    </condition>
    
    
    
    <target name="installer" depends="-loadversion,-load-tools,dist">
        <taskdef name="nsis" classname="com.danielreese.nsisant.Task">
            <classpath location="${basedir}/nsisant-1.3.jar" />
        </taskdef>
        <property name="exe.file" value="${RELEASESDIR}/${PREFIXFILENAME}_${VERSION}${VERSIONSUFFIX}_setup.exe"/>       
        <nsis script="installer.nsi" path="${nsis.path}" verbosity="2">
            <define name="APP_NAME" value="${PRODUCTNAME}"/>
            <define name="APP_VER" value="${VERSION}${VERSIONSUFFIX}"/>
            <define name="APP_VER_MAJOR" value="${version.major}"/>
            <define name="APP_VER_MINOR" value="${version.minor}"/>
            <define name="APP_PUBLISHER" value="${VENDOR}"/>
            <define name="APP_URL" value="${PRODUCTURL}"/>
            <define name="APP_SETUPFILE" value="${exe.file}" />
            <define name="JRE_VERSION" value="${TARGETJAVA}" />
        </nsis>
        <echo level="info" message="Setup created in ${exe.file}"/>
    </target>
    
    <target name="library" depends="-loadversion,build_lib">
        <mkdir dir="${RELEASESDIR}"/>
        <copy file="${CORELIBPATH}" tofile="${RELEASESDIR}/${PREFIXFILENAME}_${VERSION}${VERSIONSUFFIX}_lib.jar"/>
    </target>
    
    <target name="archive" depends="-loadversion,dist">
        <mkdir dir="${RELEASESDIR}"/>
        <property  name="zip.file" value="${RELEASESDIR}/${PREFIXFILENAME}_${VERSION}${VERSIONSUFFIX}.zip" />
        <zip destfile="${zip.file}" basedir="${DISTRIBUTIONDIR}" excludes="ffdec.sh">
            <zipfileset dir="${DISTRIBUTIONDIR}" includes="ffdec.sh" fullpath="ffdec.sh" filemode="755"/>
        </zip>
    </target>
    <target name="-set-gui-type">
        <property name="EXETYPE" value="gui" />
    </target>
    <target name="-set-console-type">
      <property name="EXETYPE" value="console" />
    </target>
    <target name="-exe-config" depends="-loadversion"> 
        <echoxml file="${EXECONFIG}">
            <launch4jConfig>
                <dontWrapJar>true</dontWrapJar>
                <headerType>${EXETYPE}</headerType>
                <jar>${JARFILENAME}.jar</jar>
                <outfile>${DISTRIBUTIONDIR}/${EXEFILENAME}.exe</outfile>
                <errTitle></errTitle>
                <cmdLine></cmdLine>
                <chdir></chdir>
                <priority>normal</priority>
                <downloadUrl>http://java.com/download</downloadUrl>
                <supportUrl></supportUrl>
                <customProcName>false</customProcName>
                <stayAlive>false</stayAlive>
                <restartOnCrash>false</restartOnCrash>
                <manifest></manifest>
                <icon>${EXEICON}</icon>
                <jre>
                    <path></path>
                    <minVersion>${MINJAVAVERSION}</minVersion>
                    <maxVersion></maxVersion>
                    <jdkPreference>preferJre</jdkPreference>
                    <runtimeBits>64/32</runtimeBits>
                    <maxHeapPercent>${MAXHEAPSIZEPERCENT}</maxHeapPercent>
                    <opt>-Djava.net.preferIPv4Stack=true</opt>
                </jre>
                <splash>
                    <file>graphics/splash.bmp</file>
                    <waitForWindow>true</waitForWindow>
                    <timeout>60</timeout>
                    <timeoutErr>true</timeoutErr>
                </splash>
                <versionInfo>
                    <fileVersion>${VERSIONNUMBER}</fileVersion>
                    <txtFileVersion>${VERSION}${VERSIONSUFFIX}</txtFileVersion>
                    <fileDescription>${PRODUCTNAME}</fileDescription>
                    <copyright>${VENDOR}</copyright>
                    <productVersion>${VERSIONNUMBER}</productVersion>
                    <txtProductVersion>${VERSION}${VERSIONSUFFIX}</txtProductVersion>
                    <productName>${PRODUCTNAME}</productName>
                    <companyName></companyName>
                    <internalName>${INTERNALNAME}</internalName>
                    <originalFilename>${EXEFILENAME}.exe</originalFilename>
                </versionInfo>
            </launch4jConfig>
        </echoxml>
    </target>    
    <target name="-exe-linux" unless="is_windows" depends="-load-tools,-exe-config">
        <exec dir="${launch4j.path}" executable="${launch4j.path}/launch4j" failonerror="true">
            <arg file="${EXECONFIG}" />
        </exec>
    </target>
    <target name="-exe-windows" if="is_windows" depends="-load-tools,-exe-config">
        <exec dir="${launch4j.path}" executable="${launch4j.path}\launch4jc.exe" failonerror="true">
            <arg file="${EXECONFIG}" />
        </exec>
    </target>   
    <target name="exe" depends="-set-gui-type,-exe-linux,-exe-windows">
        
    </target>
    
    
    <target name="-check-tools">
        <available file="tools.properties" property="tools.config.exists"/>
    </target>
    
    <target name="-load-tools-ok" if="tools.config.exists">
        <loadproperties srcfile="tools.properties" />
    </target>
    
    <target name="-load-tools-fail" unless="tools.config.exists">
        <fail>
            tools.properties NOT found.
            Please create file named "tools.properties" and add two lines:
            nsis.path = Path to Nullsoft Install System
            launch4j.path = Path to launch4j
            
            WARNING: You must use double backslash in paths on Windows System or forward slash
        </fail>
    </target>
    
    <target name="-load-tools" depends="-check-tools,-load-tools-ok,-load-tools-fail">
        
    </target>
    <target name="exe-console" depends="-set-console-type,-exe-linux,-exe-windows">

    </target>

    <target name="release" depends="library,archive,installer,locales">        

    </target>
         
    <target name="all" depends="clean,build,test,javadoc,release">    
        
    </target>                    
    
    <target name="-upload-fail" unless="upload.config.exists">
        <fail message="Cannot upload - Website properties file missing. Create file named jpexs_website.properties and put username=xxx, password=yyy lines in there" />             
    </target>
    
    <target name="-set-none-newversion" unless="newversion.type">
        <property name="newversion.type" value="none"/>
    </target>
    <target name="-check-version-online" depends="-set-none-newversion,git-tag">      
        <loadproperties srcfile="jpexs_website.properties" prefix="website"/>
        <echo level="info">Checking version online: ${newversion.type}...</echo>
        <!-- Note: You must have developer account to upload to JPEXS website -->
        <java jar="uploader.jar" fork="true" failonerror="true" outputproperty="newversion.prop">    
            <arg value="${website.version.url}" />                

            <arg value="-field" />
            <arg value="mode" />
            <arg value="commandline" />
            
            <arg value="-field" />
            <arg value="set_username" />
            <arg value="${website.username}" />

            <arg value="-field" />
            <arg value="set_password" />            
            <arg value="${website.password}" />  
            
            <arg value="-field" />
            <arg value="revision" />            
            <arg value="${GITTAG}" />
            
            <arg value="-field" />
            <arg value="new" />            
            <arg value="${newversion.type}" />
            
        </java>        
        <echo file="version.properties" message="${newversion.prop}" force=""/>
    </target>
    
    <target name="-upload-do" if="upload.config.exists">
        <loadproperties srcfile="jpexs_website.properties" prefix="website"/>
        <echo level="info">Uploading...</echo>
        <!-- Note: You must have developer account to upload to JPEXS website -->
        <java jar="uploader.jar" fork="true" failonerror="true">    
            <arg value="${website.upload.url}" />                

            <arg value="-field" />
            <arg value="mode" />
            <arg value="commandline" />
            
            <arg value="-field" />
            <arg value="set_username" />
            <arg value="${website.username}" />

            <arg value="-field" />
            <arg value="set_password" />            
            <arg value="${website.password}" />  
            
            <arg value="-textarea" />
            <arg value="new" />            
            <arg value="New:" />
            
            <arg value="-textarea" />
            <arg value="fixed" />            
            <arg value="Fixed:" />

            <arg value="-file" />
            <arg value="fileExe" />
            <arg value="${exe.file}" />

            <arg value="-file" />
            <arg value="fileZip" />
            <arg value="${zip.file}" />

            <arg value="-file" />
            <arg value="fileLang" />
            <arg value="${lang.file}" />
        </java>
    </target>
    
    
    <target name="-upload-check-config">
        <available file="jpexs_website.properties" property="upload.config.exists"/>
    </target>
    
    <target name="-upload" depends="-upload-check-config,-upload-do,-upload-fail">        
               
    </target>    
    
    <target name="dist" depends="build,exe">
        <copy todir="${DISTRIBUTIONDIR}">
            <fileset dir="${RESOURCESDIR}" includes="**/*.*"/>
        </copy>
    </target>
    
    <target name="locales" depends="-loadversion">
        <delete dir="${LOCALESTARGETDIR}"/>
        <mkdir dir="${LOCALESTARGETDIR}/${PROJECTNAME}"/>
        <copy todir="${LOCALESTARGETDIR}/${PROJECTNAME}">
            <fileset dir="${LOCALESDIR}" includes="**/*.*"/>
        </copy>
        <mkdir dir="${LOCALESTARGETDIR}/jsyntaxpane/bundle/"/>
        <copy todir="${LOCALESTARGETDIR}/jsyntaxpane/bundle/">
            <fileset dir="libsrc/jsyntaxpane/jsyntaxpane/src/main/resources/jsyntaxpane" includes="**/*.*"/>
        </copy>
        <mkdir dir="${LOCALESTARGETDIR}/jsyntaxpane/defaultsyntaxkit"/>
        <copy todir="${LOCALESTARGETDIR}/jsyntaxpane/defaultsyntaxkit">
            <fileset dir="libsrc/jsyntaxpane/jsyntaxpane/src/main/resources/META-INF/services/jsyntaxpane/defaultsyntaxkit" includes="**/*.*"/>
        </copy>
        <mkdir dir="${LOCALESTARGETDIR}/jsyntaxpane/syntaxkits/flasmsyntaxkit"/>
        <copy todir="${LOCALESTARGETDIR}/jsyntaxpane/syntaxkits/flasmsyntaxkit">
            <fileset dir="libsrc/jsyntaxpane/jsyntaxpane/src/main/resources/META-INF/services/jsyntaxpane/syntaxkits/flasmsyntaxkit" includes="**/config*.properties"/>
        </copy>
        <mkdir dir="${LOCALESTARGETDIR}/jsyntaxpane/syntaxkits/flasm3syntaxkit"/>
        <copy todir="${LOCALESTARGETDIR}/jsyntaxpane/syntaxkits/flasm3syntaxkit">
            <fileset dir="libsrc/jsyntaxpane/jsyntaxpane/src/main/resources/META-INF/services/jsyntaxpane/syntaxkits/flasm3syntaxkit" includes="**/config*.properties"/>
        </copy>
        <mkdir dir="${LOCALESTARGETDIR}/jsyntaxpane/syntaxkits/flasm3methodinfosyntaxkit"/>
        <copy todir="${LOCALESTARGETDIR}/jsyntaxpane/syntaxkits/flasm3methodinfosyntaxkit">
            <fileset dir="libsrc/jsyntaxpane/jsyntaxpane/src/main/resources/META-INF/services/jsyntaxpane/syntaxkits/flasm3methodinfosyntaxkit" includes="**/config*.properties"/>
        </copy>
        <mkdir dir="${LOCALESTARGETDIR}/lib"/>
        <copy todir="${LOCALESTARGETDIR}/lib">
            <fileset dir="${LOCALESLIBDIR}" includes="**/*.*"/>
        </copy>
        <echo file="${LOCALESTARGETDIR}/readme.txt">${PROJECTNAME} ${VERSION}${VERSIONSUFFIX} localization pack
            -------------------------------------------------------------------            
            Please follow instructions on http://www.free-decompiler.com/flash/translations.html
</echo>
        <property name="lang.file" value="${RELEASESDIR}/${PREFIXFILENAME}_${VERSION}${VERSIONSUFFIX}_lang.zip" />
        <zip destfile="${lang.file}" basedir="${LOCALESTARGETDIR}"/>
    </target>
    
    <target name="-nightly-suffix" if="NIGHTLY">        
        <property name="VERSIONSUFFIX" value="_nightly${version.build}"/>         
    </target>
    
    <target name="-no-suffix" unless="VERSIONSUFFIX">
        <property name="VERSIONSUFFIX" value=""/>         
    </target>
    
    <target name="-private-suffix" if="PRIVATE">
        <property name="VERSIONSUFFIX" value="_private_${GITSHORTTAG}"/>         
    </target>
    
    <target name="-suffix" depends="-nightly-suffix,-private-suffix,-no-suffix">
       
    </target>
    <target name="-timestamp" depends="-loadversion,git-tag">
        <tstamp>
            <format property="BUILTAT" pattern="MM/dd/yyyy hh:mm aa" timezone="CET"/>
            <format property="VERDATE" pattern="yyyyddMM_hhmm" timezone="CET"/>
        </tstamp>        
        <echo level="info" message="Version: ${VERSION}"/>
    </target>
    
    <target name="build_lib">
        <ant antfile="${CORELIBSCRIPT}" target="build" inheritAll="false" usenativebasedir="true"/>
        <copy file="${CORELIBPATH}" todir="${LIBRARIESDIR}" />
    </target>
    
    <target name="clean_lib">
        <ant antfile="${CORELIBSCRIPT}" target="clean" inheritAll="false" usenativebasedir="true" />
        <delete file="${LIBRARIESDIR}/${CORELIBNAME}" />
    </target>
    
    
    <target name="test_lib">
        <ant antfile="${CORELIBSCRIPT}" target="test" inheritAll="false" usenativebasedir="true" />
    </target>
    
    <target name="git-tag">
       <exec executable="git" outputproperty="GITTAG" failonerror="true">
            <arg value="rev-parse"/>
            <arg value="HEAD"/>
        </exec>  
        <echo level="info" message="${GITTAG}" file="${REVFILE}"/>
        
        
        <loadfile srcfile="${REVFILE}" property="GITSHORTTAG">
            <filterchain>
               <headfilter lines="1" skip="0"/>
               <tokenfilter>
                  <replaceregex pattern="[0-9a-f]{33}$" replace="" flags="gi"/>
               </tokenfilter>
               <striplinebreaks/>
            </filterchain>
        </loadfile>
        <echo level="info" message="Git tag:${GITTAG}"/>
        <echo level="info" message="Git shorttag:${GITSHORTTAG}"/>
    </target>
    
    <target name="build" depends="-loadversion,build_lib,-timestamp,-suffix,compile">        
        <mkdir dir="${DISTRIBUTIONDIR}"/>
        <!-- <delete dir="${DISTLIBRARIESFULLDIR}"/> -->
        <mkdir dir="${DISTLIBRARIESFULLDIR}"/>
        <copy todir="${DISTLIBRARIESFULLDIR}">
            <fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
            <fileset dir="${LIBRARIESDIR}" includes="**/*.exe"/>
            <fileset dir="${LIBRARIESDIR}" includes="**/*.txt"/>            
        </copy>
        
        
                                                     
        <propertyfile file="${COMPILEDIR}/${PROPERTIESNAME}"
                      comment="This file is automatically generated - DO NOT EDIT">        
            <entry key="buildtime" value="${BUILTAT}"/>
            <entry key="build" value="${GITTAG}"/>
            <entry key="builder" value="${BUILDER}"/>             
            <entry key="version" value="${VERSION}"/>          
            <entry key="nightly" value="${NIGHTLY}"/>
            
            <entry key="version.major" value="${version.major}"/>
            <entry key="version.minor" value="${version.minor}"/>
            <entry key="version.release" value="${version.release}"/>
            <entry key="version.build" value="${version.build}"/>
            <entry key="version.debug" value="${version.debug}"/>
        </propertyfile>
        
        <pathconvert pathsep=" " property="manifestClassPath">
            <fileset dir="${DISTRIBUTIONDIR}" includes="${DISTLIBRARIESDIRNAME}/**/*.*"/>
            <chainedmapper>
                <flattenmapper/>
                <globmapper from="*" to="${DISTLIBRARIESDIRNAME}/*"/>
            </chainedmapper>
        </pathconvert>

        <jar destfile="${DISTRIBUTIONDIR}/${JARFILENAME}.jar" basedir="${COMPILEDIR}">
            <manifest>
                <attribute name="Main-Class" value="${MAINCLASS}"/>
                <attribute name="Class-Path" value="${manifestClassPath}"/>
            </manifest>
        </jar>
    </target>

    <target name="run" depends="build">
        <java jar="${DISTRIBUTIONDIR}/${JARFILENAME}.jar" fork="true">
            <jvmarg value="-Xmx${MAXHEAPSIZERUN}m" />
            <jvmarg value="-Djava.net.preferIPv4Stack=true" />
            <arg line="${RUNPARAMS}" />
        </java>
    </target>


    <target name="javadoc">
        <mkdir dir="${JAVADOCDIR}"/>
        <javadoc sourcepath="${SOURCEDIR}" destdir="${JAVADOCDIR}" windowtitle="${PROJECTNAME}"
                 useexternalfile="yes">
            <fileset dir="${SOURCEDIR}" includes="**/*.java"/>
            <classpath>
                <fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
            </classpath>
        </javadoc>
    </target>
    <target name="clean" depends="clean_lib">        
        <delete dir="${DISTRIBUTIONDIR}"/>
        <delete dir="${COMPILETESTSDIR}"/>
        <delete dir="${COMPILEDIR}"/>
        <delete dir="${COVERAGEDIR}"/>
        <delete dir="${TESTRESULTSDIR}"/>
        <delete dir="${LOCALESTARGETDIR}"/>
    </target>
    
    <!-- Debug one test method (Netbeans IDE) -->
    <target name="debug-test-method" depends="compile-tests">
        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
        <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
        <delete dir="${TESTRESULTSDIR}"/>
        <mkdir dir="${TESTRESULTSDIR}"/>
        <mkdir dir="${TESTRESULTSDIR}/raw/"/>
     
        <nbjpdastart addressproperty="jpda.address" name="ffdec" transport="dt_socket">
            <classpath>
                <pathelement path="${COMPILEDIR}"/>
                <fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
                <fileset dir="${TESTLIBDIR}" includes="**/*.jar"/>
            </classpath>
        </nbjpdastart>
        <taskdef classname="org.testng.TestNGAntTask" classpath="${TESTLIBDIR}/testng-6.8.jar" name="testng" />
    
        <testng 
            outputDir="${TESTRESULTSDIR}"
            haltOnFailure="false" verbose="2" workingDir="${basedir}" methods="${test.class}.${test.method}">
        
            <classpath>
                <pathelement path="${COMPILETESTSDIR}"/>
                <pathelement path="${INSTRDIR}"/>
                <pathelement path="${COMPILEDIR}"/>
                <fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
                <fileset dir="${TESTLIBDIR}" includes="**/*.jar"/>
            </classpath>
            <jvmarg value="-noverify" />
            <jvmarg value="-Xdebug"/>
            <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
            <classfileset dir="${COMPILETESTSDIR}" includes="**/*.class" />                                    
        </testng>     
    </target>
    
    
    <target name="git-pull">
        <exec executable="git" failonerror="true">
            <arg value="pull"/>            
        </exec> 
    </target>
    
    <target name="git-push">
        <!-- NOTHING -->       
    </target>
    
    <target name="-git-commit-versioninfo">        
         <exec executable="git" failonerror="true">
            <arg value="add"/>            
            <arg value="version.properties"/>
         </exec>
        <exec executable="git" failonerror="true">
            <arg value="commit"/>            
            <arg value="-m"/>
            <arg value="version changed to ${newversion.major}.${newversion.minor}.${newversion.release} build ${newversion.build}"/>
        </exec> 
    </target>
    
    <target name="-loadoldversion">
        <loadproperties srcfile="version.properties" prefix="oldversion" />
    </target>
    
    <target name="-inc-major">
        <property name="newversion.type" value="major"/>
    </target>
    
    <target name="-inc-minor">
       <property name="newversion.type" value="minor"/>
    </target>
    
    <target name="-inc-release">
       <property name="newversion.type" value="release"/> 
    </target>
    
    <target name="-inc-nightlybuild">
        <property name="newversion.type" value="nightly"/>
    </target>   
    
    <target name="-save-version-info-file">        
        <propertyfile file="version.properties"
                      comment="DO NOT MODIFY - it is updated automatically with the build script">                               
            <entry key="major" value="${newversion.major}"/>
            <entry key="minor" value="${newversion.minor}"/>
            <entry key="release" value="${newversion.release}"/>
            <entry key="build" value="${newversion.build}"/>
            <entry key="debug" value="${newversion.debug}"/>
        </propertyfile>        
    </target>     
    
    <target name="-save-version-info" depends="-save-version-info-file,-git-commit-versioninfo">        
        
    </target>
    
    <target name="new-version-major" depends="git-pull,-inc-major,-check-version-online,all,-upload,git-push">
        
    </target>
    
    <target name="new-version-minor" depends="git-pull,-inc-minor,-check-version-online,all,-upload,git-push">
        
    </target>
    
    <target name="new-version-release" depends="git-pull,-inc-release,-check-version-online,all,-upload,git-push">
       
    </target>
       
        
    <target name="new-version-nightlybuild" depends="git-pull,-inc-nightlybuild,-check-version-online,all,-upload,git-push">

    </target>
    
    
    <target name="upload-last" depends="all,-upload">
        
    </target>
</project>