/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
plugins {
    id('idea')
    // A Java library
    id('java-library')
}

version project.version

sourceCompatibility = JavaVersion.VERSION_11

sourceSets {
    integrationTest {
        java {
            compileClasspath += main.output + test.output
            runtimeClasspath += main.output + test.output
            srcDir(file('src/integrationTest'))
        }
    }
}

idea {
    module {
        testSourceDirs += sourceSets.integrationTest.java.srcDirs
    }
}

configurations {
    integrationTestImplementation.extendsFrom testImplementation
}

configurations {
    // remove netty-all dependency coming from spark
    all*.exclude(group: 'io.netty', module: 'netty-all')
    configureEach {
        resolutionStrategy {
            // Force set the vertx versions that do not depend on a newer jackson version
            force("io.vertx:vertx-web:${vertxVersion}")
            force("io.vertx:vertx-core:${vertxVersion}")
            force("io.vertx:vertx-auth-common:${vertxVersion}")
            force("io.vertx:vertx-dropwizard-metrics:${vertxVersion}")
            force("io.vertx:vertx-web-client:${vertxVersion}")
        }
    }
}

dependencies {
    integrationTestImplementation("io.vertx:vertx-web:${project.vertxVersion}") {
        exclude group: 'junit', module: 'junit'
    }
    integrationTestImplementation("io.vertx:vertx-dropwizard-metrics:${project.vertxVersion}")
    integrationTestImplementation("io.vertx:vertx-web-client:${project.vertxVersion}")

    integrationTestImplementation(group: 'net.java.dev.jna', name: 'jna', version: '5.9.0')
    integrationTestImplementation(project(path: ":integration-framework"))
    integrationTestImplementation("com.google.inject:guice:${guiceVersion}")
    testRuntimeOnly 'com.fasterxml.jackson.core:jackson-annotations:2.14.2'

    integrationTestCompileOnly(group: 'com.intellij', name: 'annotations', version: '12.0')
}

apply from: "${project.rootDir}/gradle/common/integrationTestTask.gradle"
check.dependsOn integrationTest
