-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
151 lines (122 loc) · 4.71 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
/*
* Copyright 2020 Aiven Oy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/
import org.gradle.util.DistributionLocator
import org.gradle.util.GradleVersion
wrapper {
distributionType = 'ALL'
doLast {
final DistributionLocator locator = new DistributionLocator()
final GradleVersion version = GradleVersion.version(wrapper.gradleVersion)
final URI distributionUri = locator.getDistributionFor(version, wrapper.distributionType.name().toLowerCase(Locale.ENGLISH))
final URI sha256Uri = new URI(distributionUri.toString() + ".sha256")
final String sha256Sum = new String(sha256Uri.toURL().bytes)
wrapper.getPropertiesFile() << "distributionSha256Sum=${sha256Sum}\n"
println "Added checksum to wrapper properties"
}
}
allprojects {
// https://docs.gradle.org/current/userguide/java_library_plugin.html
apply plugin: 'java'
// https://docs.gradle.org/current/userguide/distribution_plugin.html
apply plugin: 'distribution'
// https://docs.gradle.org/current/userguide/checkstyle_plugin.html
apply plugin: 'checkstyle'
// https://docs.gradle.org/current/userguide/publishing_maven.html
apply plugin: "maven-publish"
apply plugin: "idea"
ext {
slf4jVersion = "1.7.35"
opensearchVersion = "1.3.1"
// since jackson-core is in the main classpath
// plz keep the same version as for OpenSearch
jacksonDatabind = "2.12.6"
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
}
distributions {
main {
contents {
from jar
from configurations.runtimeClasspath
from(sourceSets.main.output.resourcesDir) {
include "*.properties", "*.policy"
}
from(projectDir) {
include "README*", "LICENSE*", "NOTICE*"
}
into '/'
}
}
}
processResources {
filesMatching('plugin-descriptor.properties') {
expand(version: project.version,
javaVersion: java.sourceCompatibility,
opensearchVersion: opensearchVersion
)
}
}
sourceSets {
integrationTest {
java.srcDir file('src/integration-test/java')
resources.srcDir file('src/integration-test/resources')
compileClasspath += sourceSets.main.output + configurations.testRuntimeClasspath
runtimeClasspath += output + compileClasspath
}
}
idea {
module {
testSourceDirs += project.sourceSets.integrationTest.java.srcDirs
testSourceDirs += project.sourceSets.integrationTest.resources.srcDirs
}
}
checkstyle {
toolVersion "8.44"
configDirectory.set(rootProject.file("checkstyle/"))
}
test {
useJUnitPlatform()
minHeapSize = "1024m"
maxHeapSize = "1024m"
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntime
}
dependencies {
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonDatabind") {
exclude group: "com.fasterxml.jackson.core", module: "jackson-core"
}
compileOnly "org.opensearch:opensearch:$opensearchVersion"
implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.17.1") {
exclude group: "org.slf4j", module: "slf4j-api"
exclude group: "org.apache.logging.log4j", module: "log4j-api"
exclude group: "org.apache.logging.log4j", module: "log4j-core"
}
implementation "org.slf4j:slf4j-api:$slf4jVersion"
testImplementation "org.mockito:mockito-core:4.3.0"
testImplementation "org.mockito:mockito-junit-jupiter:4.3.0"
testImplementation "org.opensearch:opensearch:$opensearchVersion"
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
integrationTestImplementation sourceSets.test.output
}
}