defaultTasks 'build'


// Define properties
ext {
    templatesDir    = "${mainDir}/templates"
    xsdDir			= "${mainResDir}/xsd"
}

configurations {
    jamon
    jaxb
}

dependencies {
    jamon 'org.jamon:jamon-anttask:2.4.2'

    jaxb 'com.sun.xml.bind:jaxb-xjc:2.1.3'
    jaxb 'javax.xml:jsr173:1.0'
    jaxb 'javax.activation:activation:1.1.1'
    
    if (incremental_build) {
        compile "com.exactpro.sf:sailfish-rest-api-client:${artifactCoreVersion}"
    } else {
        compile project(':FrontEnd:sailfish-rest-api-client')
    }

    //compile 'org.jamon:jamon-api:2.3.0'
    compile 'org.jamon:jamon-runtime:2.4.1'

    compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
    compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml"
    compile "com.fasterxml.jackson.core:jackson-databind"

    compile 'commons-io:commons-io:2.11.0'
    //compile 'commons-logging:commons-logging-api:1.0.4'
    compile 'net.sourceforge.javacsv:javacsv:2.0'

    compileOnly "org.apache.logging.log4j:log4j-core:${version_log4j2}"
    constraints {
        compile("org.apache.commons:commons-collections4:4.2") {
            because("To be consistent with sailfish-core")
        }
    }

    testCompile 'junit:junit:4.12'
    testCompile "com.fasterxml.jackson.core:jackson-databind"
    testCompile 'com.thoughtworks.xstream:xstream:1.4.16'
}

task templates {
    doLast {
	    ant.taskdef(name: 'jamon', classname: 'org.jamon.ant.JamonTask',   classpath: configurations.jamon.asPath)
	    ant.taskdef(name: 'xjc',   classname: 'com.sun.tools.xjc.XJCTask', classpath: configurations.jaxb.asPath)
	    ant.jamon(destdir: "${genJavaDir}", srcdir: "${templatesDir}")
        ant.xjc(schema: "${xsdDir}/dictionary.xsd", destdir: "${genJavaDir}", package: "com.exactpro.sf.common.impl.messages.xml.configuration", removeOldOutput: "yes") {
            produces(dir: "${genJavaDir}/com/exactpro/common/sf/impl/messages/xml/configuration", includes: "*")
	        arg(value: "-extension")
	    }
    }
}

compileKotlin.dependsOn.add("templates")
