This repository has been archived by the owner on Oct 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.gradle
131 lines (107 loc) · 3.8 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
import java.nio.file.Files
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
// the old co.riiid.gradle is not gradle 7.0 compatible
id "com.github.humblerookie.gradle" version "0.4.4"
id "com.github.ben-manes.versions" version '0.42.0'
}
repositories {
mavenCentral()
}
group = 'de.spinscale.elasticsearch.plugin'
version = "${elasticsearchVersion}.1-SNAPSHOT"
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = '17'
task pluginDescriptor(type: Copy) {
from('src/main/resources') {
include '**/*.properties'
filter(ReplaceTokens, tokens: [
'version': version.replace('-SNAPSHOT', '').toString(),
'elasticsearchVersion': elasticsearchVersion.toString()
])
}
into 'build/libs'
}
task copyDependencies(type: Copy) {
into 'build/libs'
from configurations.default
from 'NOTICE.txt'
from 'LICENSE.txt'
from 'src/main/resources/plugin-security.policy'
}
task packageDistribution(type: Zip) {
archiveFileName = "elasticsearch-ingest-langdetect.zip"
destinationDirectory = layout.buildDirectory.dir('distribution')
from layout.buildDirectory.dir("libs")
}
task builderDockerImage(type: Exec) {
commandLine 'docker', 'build', '.'
}
// split tests between unit and integration tests
def testReporter = { desc, result ->
if (!desc.parent) {
def duration = java.time.Duration.ofMillis(result.endTime - result.startTime)
println "\nTest summary: ${result.resultType}, ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped, took ${duration}"
}
}
tasks.named('test') {
useJUnitPlatform {
excludeTags 'slow'
}
afterSuite testReporter
}
task integrationTest(type: Test) {
useJUnitPlatform {
includeTags 'slow'
}
afterSuite testReporter
}
packageDistribution.dependsOn 'pluginDescriptor'
packageDistribution.dependsOn 'copyDependencies'
packageDistribution.dependsOn 'jar'
builderDockerImage.dependsOn 'packageDistribution'
integrationTest.dependsOn 'builderDockerImage'
// ignore javadoc warnings for now
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
githubRelease.doFirst {
if (!System.getProperty('GITHUB_TOKEN', '')) {
throw new Exception('Missing property GITHUB_TOKEN')
}
def currentVersion = version.replace('-SNAPSHOT', '')
def filename = "build/distribution/ingest-langdetect-${currentVersion}.zip"
Files.copy(file("build/distribution/elasticsearch-ingest-langdetect.zip").toPath(), file(filename).toPath())
// configuration
github {
owner = 'spinscale'
repo = 'elasticsearch-ingest-langdetect'
token = System.getProperty('GITHUB_TOKEN')
tagName = currentVersion
assets = [ filename ]
targetCommitish = 'main'
}
}
githubRelease.dependsOn 'packageDistribution'
dependencies {
def junitVersion = '5.9.0'
implementation 'com.youcruit.com.cybozu.labs:langdetect:1.1.2-20151117'
implementation 'net.arnx:jsonic:1.3.10'
compileOnly "org.elasticsearch:elasticsearch:$elasticsearchVersion"
testImplementation "org.elasticsearch:elasticsearch:$elasticsearchVersion"
testImplementation "co.elastic.clients:elasticsearch-java:$elasticsearchVersion"
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.13.3'
testImplementation('org.testcontainers:elasticsearch:1.17.3') {
exclude group: 'junit', module: 'junit'
}
testImplementation 'org.testcontainers:junit-jupiter:1.17.3'
testImplementation 'org.assertj:assertj-core:3.23.1'
testImplementation "org.slf4j:slf4j-simple:1.7.36"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
}