OpenSearch/x-pack/plugin/ml/build.gradle

115 lines
3.4 KiB
Groovy

apply plugin: 'elasticsearch.esplugin'
apply plugin: 'elasticsearch.internal-cluster-test'
esplugin {
name 'x-pack-ml'
description 'Elasticsearch Expanded Pack Plugin - Machine Learning'
classname 'org.elasticsearch.xpack.ml.MachineLearning'
hasNativeController true
extendedPlugins = ['x-pack-core', 'lang-painless']
}
repositories {
ivy {
name "ml-cpp"
url System.getProperty('build.ml_cpp.repo', 'https://prelert-artifacts.s3.amazonaws.com')
metadataSources {
// no repository metadata, look directly for the artifact
artifact()
}
patternLayout {
artifact "maven/org/elasticsearch/ml/ml-cpp/[revision]/ml-cpp-[revision].[ext]"
}
}
}
configurations {
nativeBundle {
resolutionStrategy.dependencySubstitution {
if (findProject(':ml-cpp') != null) {
substitute module("org.elasticsearch.ml:ml-cpp") with project(":ml-cpp")
}
}
resolutionStrategy.cacheChangingModulesFor 2, 'hours'
}
}
bundlePlugin {
dependsOn configurations.nativeBundle
from {
project.zipTree(configurations.nativeBundle.singleFile)
}
// We don't ship the individual nativeBundle licenses - instead
// they get combined into the top level NOTICES file we ship
exclude 'platform/licenses/**'
}
dependencies {
compileOnly project(':modules:lang-painless:spi')
compileOnly project(path: xpackModule('core'), configuration: 'default')
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
testImplementation project(path: xpackModule('ilm'), configuration: 'default')
// This should not be here
testImplementation project(path: xpackModule('security'), configuration: 'testArtifacts')
// ml deps
api project(':libs:elasticsearch-grok')
api "com.ibm.icu:icu4j:${versions.icu4j}"
api "net.sf.supercsv:super-csv:${versions.supercsv}"
nativeBundle("org.elasticsearch.ml:ml-cpp:${project.version}@zip") {
changing = true
}
testImplementation 'org.ini4j:ini4j:0.5.2'
}
configurations {
testArtifacts.extendsFrom testRuntime
testArtifacts.extendsFrom testImplementation
}
TaskProvider testJar = tasks.register("testJar", 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 tasks.named('jar')
testArtifacts testJar
}
tasks.register("extractNativeLicenses", Copy) {
dependsOn configurations.nativeBundle
into "${buildDir}"
from {
project.zipTree(configurations.nativeBundle.singleFile)
}
include 'platform/licenses/**'
}
project.afterEvaluate {
// Add an extra licenses directory to the combined notices
tasks.named('generateNotice').configure {
dependsOn "extractNativeLicenses"
licensesDir new File("${project.buildDir}/platform/licenses")
outputs.upToDateWhen {
extractNativeLicenses.didWork
}
}
}
// 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
tasks.named("integTest").configure {
enabled = false
}
def checkTask = tasks.named("check")
// add all sub-projects of the qa sub-project
gradle.projectsEvaluated {
project.subprojects
.find { it.path == project.path + ":qa" }
.subprojects
.findAll { it.path.startsWith(project.path + ":qa") }
.each { subProj -> checkTask.configure { dependsOn subProj.tasks.named("check") } }
}