/*
 * 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 = file('../..')

if (hasProperty('thrift.compiler')) {
    ext.thriftCompiler = property('thrift.compiler')
} else {
    ext.thriftCompiler = "$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')

// 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 {
    compile "org.slf4j:slf4j-api:${slf4jVersion}"
    compile "org.apache.httpcomponents:httpclient:${httpclientVersion}"
    compile "org.apache.httpcomponents:httpcore:${httpcoreVersion}"
    //compile "javax.servlet:servlet-api:${servletVersion}"
    compile "org.apache.tomcat.embed:tomcat-embed-core:${tomcatEmbedVersion}"
    compile "javax.annotation:javax.annotation-api:${javaxAnnotationVersion}"

    testCompile "junit:junit:${junitVersion}"
    testCompile "org.mockito:mockito-all:${mockitoVersion}"
    testRuntime "org.slf4j:slf4j-log4j12:${slf4jVersion}"
}
