plugins {
    id 'java'
    id 'org.springframework.boot' version '2.7.1'
    id 'io.spring.dependency-management' version '1.0.12.RELEASE'
    id 'com.palantir.docker' version '0.33.0'
    id 'info.solidsoft.pitest' version '1.7.4'
    id 'org.owasp.dependencycheck' version '7.1.1'
    id 'org.kordamp.gradle.stats' version '0.2.2'
}

group 'com.agonyforge'
version '0.13.4-SNAPSHOT'

jar {
    enabled = false // don't build the plain, non-executable jar
}

bootJar {
    manifest {
        attributes('Implementation-Title':  jar.getArchiveBaseName().get(),
            'Implementation-Version': getArchiveVersion())
    }
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenLocal()
    mavenCentral()
}

configurations.implementation {
    exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}

dependencies {
    implementation group: 'javax.inject', name: 'javax.inject', version: '1'

    implementation group: 'org.springframework.boot', name: 'spring-boot-starter'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail'

    implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.14.1'
    implementation group: 'com.squareup.okhttp3', name:'okhttp', version:'4.10.0'

    implementation group: 'org.knowm.xchange', name: 'xchange-quoine', version: '5.0.14'
    implementation group: 'org.knowm.xchange', name: 'xchange-stream-kraken', version: '5.0.14'
    implementation group: 'org.knowm.xchange', name: 'xchange-bitflyer', version: '5.0.14'
    implementation group: 'org.knowm.xchange', name: 'xchange-stream-coinbasepro', version: '5.0.14'
    implementation group: 'org.knowm.xchange', name: 'xchange-cexio', version: '5.0.14'
    implementation group: 'org.knowm.xchange', name: 'xchange-poloniex', version: '5.0.14'
    implementation group: 'org.knowm.xchange', name: 'xchange-stream-gemini', version: '5.0.14'
    implementation group: 'org.knowm.xchange', name: 'xchange-bitstamp', version: '5.0.14'
    implementation group: 'org.knowm.xchange', name: 'xchange-cobinhood', version: '5.0.14'
    implementation group: 'org.knowm.xchange', name: 'xchange-binance', version: '5.0.14'

    implementation group: 'com.github.seratch', name: 'jslack', version: '3.4.2'
    implementation group: 'javax.websocket', name: 'javax.websocket-api', version: '1.1'

    implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
    implementation group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
    implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'

    testImplementation group: 'junit', name: 'junit', version: '4.13.2'
    testImplementation group: 'org.mockito', name: 'mockito-core', version: '4.6.1'
    testImplementation group: 'org.pitest', name: 'pitest', version: '1.9.3'
}

docker {
    name 'agonyforge/arbitrader'
    dockerfile file('src/main/docker/local/Dockerfile')
    files tasks.bootJar.outputs
}

project.tasks.build.dependsOn tasks.docker

pitest {
    pitestVersion.set('1.6.6')
    excludedMethods.set([
            'hashCode',
            'equals',
            'toString'
    ])
    timestampedReports.set false
}

dependencyCheck {
    suppressionFile "codequality/cve-suppressions.xml"
}

check.dependsOn project.tasks.pitest, project.tasks.dependencyCheckAnalyze

project.tasks.pitest.mustRunAfter test
