/*
 * 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 {
    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: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
tasks.remove(tasks.uploadShadow)

dependencies {
  compile "org.elasticsearch.client:transport:5.6.8"
  compile "org.elasticsearch.client:elasticsearch-rest-high-level-client:5.6.8"
  compile externalDependency.guava
}


configurations {
 compile {
    exclude group: "org.apache.hadoop"
    exclude group: "com.sun.jersey.contribs"
  }
}
// changed classifier of shadow Jar to ""
// to make it the main jar since shadow jar is only used
// This will override the main jar on ./gradlew build
shadowJar {
  zip64 true
  classifier ""
  relocate 'com.google.common', 'shadow.gobblin.elasticsearch.com.google.common'
}

// assigning a different classifier to the main jar
// so that it does not override the shadow jar
jar {
  classifier "thin"
}

publishing.publications {
  shadowPub(MavenPublication) {
    artifacts = [shadowJar]
    pom pomAttributes
    pom.withXml addRuntimeDependenciesToPom
  }
}

artifactory {
    publish {
        defaults {
            publications('shadowPub')
        }
    }
}

ext.classification="library"
