// 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-library"
apply from: "$rootDir/gradle/shadow.gradle"

dependencies {
  implementation project(path: ":kudu-client", configuration: "shadow")

  compileOnlyApi libs.hiveMetastore
  compileOnlyApi libs.slf4jApi
  // Transitively required through hive-metastore,
  // which has marked it as an optional dependency.
  compileOnlyApi libs.hadoopCommon
  compileOnlyApi libs.hadoopMRClientCommon
  testImplementation libs.hadoopMRClientCommon

  testImplementation project(path: ":kudu-test-utils", configuration: "shadow")
  testImplementation libs.hiveTestUtils
  testImplementation libs.junit
  testImplementation libs.log4jApi
  testImplementation libs.log4jCore
  testImplementation libs.log4jSlf4jImpl

  testImplementation libs.hiveMetastore
  testImplementation libs.hadoopCommon
  testImplementation libs.hadoopMRClientCommon
}

shadowJar {
  dependencies {
    exclude(dependency("ch.qos.reload4j::.*"))
    exclude(dependency("com.fasterxml.jackson.core::.*"))
    exclude(dependency("com.fasterxml.jackson.jaxrs::.*"))
    exclude(dependency("com.fasterxml.jackson.module::.*"))
    exclude(dependency("com.fasterxml.woodstox:::.*"))
    exclude(dependency("com.nimbusds::.*"))
    exclude(dependency("com.sun.jersey::.*"))
    exclude(dependency("com.sun.xml.bind::.*"))
    exclude(dependency("commons-dbcp::.*"))
    exclude(dependency("javax.jdo::.*"))
    exclude(dependency("javax.servlet.jsp::.*"))
    exclude(dependency("joda-time::.*"))
    exclude(dependency("junit::.*"))
    exclude(dependency("org.apache.commons::.*"))
    exclude(dependency("org.apache.curator::.*"))
    exclude(dependency("org.apache.hadoop::.*"))
    exclude(dependency("org.apache.hbase.thirdparty::.*"))
    exclude(dependency("org.apache.hbase::.*"))
    exclude(dependency("org.apache.hive::.*"))
    exclude(dependency("org.apache.logging.log4j::.*"))
    exclude(dependency("org.apache.orc::.*"))
    exclude(dependency("org.apache.parquet::.*"))
    exclude(dependency("org.apache.thrift::.*"))
    exclude(dependency("org.codehaus.jackson::.*"))
    exclude(dependency("org.datanucleus::.*"))
    exclude(dependency("org.eclipse.jetty::.*"))
    exclude(dependency("org.ehcache::.*"))
    exclude(dependency("org.fusesource.leveldbjni::.*"))
    exclude(dependency("org.xerial.snappy::.*"))
    exclude(dependency("sqlline::.*"))
  }
  exclude '**/*.dll'
  exclude '**/*.sql'
  exclude '**/package-info.class'
  exclude '**/*.md'
  exclude 'META-INF/services/**'
  exclude 'META-INF/NOTICE-binary'
  exclude 'META-INF/jersey-module-version'
  exclude 'codegen/**'
  exclude 'images/**'
  exclude 'javax/**'
  exclude 'org/apache/tools/ant/**'
  exclude 'tables/**'
  exclude 'org/apache/log4j/**'

  minimize()
}

// kudu-hive has no public Javadoc.
javadoc {
  enabled = false
}
