forked from opendistro-for-elasticsearch/index-management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
172 lines (144 loc) · 5.54 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
buildscript {
ext {
es_version = System.getProperty("es.version", "7.6.1")
kotlin_version = System.getProperty("kotlin.version", "1.3.61")
}
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
// For local publish dependency
mavenLocal()
}
dependencies {
classpath "org.elasticsearch.gradle:build-tools:${es_version}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
classpath "org.jetbrains.kotlin:kotlin-allopen:${kotlin_version}"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0-RC15"
classpath "org.jacoco:org.jacoco.agent:0.8.5"
}
}
plugins {
id 'nebula.ospackage' version "8.2.0"
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'idea'
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.jetbrains.kotlin.plugin.allopen'
if (!System.properties.containsKey('tests.rest.cluster') && !System.properties.containsKey('tests.cluster')) {
apply from: 'build-tools/esplugin-coverage.gradle'
}
check.dependsOn jacocoTestReport
esplugin {
name 'opendistro_index_management'
description 'Open Distro Index State Management Plugin'
classname 'com.amazon.opendistroforelasticsearch.indexstatemanagement.IndexStateManagementPlugin'
extendedPlugins = ['opendistro-job-scheduler']
}
allOpen {
annotation("com.amazon.opendistroforelasticsearch.indexstatemanagement.util.OpenForTesting")
}
configurations {
ktlint
}
detekt {
config = files("detekt.yml")
buildUponDefaultConfig = true
}
dependencies {
compileOnly "org.elasticsearch:elasticsearch:${es_version}"
compileOnly "com.amazon.opendistroforelasticsearch:opendistro-job-scheduler-spi:1.6.0.0"
compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
compile "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1'
compile "org.jetbrains:annotations:13.0"
compile "com.amazon.opendistroforelasticsearch:notification:1.6.0.0"
testCompile "org.elasticsearch.test:framework:${es_version}"
testCompile "org.jetbrains.kotlin:kotlin-test:${kotlin_version}"
ktlint "com.pinterest:ktlint:0.33.0"
}
repositories {
// TODO: remove mavenLocal once notification is published to maven
mavenLocal()
}
ext {
projectSubstitutions = [:]
opendistroVersion = "${version}"
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
licenseFile = rootProject.file('LICENSE')
noticeFile = rootProject.file('NOTICE')
}
group = "com.amazon.opendistroforelasticsearch"
version = "${opendistroVersion}.0"
if (isSnapshot) {
version += "-SNAPSHOT"
}
plugins.withId('java') {
sourceCompatibility = targetCompatibility = "1.8"
}
plugins.withId('org.jetbrains.kotlin.jvm') {
compileKotlin.kotlinOptions.jvmTarget = compileTestKotlin.kotlinOptions.jvmTarget = "1.8"
}
javadoc.enabled = false // turn off javadoc as it barfs on Kotlin code
licenseHeaders.enabled = true
dependencyLicenses.enabled = false
thirdPartyAudit.enabled = false
def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile
es_tmp_dir.mkdirs()
test {
systemProperty 'tests.security.manager', 'false'
}
testClusters.integTest {
testDistribution = "OSS"
if (System.getProperty("cluster.debug") != null) {
jvmArgs('-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=5005')
}
plugin(fileTree("src/test/resources/job-scheduler").getSingleFile())
}
integTest.runner {
systemProperty 'tests.security.manager', 'false'
systemProperty 'java.io.tmpdir', es_tmp_dir.absolutePath
// Tell the test JVM if the cluster JVM is running under a debugger so that tests can use longer timeouts for
// requests. The 'doFirst' delays reading the debug setting on the cluster till execution time.
doFirst {
systemProperty 'cluster.debug', getDebug()
}
// The -Dcluster.debug option makes the cluster debuggable; this makes the tests debuggable
if (System.getProperty("test.debug") != null) {
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=8000'
}
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "src/**/*.kt"
// to generate report in checkstyle format prepend following args:
// "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/ktlint.xml"
// see https://github.com/pinterest/ktlint#usage for more
}
check.dependsOn ktlint
task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "-F", "src/**/*.kt"
}
apply from: 'build-tools/pkgbuild.gradle'