apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'pmd'
apply plugin: 'war'

sourceCompatibility = 1.8

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    providedCompile libs.servlet_api

    compile(project(':HIRS_Utils')) {
        exclude module: "javassist"
    }
    compile(project(':HIRS_AttestationCA'))

    compile libs.commons_io
    compile libs.commons_lang
    compile libs.commons_upload
    compile libs.gson
    compile libs.guava          // for com.google.common
    compile libs.hibernate
    compile libs.http
    compile libs.jstl
    compile libs.log4j2
    compile libs.log4j2_web
    compile libs.servlet_api
    compile libs.spring_webmvc
    compile 'org.springframework:spring-context-support:4.2.1.RELEASE'
    compile 'org.hibernate:hibernate-validator:5.3.4.Final'

    compileOnly libs.checkstyle
    compileOnly libs.findbugs

    runtime fileTree(dir: 'build/plugins', include: ['*.jar'])

    testCompile 'org.hamcrest:hamcrest-all:1.3'
    // override the servlet API for testing. Required for Spring Integration tests
    testCompile 'javax.servlet:javax.servlet-api:3.1.0'

    testCompile libs.hsqldb
    testCompile libs.spring_test
    testCompile libs.testng
    testCompile libs.mockito
    testCompile libs.testng
    testCompile 'org.skyscreamer:jsonassert:1.2.3' // for .andExpect(content().json(json))

    testRuntime 'com.jayway.jsonpath:json-path:2.1.0'
}

test {
    useTestNG()
}

copyVersion.dependsOn compileJava
war.dependsOn copyVersion
war.dependsOn addPlugins

war {
    from(buildDir) {
        include 'VERSION'
        into 'WEB-INF/classes'
    }
    archiveName = 'HIRS_AttestationCAPortal.war'
}

ext.configDir = new File(projectDir, 'config')

ext.checkstyleConfigDir = "$configDir/checkstyle"

checkstyle {
    toolVersion = '5.7'
    configFile = checkstyleConfigFile
    configProperties.put('basedir', checkstyleConfigDir)
    ignoreFailures = false
    showViolations = true
}

ext.findbugsConfigDir = "$configDir/findbugs"

findbugs {
    toolVersion = '3.0.0'
    ignoreFailures = false
    effort = 'max'
    excludeFilter = new File(findbugsConfigDir, 'suppressions.xml')
}
