2018-01-25 04:38:34 -05:00
|
|
|
import com.carrotsearch.gradle.junit4.RandomizedTestingTask
|
|
|
|
import org.elasticsearch.gradle.BuildPlugin
|
2018-01-20 00:30:17 -05:00
|
|
|
import org.elasticsearch.gradle.MavenFilteringHack
|
|
|
|
|
2018-01-21 10:00:47 -05:00
|
|
|
import java.nio.file.Files
|
|
|
|
import java.nio.file.Path
|
|
|
|
import java.nio.file.StandardCopyOption
|
|
|
|
|
2018-01-20 00:30:17 -05:00
|
|
|
apply plugin: 'elasticsearch.esplugin'
|
2018-01-23 01:58:34 -05:00
|
|
|
|
|
|
|
archivesBaseName = 'x-pack-core'
|
|
|
|
|
2018-01-20 00:30:17 -05:00
|
|
|
esplugin {
|
|
|
|
name 'x-pack-core'
|
|
|
|
description 'Elasticsearch Expanded Pack Plugin - Core'
|
2018-01-23 13:43:58 -05:00
|
|
|
classname 'org.elasticsearch.xpack.core.XPackPlugin'
|
2018-01-21 11:00:51 -05:00
|
|
|
hasNativeController false
|
2018-01-25 08:33:30 -05:00
|
|
|
requiresKeystore false
|
2018-01-20 00:30:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencyLicenses {
|
|
|
|
mapping from: /bc.*/, to: 'bouncycastle'
|
|
|
|
mapping from: /http.*/, to: 'httpclient' // pulled in by rest client
|
|
|
|
mapping from: /commons-.*/, to: 'commons' // pulled in by rest client
|
|
|
|
}
|
2017-12-08 11:41:32 -05:00
|
|
|
|
|
|
|
dependencies {
|
|
|
|
provided "org.elasticsearch:elasticsearch:${version}"
|
2018-01-20 00:30:17 -05:00
|
|
|
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
|
|
|
|
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
|
2018-01-23 01:58:34 -05:00
|
|
|
compile "org.apache.httpcomponents:httpcore-nio:${versions.httpcore}"
|
2018-01-20 00:30:17 -05:00
|
|
|
compile "org.apache.httpcomponents:httpasyncclient:${versions.httpasyncclient}"
|
|
|
|
|
|
|
|
compile "commons-logging:commons-logging:${versions.commonslogging}"
|
|
|
|
compile "commons-codec:commons-codec:${versions.commonscodec}"
|
|
|
|
|
|
|
|
// security deps
|
|
|
|
compile 'com.unboundid:unboundid-ldapsdk:3.2.0'
|
|
|
|
compile 'org.bouncycastle:bcprov-jdk15on:1.58'
|
|
|
|
compile 'org.bouncycastle:bcpkix-jdk15on:1.58'
|
|
|
|
compile project(path: ':modules:transport-netty4', configuration: 'runtime')
|
|
|
|
|
|
|
|
testCompile 'org.elasticsearch:securemock:1.2'
|
|
|
|
testCompile "org.elasticsearch:mocksocket:${versions.mocksocket}"
|
2018-01-20 17:43:00 -05:00
|
|
|
testCompile "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}"
|
|
|
|
testCompile "org.slf4j:slf4j-api:${versions.slf4j}"
|
2018-01-20 00:30:17 -05:00
|
|
|
testCompile project(path: ':modules:reindex', configuration: 'runtime')
|
|
|
|
testCompile project(path: ':modules:parent-join', configuration: 'runtime')
|
|
|
|
testCompile project(path: ':modules:analysis-common', configuration: 'runtime')
|
|
|
|
}
|
|
|
|
|
2018-01-23 01:58:34 -05:00
|
|
|
ext.expansions = [
|
|
|
|
'project.version': version
|
|
|
|
]
|
|
|
|
|
2018-01-20 00:30:17 -05:00
|
|
|
processResources {
|
|
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
|
|
exclude '**/public.key'
|
|
|
|
inputs.properties(expansions)
|
|
|
|
MavenFilteringHack.filter(it, expansions)
|
|
|
|
}
|
|
|
|
boolean snapshot = "true".equals(System.getProperty("build.snapshot", "true"))
|
|
|
|
if (snapshot) {
|
|
|
|
from '../keys/dev/public.key'
|
|
|
|
} else {
|
|
|
|
from '../keys/prod/public.key'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
forbiddenPatterns {
|
|
|
|
exclude '**/*.key'
|
|
|
|
exclude '**/*.p12'
|
|
|
|
exclude '**/*.der'
|
|
|
|
exclude '**/*.zip'
|
2017-12-08 11:41:32 -05:00
|
|
|
}
|
|
|
|
|
2017-12-27 11:31:16 -05:00
|
|
|
compileJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,-try,-unchecked"
|
2018-01-20 00:30:17 -05:00
|
|
|
compileTestJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,-try,-unchecked"
|
2017-12-27 11:31:16 -05:00
|
|
|
|
|
|
|
licenseHeaders {
|
|
|
|
approvedLicenses << 'BCrypt (BSD-like)'
|
|
|
|
additionalLicense 'BCRYP', 'BCrypt (BSD-like)', 'Copyright (c) 2006 Damien Miller <djm@mindrot.org>'
|
2018-01-20 00:30:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// make LicenseSigner available for testing signed licenses
|
|
|
|
sourceSets.test.java {
|
|
|
|
srcDir '../../license-tools/src/main/java'
|
|
|
|
}
|
|
|
|
|
2018-01-23 01:58:34 -05:00
|
|
|
// TODO: remove this jar once xpack extensions have been removed
|
2018-01-21 10:00:47 -05:00
|
|
|
// assemble the API JAR for the transport-client and extension authors; this JAR is the core JAR by another name
|
|
|
|
project.afterEvaluate {
|
|
|
|
task apiJar {
|
|
|
|
dependsOn('generatePomFileForApijarPublication', project.jar)
|
|
|
|
doFirst {
|
|
|
|
Path jarFile = project.jar.outputs.files.singleFile.toPath()
|
|
|
|
String apiFileName = jarFile.fileName.toString().replace("core-${project.version}", "api-${project.version}")
|
|
|
|
Files.copy(jarFile, jarFile.resolveSibling(apiFileName), StandardCopyOption.REPLACE_EXISTING)
|
|
|
|
|
|
|
|
String pomFileName = jarFile.fileName.toString().replace('.jar', '.pom')
|
|
|
|
String apiPomFileName = apiFileName.replace('.jar', '.pom')
|
|
|
|
Files.copy(jarFile.resolveSibling(pomFileName), jarFile.resolveSibling(apiPomFileName),
|
|
|
|
StandardCopyOption.REPLACE_EXISTING)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assemble.dependsOn(apiJar)
|
|
|
|
project.publishing {
|
|
|
|
publications {
|
|
|
|
apijar(MavenPublication) {
|
|
|
|
from project.components.java
|
|
|
|
artifactId = 'x-pack-api'
|
|
|
|
pom.withXml { XmlProvider xml ->
|
|
|
|
Node root = xml.asNode()
|
|
|
|
root.appendNode('name', project.pluginProperties.extension.name)
|
|
|
|
root.appendNode('description', project.pluginProperties.extension.description)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-20 00:30:17 -05:00
|
|
|
test {
|
|
|
|
/*
|
|
|
|
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
|
|
|
|
* other if we allow them to set the number of available processors as it's set-once in Netty.
|
|
|
|
*/
|
|
|
|
systemProperty 'es.set.netty.runtime.available.processors', 'false'
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: don't publish test artifacts just to run messy tests, fix the tests!
|
|
|
|
// https://github.com/elastic/x-plugins/issues/724
|
|
|
|
configurations {
|
|
|
|
testArtifacts.extendsFrom testRuntime
|
|
|
|
}
|
|
|
|
task testJar(type: Jar) {
|
|
|
|
appendix 'test'
|
|
|
|
from sourceSets.test.output
|
|
|
|
}
|
|
|
|
artifacts {
|
|
|
|
// normal es plugins do not publish the jar but we need to since users need it for Transport Clients and extensions
|
|
|
|
archives jar
|
|
|
|
testArtifacts testJar
|
|
|
|
}
|
|
|
|
|
2018-01-23 01:58:34 -05:00
|
|
|
thirdPartyAudit.excludes = [
|
|
|
|
//commons-logging optional dependencies
|
|
|
|
'org.apache.avalon.framework.logger.Logger',
|
|
|
|
'org.apache.log.Hierarchy',
|
|
|
|
'org.apache.log.Logger',
|
|
|
|
//commons-logging provided dependencies
|
|
|
|
'javax.servlet.ServletContextEvent',
|
|
|
|
'javax.servlet.ServletContextListener'
|
|
|
|
]
|
2018-01-25 04:38:34 -05:00
|
|
|
|
|
|
|
// xpack modules are installed in real clusters as the meta plugin, so
|
|
|
|
// installing them as individual plugins for integ tests doesn't make sense,
|
|
|
|
// so we disable integ tests
|
|
|
|
integTest.enabled = false
|
|
|
|
|
|
|
|
// Instead we create a separate task to run the
|
|
|
|
// tests based on ESIntegTestCase
|
|
|
|
task internalClusterTest(type: RandomizedTestingTask,
|
|
|
|
group: JavaBasePlugin.VERIFICATION_GROUP,
|
|
|
|
description: 'Multi-node tests',
|
|
|
|
dependsOn: test.dependsOn) {
|
|
|
|
configure(BuildPlugin.commonTestConfig(project))
|
|
|
|
classpath = project.test.classpath
|
|
|
|
testClassesDir = project.test.testClassesDir
|
|
|
|
include '**/*IT.class'
|
|
|
|
systemProperty 'es.set.netty.runtime.available.processors', 'false'
|
|
|
|
}
|
|
|
|
check.dependsOn internalClusterTest
|
|
|
|
internalClusterTest.mustRunAfter test
|
|
|
|
|
|
|
|
// also add an "alias" task to make typing on the command line easier
|
|
|
|
task icTest {
|
|
|
|
dependsOn internalClusterTest
|
|
|
|
}
|