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

// Following Gradle best practices to keep build logic organized

// Override the build directory if CMake is used (allows for out-of-tree-builds)
if (hasProperty('build.dir')) {
    buildDir = file(property('build.dir'))
}

// In order to remain compatible with other Ant based builds in the system
// we convert the gradle.properties into DSL friendly camelCased properties
ext.installPath = property('install.path')
ext.installJavadocPath = property('install.javadoc.path')

ext.thriftRoot = rootProject.file('../..')
ext.thriftCompiler = findProperty('thrift.compiler') ?: "$thriftRoot/compiler/cpp/thrift"

ext.mvnRepo = property('mvn.repo')
ext.apacheRepo = property('apache.repo')
ext.mavenRepositoryUrl = property('maven-repository-url')

// Versions used in this project
ext.httpclientVersion = property('httpclient.version')
ext.httpcoreVersion = property('httpcore.version')
ext.servletVersion = property('servlet.version')
ext.tomcatEmbedVersion = property('tomcat.embed.version')
ext.slf4jVersion = property('slf4j.version')
ext.junitVersion = property('junit.version')
ext.mockitoVersion = property('mockito.version')
ext.javaxAnnotationVersion = property('javax.annotation.version')
ext.commonsLang3Version = property('commons-lang3.version')

// In this section you declare where to find the dependencies of your project
repositories {
    maven {
        name 'Maven Central Repository'
        url mvnRepo
    }
    maven {
        name 'Apache Maven Repository'
        url apacheRepo
    }
}

dependencies {
    implementation "org.slf4j:slf4j-api:${slf4jVersion}"
    implementation "org.apache.httpcomponents.client5:httpclient5:${httpclientVersion}"
    implementation "org.apache.httpcomponents.core5:httpcore5:${httpcoreVersion}"
    implementation "jakarta.servlet:jakarta.servlet-api:${servletVersion}"
    implementation "jakarta.annotation:jakarta.annotation-api:${javaxAnnotationVersion}"
    implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"

    testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}"
    testImplementation "org.mockito:mockito-core:${mockitoVersion}"
    testRuntimeOnly "org.junit.platform:junit-platform-launcher"
    testRuntimeOnly "org.slf4j:slf4j-log4j12:${slf4jVersion}"
}
