forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
139 lines (125 loc) · 4.86 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.internal.dra.DraResolvePlugin
apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.internal-cluster-test'
apply plugin: 'elasticsearch.internal-test-artifact'
apply plugin: 'elasticsearch.dra-artifacts'
esplugin {
name 'x-pack-ml'
description 'Elasticsearch Expanded Pack Plugin - Machine Learning'
classname 'org.elasticsearch.xpack.ml.MachineLearning'
hasNativeController true
extendedPlugins = ['x-pack-autoscaling', 'lang-painless']
}
def localRepo = providers.systemProperty('build.ml_cpp.repo').orNull
if (useDra == false) {
repositories {
exclusiveContent {
filter {
includeGroup 'org.elasticsearch.ml'
}
forRepository {
ivy {
name "ml-cpp"
metadataSources {
// no repository metadata, look directly for the artifact
artifact()
}
if (localRepo) {
url localRepo
patternLayout {
artifact "maven/[orgPath]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]"
}
} else {
url "https://artifacts-snapshot.elastic.co/"
patternLayout {
if (VersionProperties.isElasticsearchSnapshot()) {
artifact '/ml-cpp/[revision]/downloads/ml-cpp/[module]-[revision]-[classifier].[ext]'
} else {
// When building locally we always use snapshot artifacts even if passing `-Dbuild.snapshot=false`.
// Release builds are always done with a local repo.
artifact '/ml-cpp/[revision]-SNAPSHOT/downloads/ml-cpp/[module]-[revision]-SNAPSHOT-[classifier].[ext]'
}
}
}
}
}
}
}
}
configurations {
nativeBundle {
resolutionStrategy.cacheChangingModulesFor 2, 'hours'
}
}
esplugin.bundleSpec.from {
configurations.nativeBundle.files.collect { zipTree(it) }
}
// We don't ship the individual nativeBundle licenses - instead
// they get combined into the top level NOTICES file we ship
esplugin.bundleSpec.exclude 'platform/licenses/**'
["bundlePlugin", "explodedBundlePlugin"].each { bundleTaskName ->
tasks.named(bundleTaskName).configure {
dependsOn configurations.nativeBundle
}
}
dependencies {
testImplementation project(path: ':x-pack:plugin:inference')
compileOnly project(':modules:lang-painless:spi')
compileOnly project(path: xpackModule('core'))
compileOnly project(path: xpackModule('autoscaling'))
compileOnly project(path: xpackModule('ml-package-loader'))
testImplementation(testArtifact(project(xpackModule('core'))))
testImplementation project(path: xpackModule('ilm'))
testImplementation project(path: xpackModule('shutdown'))
testImplementation project(':modules:data-streams')
testImplementation project(path: xpackModule('monitoring'))
testImplementation project(':modules:ingest-common')
testImplementation project(':modules:reindex')
testImplementation project(':modules:analysis-common')
testImplementation project(':modules:mapper-extras')
testImplementation project(':modules:lang-mustache')
// This should not be here
testImplementation(testArtifact(project(xpackModule('security'))))
testImplementation project(path: xpackModule('wildcard'))
// ml deps
api project(':libs:elasticsearch-grok')
api project(':modules:lang-mustache')
api "org.apache.commons:commons-math3:3.6.1"
api "com.ibm.icu:icu4j:${versions.icu4j}"
api "org.apache.lucene:lucene-analysis-icu:${versions.lucene}"
api "org.apache.lucene:lucene-analysis-kuromoji:${versions.lucene}"
implementation 'org.ojalgo:ojalgo:51.2.0'
nativeBundle("org.elasticsearch.ml:ml-cpp:${project.version}:deps@zip") {
changing = true
}
nativeBundle("org.elasticsearch.ml:ml-cpp:${project.version}:nodeps@zip") {
changing = true
}
testImplementation 'org.ini4j:ini4j:0.5.2'
testImplementation "com.google.jimfs:jimfs:${versions.jimfs}"
}
artifacts {
// normal es plugins do not publish the jar but we need to since users need it for extensions
archives tasks.named("jar")
}
tasks.register("extractNativeLicenses", Copy) {
dependsOn configurations.nativeBundle
into "${buildDir}/extractedNativeLicenses"
from {
configurations.nativeBundle.files.collect { zipTree(it) }
}
include 'platform/licenses/**'
}
// Add an extra licenses directory to the combined notices
tasks.named('generateNotice').configure {
dependsOn "extractNativeLicenses"
inputs.dir("${project.buildDir}/extractedNativeLicenses/platform/licenses")
.withPropertyName('licensingDir')
.withPathSensitivity(PathSensitivity.RELATIVE)
licenseDirs.add(tasks.named("extractNativeLicenses").map {new File(it.destinationDir, "platform/licenses") })
}
tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
}
addQaCheckDependencies(project)