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

airbyteJavaConnector {
    cdkVersionRequired = '0.46.0'
    features = ['db-destinations', 's3-destinations', 'typing-deduping']
    useLocalCdk = false
}

java {
    compileJava {
        options.compilerArgs.remove("-Werror")
    }
}

compileKotlin {
    compilerOptions {
        allWarningsAsErrors = false
    }
}

airbyteJavaConnector.addCdkDependencies()

application {
    mainClass = 'io.airbyte.integrations.destination.redshift.RedshiftDestination'
    applicationDefaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0',
                                 '-XX:NativeMemoryTracking=detail', '-XX:+UnlockDiagnosticVMOptions',
                                 '-XX:GCLockerRetryAllocationCount=100',]
}

dependencies {

    implementation 'com.amazonaws:aws-java-sdk-s3:1.11.978'
    // TODO: Verify no aws sdk code is pulled by this dependency causing classpath conflicts
    // https://docs.aws.amazon.com/redshift/latest/mgmt/jdbc20-jdbc10-driver-differences.html
    implementation 'com.amazon.redshift:redshift-jdbc42:2.1.0.30'
    implementation 'org.apache.commons:commons-csv:1.11.0'
    implementation 'com.github.alexmojaki:s3-stream-upload:2.2.4'

    testImplementation 'org.apache.commons:commons-text:1.12.0'
    testImplementation 'org.apache.commons:commons-lang3:3.17.0'
    testImplementation 'org.apache.commons:commons-dbcp2:2.12.0'
    testImplementation "org.mockito:mockito-inline:5.2.0"

}
