/*
 * 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.
 */

import java.nio.file.Paths

plugins {
    id('java-library')
    id('idea')
    id('maven-publish')
    id('java-test-fixtures')
}

apply from: "$rootDir/gradle/common/publishing.gradle"

sourceCompatibility = JavaVersion.VERSION_11

test {
    useJUnitPlatform()
    maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
    reports {
        junitXml.setRequired(true)
        def destDir = Paths.get(rootProject.rootDir.absolutePath, "build", "test-results", "vertx-auth-mtls").toFile()
        println("Destination directory for vertx-auth-mtls tests: ${destDir}")
        junitXml.getOutputLocation().set(destDir)
        html.setRequired(true)
        html.getOutputLocation().set(destDir)
    }
    testLogging {
        events "passed", "skipped", "failed"
    }
}

configurations {
    all*.exclude(group: 'ch.qos.logback')
}

dependencies {
    // We keep Vert.x version latest here, for easier contribution back to Vert.x project
    implementation(group: 'io.vertx', name: 'vertx-auth-common', version: "$vertxVersion")
    implementation(group: 'io.vertx', name: 'vertx-junit5', version: "$vertxVersion")
    implementation(group: 'io.vertx', name: 'vertx-codegen', version: "$vertxVersion")
    testImplementation(group: 'org.assertj', name: 'assertj-core', version: '3.26.3')
    testImplementation(group: 'org.mockito', name: 'mockito-core', version: '4.11.0')
    testFixturesApi(group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version: '1.78.1')
    testImplementation(testFixtures(project(path: ":test-common")))
}

spotbugsTest.enabled = false
check.dependsOn(checkstyleMain, checkstyleTest, jacocoTestReport)
