2016-12-29 12:16:04 -05:00
|
|
|
/*
|
|
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
|
|
* license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright
|
|
|
|
* ownership. Elasticsearch 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.
|
|
|
|
*/
|
2018-07-10 17:59:15 -04:00
|
|
|
|
|
|
|
import org.elasticsearch.gradle.precommit.PrecommitTasks
|
|
|
|
import org.gradle.api.XmlProvider
|
|
|
|
import org.gradle.api.publish.maven.MavenPublication
|
|
|
|
|
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url 'https://plugins.gradle.org/m2/'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-29 12:16:04 -05:00
|
|
|
apply plugin: 'elasticsearch.build'
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
2017-07-13 03:44:25 -04:00
|
|
|
apply plugin: 'nebula.maven-base-publish'
|
|
|
|
apply plugin: 'nebula.maven-scm'
|
2018-07-10 17:59:15 -04:00
|
|
|
apply plugin: 'com.github.johnrengelman.shadow'
|
2016-12-29 12:16:04 -05:00
|
|
|
|
|
|
|
group = 'org.elasticsearch.client'
|
2017-07-13 03:44:25 -04:00
|
|
|
archivesBaseName = 'elasticsearch-rest-high-level-client'
|
|
|
|
|
|
|
|
publishing {
|
2018-07-10 17:59:15 -04:00
|
|
|
publications {
|
|
|
|
nebula(MavenPublication) {
|
|
|
|
artifact shadowJar
|
|
|
|
artifactId = archivesBaseName
|
|
|
|
/*
|
|
|
|
* Configure the pom to include the "shadow" as compile dependencies
|
|
|
|
* because that is how we're using them but remove all other dependencies
|
|
|
|
* because they've been shaded into the jar.
|
|
|
|
*/
|
|
|
|
pom.withXml { XmlProvider xml ->
|
|
|
|
Node root = xml.asNode()
|
|
|
|
root.remove(root.dependencies)
|
|
|
|
Node dependenciesNode = root.appendNode('dependencies')
|
|
|
|
project.configurations.shadow.allDependencies.each {
|
|
|
|
if (false == it instanceof SelfResolvingDependency) {
|
|
|
|
Node dependencyNode = dependenciesNode.appendNode('dependency')
|
|
|
|
dependencyNode.appendNode('groupId', it.group)
|
|
|
|
dependencyNode.appendNode('artifactId', it.name)
|
|
|
|
dependencyNode.appendNode('version', it.version)
|
|
|
|
dependencyNode.appendNode('scope', 'compile')
|
|
|
|
}
|
2017-07-13 03:44:25 -04:00
|
|
|
}
|
2018-07-10 17:59:15 -04:00
|
|
|
}
|
2017-07-13 03:44:25 -04:00
|
|
|
}
|
2018-07-10 17:59:15 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We need somewhere to configure dependencies that we don't wish to shade
|
|
|
|
* into the high level REST client. The shadow plugin creates a "shadow"
|
|
|
|
* configuration which is *almost* exactly that. It is never bundled into
|
|
|
|
* the shaded jar but is used for main source compilation. Unfortunately,
|
|
|
|
* by default it is not used for *test* source compilation and isn't used
|
|
|
|
* in tests at all. This change makes it available for test compilation.
|
|
|
|
* A change below makes it available for testing.
|
|
|
|
*/
|
|
|
|
sourceSets {
|
|
|
|
test {
|
|
|
|
compileClasspath += configurations.shadow
|
|
|
|
}
|
2017-07-13 03:44:25 -04:00
|
|
|
}
|
2016-12-29 12:16:04 -05:00
|
|
|
|
|
|
|
dependencies {
|
2018-07-10 17:59:15 -04:00
|
|
|
/*
|
|
|
|
* Everything in the "shadow" configuration is *not* copied into the
|
|
|
|
* shadowJar.
|
|
|
|
*/
|
|
|
|
shadow "org.elasticsearch:elasticsearch:${version}"
|
|
|
|
shadow "org.elasticsearch.client:elasticsearch-rest-client:${version}"
|
|
|
|
shadow "org.elasticsearch.plugin:parent-join-client:${version}"
|
|
|
|
shadow "org.elasticsearch.plugin:aggs-matrix-stats-client:${version}"
|
|
|
|
shadow "org.elasticsearch.plugin:rank-eval-client:${version}"
|
|
|
|
shadow "org.elasticsearch.plugin:lang-mustache-client:${version}"
|
|
|
|
compile project(':x-pack:protocol')
|
2016-12-29 12:16:04 -05:00
|
|
|
|
|
|
|
testCompile "org.elasticsearch.client:test:${version}"
|
|
|
|
testCompile "org.elasticsearch.test:framework:${version}"
|
|
|
|
testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
|
|
|
|
testCompile "junit:junit:${versions.junit}"
|
|
|
|
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencyLicenses {
|
|
|
|
// Don't check licenses for dependency that are part of the elasticsearch project
|
|
|
|
// But any other dependency should have its license/notice/sha1
|
|
|
|
dependencies = project.configurations.runtime.fileCollection {
|
|
|
|
it.group.startsWith('org.elasticsearch') == false
|
|
|
|
}
|
|
|
|
}
|
2017-02-17 14:45:41 -05:00
|
|
|
|
|
|
|
forbiddenApisMain {
|
|
|
|
// core does not depend on the httpclient for compile so we add the signatures here. We don't add them for test as they are already
|
|
|
|
// specified
|
|
|
|
signaturesURLs += [PrecommitTasks.getResource('/forbidden/http-signatures.txt')]
|
2017-09-06 03:58:46 -04:00
|
|
|
signaturesURLs += [file('src/main/resources/forbidden/rest-high-level-signatures.txt').toURI().toURL()]
|
2017-12-13 10:26:47 -05:00
|
|
|
}
|
2018-07-10 17:59:15 -04:00
|
|
|
|
|
|
|
shadowJar {
|
|
|
|
classifier = null
|
|
|
|
mergeServiceFiles()
|
|
|
|
}
|
|
|
|
|
|
|
|
// We don't need normal jar, we use shadow jar instead
|
|
|
|
jar.enabled = false
|
|
|
|
assemble.dependsOn shadowJar
|
|
|
|
|
|
|
|
javadoc {
|
|
|
|
/*
|
|
|
|
* Bundle all of the javadoc from all of the shaded projects into this one
|
|
|
|
* so we don't *have* to publish javadoc for all of the "client" jars.
|
|
|
|
*/
|
|
|
|
configurations.compile.dependencies.all { Dependency dep ->
|
|
|
|
Project p = dependencyToProject(dep)
|
|
|
|
if (p != null) {
|
|
|
|
evaluationDependsOn(p.path)
|
|
|
|
source += p.sourceSets.main.allJava
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Use the jar for testing so we have tests of the bundled jar.
|
|
|
|
* Use the "shadow" configuration for testing because we need things
|
|
|
|
* in it.
|
|
|
|
*/
|
|
|
|
test {
|
|
|
|
classpath -= compileJava.outputs.files
|
|
|
|
classpath -= configurations.compile
|
|
|
|
classpath -= configurations.runtime
|
|
|
|
classpath += configurations.shadow
|
|
|
|
classpath += shadowJar.outputs.files
|
|
|
|
dependsOn shadowJar
|
|
|
|
}
|
|
|
|
integTestRunner {
|
|
|
|
classpath -= compileJava.outputs.files
|
|
|
|
classpath -= configurations.compile
|
|
|
|
classpath -= configurations.runtime
|
|
|
|
classpath += configurations.shadow
|
|
|
|
classpath += shadowJar.outputs.files
|
|
|
|
dependsOn shadowJar
|
|
|
|
}
|