/*
 * Copyright Thoughtworks, Inc.
 *
 * 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.
 */

description = 'GoCD Agent Common Utilities'

java {
  // For use of the GoAgentServerClientBuilder
  registerFeature('agentClient') {
    usingSourceSet(sourceSets.create('agentClient'))
  }
}
CapabilitySupport.extendMain(project, 'agentClient')

dependencies {
  annotationProcessor project.deps.lombok
  compileOnly project.deps.lombok

  api(project(':base')) { capabilities { requireFeature('logging') } }
  agentClientApi(project(':base')) { capabilities { requireFeature('agent-client') } }
  implementation project.deps.jcommander
  agentClientRuntimeOnly project.deps.jcommander

  agentClientImplementation(project.deps.apacheHttpComponents) {
    exclude(module: 'commons-codec')
  }
  if (project.deps.apacheHttpComponents) {
    agentClientRuntimeOnly project.deps.slf4jJcl // Allow commons-logging replacement
  }

  testImplementation project.deps.mockitoCore
  testImplementation(testFixtures(project(':test:test-utils')))
  testImplementation project.deps.junit5Api
  testRuntimeOnly project.deps.junit5Engine
  testRuntimeOnly project.deps.junit5PlatformLauncher
  testImplementation project.deps.assertJ

  testFixturesImplementation(testFixtures(project(':test:test-utils')))
  testFixturesImplementation project.deps.jetty
  testFixturesImplementation project.deps.jettyUtil
  testFixturesImplementation project.deps.jettyServlet
  testFixturesImplementation project.deps.jettyWebapp

  testFixturesApi project.deps.assertJ
  testFixturesApi enforcedPlatform(project.deps.junit5Bom)
  testFixturesApi project.deps.junit5Api
}
