/*
 * 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 externalDependency.commonsCli
  compile externalDependency.commonsConfiguration
  compile externalDependency.commonsCompress
  compile externalDependency.commonsEmail
  compile externalDependency.commonsIo
  compile externalDependency.commonsLang
  compile externalDependency.guava
  compile externalDependency.slf4j
  compile externalDependency.avro
  compile externalDependency.avroCompiler
  compile externalDependency.avroCompatHelper
  compile externalDependency.orcCore
  compile externalDependency.hikariCP
  compile externalDependency.hiveMetastore
  compile externalDependency.jodaTime
  compile externalDependency.jacksonCore
  compile externalDependency.jasypt
  compile externalDependency.metricsCore
  compile externalDependency.guavaretrying
  compile externalDependency.guice
  compile externalDependency.tdigest
  compile externalDependency.typesafeConfig
  compile externalDependency.commonsPool
  compile externalDependency.hadoopClientCommon
  compile externalDependency.avroMapredH2
  compile externalDependency.commonsLang3
  compile externalDependency.gson
  compile externalDependency.opencsv
  compile externalDependency.hadoopHdfs
  compile externalDependency.groovy
  compile externalDependency.errorProne

  runtimeOnly externalDependency.hadoopCommon
  runtimeOnly externalDependency.hadoopClientCore
  runtimeOnly externalDependency.hadoopAuth

  testCompile externalDependency.hamcrest
  testCompile externalDependency.testng
  testCompile externalDependency.mockito
  testCompile externalDependency.assertj
}

configurations {
  compile {
    transitive = true
  }
  archives
}

test {
  workingDir rootProject.rootDir
}

ext.classification = "library"

task utilityTar(type: Tar) {
  //there seems to be a bug in the Gradle signing module where X.tar.gz will generate
  // a signature X.gz.asc instead of X.tar.gz.asc. Therefore, we have to use the .tgz
  // extension
  extension = 'tgz'
  baseName = project.name
  compression = Compression.GZIP

  into("lib") { from configurations.runtime }
  into("lib") { from "${project.rootDir}/build/${project.name}/libs/${project.name}.jar" }
  into("lib") { from "${project.rootDir}/build/${project.name}/libs/${project.name}-${project.version}.jar" }
  into("bin") {
    from "src/main/bash"
    fileMode = 0755
  }
  into(".") { from project.rootDir.path + "/conf/log4j.xml" }
}

utilityTar.dependsOn ':gobblin-utility:jar'

artifacts {
  archives utilityTar
}
