/*
 * Copyright © 2019, 2021 Apple Inc. and the ServiceTalk project authors
 *
 * Licensed 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.
 */

apply plugin: "io.servicetalk.servicetalk-gradle-plugin-internal-library"

def actualJerseyVersion = "${jerseyVersion}"
def actualJavaxActivationVersion = "${javaxActivationVersion}"
def actualJavaxAnnotationsApiVersion = "${javaxAnnotationsApiVersion}"
def actualJavaxJaxbApiVersion = "${javaxJaxbApiVersion}"
def actualJavaxJaxbCoreVersion = "${javaxJaxbCoreVersion}"
def actualJavaxJaxbImplVersion = "${javaxJaxbImplVersion}"
def actualJavaxInjectVersion = "${javaxInjectVersion}"
def actualJaxRsVersion = "${jaxRsVersion}"

// Dependencies must remain consistent between servicetalk-http-router-jerseyX modules
dependencies {
  api platform("org.glassfish.jersey:jersey-bom:$actualJerseyVersion")
  api project(":servicetalk-http-api")
  api project(":servicetalk-router-api")
  api project(":servicetalk-transport-api")
  api "jakarta.annotation:jakarta.annotation-api:$actualJavaxAnnotationsApiVersion" // Priority
  api "jakarta.ws.rs:jakarta.ws.rs-api:$actualJaxRsVersion"
  api "org.glassfish.jersey.core:jersey-common" // AutoDiscoverable

  implementation project(":servicetalk-annotations")
  implementation project(":servicetalk-buffer-api")
  implementation project(":servicetalk-concurrent")
  implementation project(":servicetalk-concurrent-api")
  implementation project(":servicetalk-concurrent-api-internal")
  implementation project(":servicetalk-concurrent-internal")
  implementation project(":servicetalk-http-router-jersey-internal")
  implementation project(":servicetalk-http-utils")
  implementation project(":servicetalk-router-utils-internal")
  implementation project(":servicetalk-utils-internal")
  implementation "org.glassfish.hk2.external:jakarta.inject:$actualJavaxInjectVersion"
  implementation "org.glassfish.jersey.core:jersey-server"
  implementation "org.slf4j:slf4j-api:$slf4jVersion"

  runtimeOnly "com.sun.activation:jakarta.activation:$actualJavaxActivationVersion"
  runtimeOnly "com.sun.xml.bind:jaxb-core:$actualJavaxJaxbCoreVersion"
  runtimeOnly "com.sun.xml.bind:jaxb-impl:$actualJavaxJaxbImplVersion"
  runtimeOnly "jakarta.xml.bind:jakarta.xml.bind-api:$actualJavaxJaxbApiVersion"

  testImplementation enforcedPlatform("org.junit:junit-bom:$junit5Version")
  testImplementation "org.junit.jupiter:junit-jupiter-api"
  testImplementation "org.mockito:mockito-core:$mockitoCoreVersion"

  testRuntimeOnly "org.glassfish.jersey.media:jersey-media-json-jackson"

  testFixturesApi platform("org.glassfish.jersey:jersey-bom:$actualJerseyVersion")
  testFixturesApi platform("org.junit:junit-bom:$junit5Version")
  testFixturesApi project(":servicetalk-buffer-api")
  testFixturesApi project(":servicetalk-concurrent-api")
  testFixturesApi project(":servicetalk-http-api")
  testFixturesApi project(":servicetalk-router-api")
  testFixturesApi project(":servicetalk-transport-api")
  testFixturesApi "jakarta.annotation:jakarta.annotation-api:$actualJavaxAnnotationsApiVersion"
  testFixturesApi "jakarta.ws.rs:jakarta.ws.rs-api:$actualJaxRsVersion"
  testFixturesApi "org.glassfish.jersey.core:jersey-server"
  testFixturesApi "org.hamcrest:hamcrest:$hamcrestVersion"
  testFixturesApi "org.junit.jupiter:junit-jupiter-api"
  testFixturesApi "org.junit.platform:junit-platform-suite-api:$junitPlatformVersion"

  testFixturesImplementation platform("com.fasterxml.jackson:jackson-bom:$jacksonVersion")
  testFixturesImplementation testFixtures(project(":servicetalk-concurrent-api"))
  testFixturesImplementation testFixtures(project(":servicetalk-concurrent-internal"))
  testFixturesImplementation testFixtures(project(":servicetalk-http-netty"))
  testFixturesImplementation testFixtures(project(":servicetalk-transport-netty-internal"))
  testFixturesImplementation project(":servicetalk-buffer-netty")
  testFixturesImplementation project(":servicetalk-concurrent")
  testFixturesImplementation project(":servicetalk-context-api")
  testFixturesImplementation project(":servicetalk-data-jackson")
  testFixturesImplementation project(":servicetalk-http-netty")
  testFixturesImplementation project(":servicetalk-http-router-predicate")
  testFixturesImplementation project(":servicetalk-router-utils-internal")
  testFixturesImplementation project(":servicetalk-test-resources")
  testFixturesImplementation project(":servicetalk-transport-netty-internal")
  testFixturesImplementation project(":servicetalk-serializer-api")
  testFixturesImplementation "com.fasterxml.jackson.core:jackson-core"
  testFixturesImplementation "com.fasterxml.jackson.core:jackson-databind"
  testFixturesImplementation "com.google.code.findbugs:jsr305:$jsr305Version"
  testFixturesImplementation "net.javacrumbs.json-unit:json-unit:$jsonUnitVersion"
  testFixturesImplementation "org.junit.jupiter:junit-jupiter-params"
  testFixturesImplementation "org.mockito:mockito-core:$mockitoCoreVersion"
  testFixturesImplementation "org.mockito:mockito-junit-jupiter:$mockitoCoreVersion"

  testFixturesRuntimeOnly "org.glassfish.jersey.inject:jersey-hk2"
  testFixturesRuntimeOnly "org.glassfish.jersey.media:jersey-media-sse"
}
