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

buildscript {

  apply from: "${rootProject.projectDir}/gradle/scripts/repositories.gradle", to: buildscript

  dependencies {
    classpath (group: 'com.linkedin.pegasus', name: 'gradle-plugins', version: rootProject.pegasusVersion) {
      exclude group: 'org.apache.ant'
    }
  }

  repositories {
    gradlePluginPortal()
  }
  dependencies {
    // Bump up shadow version to support Gradle 5.x https://github.com/johnrengelman/shadow
    classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
  }

}

apply plugin: 'pegasus'
apply plugin: 'java'

def apiProject = project(project.getParent().getPath() + ":" + project.getParent().getName() + "-api")
def serverProject = project(project.getParent().getPath() + ":" + project.getParent().getName() + "-server")

if (file('extraDependencies.gradle').exists()) {
  apply from: 'extraDependencies.gradle'
}

dependencies {
  compile project(path: apiProject.path, configuration: 'dataTemplate')
  compile project(path: apiProject.path, configuration: 'restClient')
  compile(project(':gobblin-api')) {
    transitive = false
  }

  testCompile project(":gobblin-restli:gobblin-restli-utils")
  testCompile externalDependency.testng
  testCompile externalDependency.mockito
  testCompile serverProject
}
