plugins {
    id 'application'
    id 'airbyte-bulk-connector'
    id "io.airbyte.gradle.docker"
    id 'airbyte-connector-docker-convention'
}

airbyteBulkConnector {
    core = 'load'
    toolkits = ['load-db']
}

java {
    compileJava {
        options.compilerArgs += "-Xlint:-this-escape"
    }
}

application {
    mainClass = 'io.airbyte.integrations.destination.clickhouse.ClickhouseDestinationKt'
    applicationDefaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0',
                                 '-XX:NativeMemoryTracking=detail', '-XX:+UnlockDiagnosticVMOptions',
                                 '-XX:GCLockerRetryAllocationCount=100',
//            '-Djava.rmi.server.hostname=localhost',
//            '-Dcom.sun.management.jmxremote=true',
//            '-Dcom.sun.management.jmxremote.port=6000',
//            '-Dcom.sun.management.jmxremote.rmi.port=6000',
//            '-Dcom.sun.management.jmxremote.local.only=false',
//            '-Dcom.sun.management.jmxremote.authenticate=false',
//            '-Dcom.sun.management.jmxremote.ssl=false'
    ]
}

dependencies {
    implementation 'com.clickhouse:client-v2:0.9.0'

    testImplementation("io.mockk:mockk:1.14.2")
    testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2")
    // This is being used in the test to check that the generated SQL can be parsed correctly.
    testImplementation("com.github.vertical-blank:sql-formatter:2.0.4")

    // https://mvnrepository.com/artifact/org.testcontainers/clickhouse
    integrationTestImplementation 'org.testcontainers:clickhouse:1.21.1'
    integrationTestImplementation 'com.clickhouse:client-v2:0.9.0'
}
