-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
153 lines (121 loc) · 4.19 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
buildscript {
ext {
localversions = [
es : "7.14.1",
c2plugin : "7.14.1",
l3g : "2.0.0",
log4j : "2.11.1"
]
}
repositories {
mavenCentral()
}
dependencies {
classpath "org.elasticsearch.gradle:build-tools:${localversions.es}"
}
}
plugins {
id 'java-library'
id 'idea'
id 'com.diffplug.spotless' version "5.14.3" apply false
id 'com.carrotsearch.gradle.opts' version '0.0.6'
}
apply plugin: 'elasticsearch.esplugin'
// apply plugin: 'elasticsearch.java-rest-test'
apply from: file('gradle/validation/spotless.gradle')
opts {
option([name: "license", defaultValue: null, description: "Point at your local Lingo3G license file."])
}
// This plugin's version (typically must match that of ES).
// For bugfix releases against the same ES version, you can add a bugfix suffix.
def bugfix = ""
version = "${localversions.es}${bugfix}"
group = 'com.carrotsearch'
repositories {
mavenLocal()
mavenCentral()
}
ext {
licenseFile = rootProject.file('LICENSE.txt')
noticeFile = rootProject.file('NOTICE.txt')
}
esplugin {
name 'elasticsearch-lingo3g'
description "Lingo3G Clustering Algorithm Extension for elasticsearch-carrot2 plugin (Lingo3G: ${localversions.l3g}, ES: ${localversions.es} elasticsearch-carrot2: ${localversions.c2plugin})"
classname 'com.carrotsearch.lingo3g.integrations.elasticsearch.Lingo3GPlugin'
extendedPlugins = ['elasticsearch-carrot2']
}
configurations {
extendedZip
extendedJar
compileOnly.extendsFrom(extendedJar)
lingo3g
implementation.extendsFrom(lingo3g)
bundleOssPlugin
}
dependencies {
lingo3g("com.carrotsearch.lingo3g:lingo3g:${localversions.l3g}", {
exclude group: "org.carrot2", module: "core"
exclude group: "com.carrotsearch", module: "hppc"
})
implementation("org.apache.logging.log4j:log4j-slf4j18-impl:${localversions.log4j}", {
exclude group: "org.apache.logging.log4j", module: "log4j-core"
exclude group: "org.apache.logging.log4j", module: "log4j-api"
exclude group: "org.slf4j"
})
extendedZip group: 'org.carrot2', name: 'elasticsearch-carrot2', version: localversions.c2plugin, ext: 'zip'
extendedJar group: 'org.carrot2', name: 'elasticsearch-carrot2', version: localversions.c2plugin
testImplementation "org.assertj:assertj-core:3.13.2"
// Let the javaRestTest see the classpath of main and tests.
// javaRestTestImplementation project.sourceSets.main.runtimeClasspath
// javaRestTestImplementation project.sourceSets.test.runtimeClasspath
}
// Set target compatibility
sourceCompatibility = 11
targetCompatibility = 11
// We don't have unit tests, only integration tests.
test.enabled = false
// Add plugin configuration files to each testClusters instance.
// 'extraConfigFile' doesn't allow directories, only files, so we
// need to add each individually
testClusters.all {
fileTree(dir: 'src/main/config').each { file ->
extraConfigFile 'elasticsearch-lingo3g/' + file.name, file
}
if (opts['license'].value) {
extraConfigFile 'elasticsearch-lingo3g/license.xml', file(opts['license'].value)
}
// Add elasticsearch-carrot2 to testclusters.
plugin project.layout.file(provider { configurations.extendedZip.singleFile })
}
// Create the "oss" (bare) distribution artifact (excludes commercial Lingo3G JARs).
task buildOssPlugin(type: Zip) {
dependsOn tasks.getByName("bundlePlugin")
archiveFileName = "${archivesBaseName}-${project.version}-oss.zip"
destinationDir file("${buildDir}/distributions-oss")
from(zipTree(tasks.getByName("bundlePlugin").outputs.files.singleFile), {
exclude "**/lingo3g-*"
})
}
assemble.dependsOn buildOssPlugin
artifacts {
bundleOssPlugin tasks.buildOssPlugin
}
// If no Lingo3G license is specified, skip the tests.
task displayLicenseWarning() {
doFirst {
logger.warn("Can't test without the license (pass via -Plicense=...).")
}
}
tasks.matching { it.name in ["javaRestTest"] }.all {
if (!opts['license'].value) {
enabled = false
dependsOn displayLicenseWarning
}
}
// Configure publishing.
apply from: file('gradle/publishing.gradle')
// TODO: ES 7.13.4 hack. We generate our own POM.
tasks.matching { it.path == ":validateElasticPom" }.all { Task t ->
enabled = false
}