plugins {
    id("shared-publish-conventions")
    id("shared-repositories-ext-conventions")
}

group = projectGroup
version = projectVersion

jar {
    archiveFileName = "batm_server_extensions_extra.${archiveExtension.get()}"
}

configurations {
    artifactOnly

    // handle Github (e.g. community) vs GENERAL BYTES dichotomy
    generalBytesCompile
    githubCompile
    if (hasGbArtifactory) {
        implementation { extendsFrom generalBytesCompile }
    } else {
        implementation { extendsFrom githubCompile }
    }
}

artifacts {
    artifactOnly jar
}

ext {
    xchangeVersion = '5.0.14'
}

dependencies {
    implementation project(":server_extensions_api")
    implementation project(":currencies")

    implementation("com.github.Polve:JavaBitcoindRpcClient:$javaBitcoindRpcVersion")
    implementation("org.slf4j:slf4j-api:1.7.28")
    implementation("com.github.mmazi:rescu:2.1.0")
    implementation("javax.ws.rs:javax.ws.rs-api:2.1")
    implementation("javax.servlet:javax.servlet-api:3.1.0")
    implementation("com.fasterxml.jackson.core:jackson-annotations:2.12.0")
    implementation("com.fasterxml.jackson.core:jackson-databind:2.12.0")
    implementation("com.fasterxml.jackson.core:jackson-core:2.12.0")
    implementation("com.google.guava:guava:30.1.1-jre")
    implementation("com.google.zxing:core:3.5.1")
    implementation("org.knowm.xchange:xchange-core:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-bitfinex:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-binance:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-bittrex:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-bitstamp:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-hitbtc:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-dvchain:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-coingi:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-enigma:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-poloniex:$xchangeVersion")
    implementation("org.knowm.xchange:xchange-okex:$xchangeVersion")
    implementation("org.web3j:core:4.9.0")
    implementation("org.web3j:crypto:4.9.0")
    implementation("org.web3j:utils:4.9.0")
    implementation("org.web3j:abi:4.9.0")
    implementation("org.java-websocket:Java-WebSocket:1.5.2")
    implementation("io.reactivex.rxjava2:rxjava:2.2.2") // for ERC20Interface generated by web3j
    implementation("org.reactivestreams:reactive-streams:1.0.2") // for ERC20Interface generated by web3j
    implementation("com.squareup.okhttp3:okhttp:4.9.0")
    implementation("com.squareup.okio:okio:2.8.0")
    implementation("org.bitcoinj:bitcoinj-core:0.16.1")
    // Note when updating bitcoinj: block.io depends on libdohj for doge and ltc
    // which depends on bitcoinj and extends some classes, it must be compatible version
    // and it will break at runtime if the version is substituted for an incompatible one
    implementation("com.github.dogecoin:libdohj:a2a37e454e5cd02f664ca119ab8b59dfddc75590")
    implementation("org.xrpl:xrpl4j-model:2.1.0")
    implementation("org.xrpl:xrpl4j-keypairs:2.1.0")
    implementation("org.bouncycastle:bcprov-jdk15on:1.63")
    implementation("javax.xml.bind:jaxb-api:2.3.1")
    implementation("javax.annotation:javax.annotation-api:1.3.2")
    implementation("com.sun.xml.bind:jaxb-impl:2.3.9")
    implementation("org.bouncycastle:bcpkix-jdk15on:1.63")
    implementation("com.nimbusds:nimbus-jose-jwt:9.40")

    runtimeOnly("com.google.protobuf:protobuf-java:3.13.0")

    generalBytesCompile("com.generalbytes.bitrafael.public:bitrafael-client:$bitrafaelVersion") {
        exclude group: 'org.slf4j', module: 'slf4j-simple'
    }
    githubCompile("com.github.GENERALBYTESCOM.bitrafael_public:bitrafael-client:$bitrafaelVersion") {
        exclude group: 'org.slf4j', module: 'slf4j-simple'
    }
    generalBytesCompile("com.generalbytes.bitrafael.public:bitrafael-client-api:$bitrafaelVersion")
    githubCompile("com.github.GENERALBYTESCOM.bitrafael_public:bitrafael-client-api:$bitrafaelVersion")
    generalBytesCompile("com.generalbytes.bitrafael.public:bitrafael-server-api:$bitrafaelVersion")
    githubCompile("com.github.GENERALBYTESCOM.bitrafael_public:bitrafael-server-api:$bitrafaelVersion")

    implementation("com.github.generalbytescom.trident:abi:fff6ed0") // fff6ed0 should be close to 0.1.1
    implementation("com.github.generalbytescom.trident:core:fff6ed0")
    implementation("com.github.generalbytescom.trident:utils:fff6ed0")
    implementation("com.google.protobuf:protobuf-java:3.13.0")
    implementation("com.onfido:onfido-api-java:2.3.1")
    implementation("org.apache.commons:commons-lang3:3.13.0")

    // keeping junit 4 for compatibility, will be removed soon, use junit 5 instead
    testImplementation("junit:junit:4.13.2")
    testImplementation("org.junit.vintage:junit-vintage-engine:5.11.4")

    testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.4")
    testImplementation("org.junit.jupiter:junit-jupiter-engine:5.11.4")
    testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.4")
    testImplementation("org.assertj:assertj-core:3.19.0")
    testImplementation("ch.qos.logback:logback-classic:1.2.9")
    testImplementation("ch.qos.logback:logback-core:1.2.9")
    testImplementation("org.assertj:assertj-core:3.19.0")
    testImplementation('org.glassfish.jersey.core:jersey-common:2.25.1')
    testImplementation("org.mockito:mockito-core:4.11.0")
    testImplementation("org.mockito:mockito-inline:4.11.0")
    testImplementation("org.mockito:mockito-junit-jupiter:4.11.0")
}

test {
    useJUnitPlatform()
    testLogging {
        events "failed"
        showExceptions true
        exceptionFormat "full"
        showCauses true
        showStackTraces true
        showStandardStreams = false
    }
}