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

apply plugin: 'java'

dependencies {
    compile project(":gobblin-api")
    compile project(path: ':gobblin-rest-service:gobblin-rest-api', configuration: 'restClient')
    compile project(":gobblin-utility")

    compile externalDependency.guava
    compile externalDependency.slf4j
    compile externalDependency.pegasus.data
    compile externalDependency.commonsLang
    compile externalDependency.commonsLang3
    compile externalDependency.guice
    compile externalDependency.javaxInject
    compile externalDependency.jodaTime
    compile externalDependency.hikariCP
    compile externalDependency.httpclient
    compile externalDependency.flyway
    compile externalDependency.commonsConfiguration
    compile externalDependency.reflections

    runtimeOnly externalDependency.mysqlConnector

    testCompile externalDependency.testng
    testCompile externalDependency.embeddedProcess
    testCompile externalDependency.testContainers
    testCompile externalDependency.testContainersMysql
    testCompile externalDependency.slf4jToLog4j
}

// Begin HACK to get around POM being dependent on the (empty) gobblin-rest-api instead of gobblin-rest-api-rest-client
def installer = install.repositories.mavenInstaller
[installer]*.pom*.whenConfigured {pom ->
    pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-rest-client'
}
if (rootProject.publishToMaven || rootProject.publishToNexus) {
    def deployer = uploadArchives.repositories.mavenDeployer
    [deployer]*.pom*.whenConfigured {pom ->
        pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-rest-client'
    }
}
// End HACK

configurations {
    testFixtures {
        extendsFrom testRuntime
    }
    compile {
        transitive = false
    }
}

task testJar(type: Jar) {
    from sourceSets.test.output
    classifier = 'test'
}

artifacts {
    testFixtures testJar
}

test {
    workingDir rootProject.rootDir
}

ext.classification="library"
