-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
259 lines (227 loc) · 8.15 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
import org.apache.tools.ant.filters.ReplaceTokens
import java.nio.charset.StandardCharsets
import static java.nio.charset.StandardCharsets.UTF_8
plugins {
id 'idea'
id 'java'
id 'java-library'
id 'maven-publish'
id 'jacoco'
id 'jvm-test-suite'
id 'jacoco-report-aggregation'
id 'signing'
}
group = 'io.github.honhimw'
version = '1.11.0.0' // API docs version plus '.x(-SNAPSHOT/RC.x)?'
description = 'Reactive meilisearch rest client powered by reactor-netty-http.'
def title = 'Meilisearch rest client for java'
def reactorVersion = '2023.0.11'
def jacksonVersion = '2.18.1'
def gsonVersion = '2.11.0'
def lombokVersion = '1.18.34'
def slf4jVersion = '2.0.16'
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'jacoco'
apply plugin: 'signing'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation platform("com.fasterxml.jackson:jackson-bom:${jacksonVersion}")
implementation platform("io.projectreactor:reactor-bom:${reactorVersion}")
implementation "io.projectreactor.netty:reactor-netty-http"
implementation 'com.fasterxml.jackson.core:jackson-core'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.core:jackson-annotations'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
compileOnly "com.google.code.gson:gson:${gsonVersion}"
compileOnly 'jakarta.annotation:jakarta.annotation-api:2.1.1'
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
}
dependencies {
testImplementation "com.google.code.gson:gson:${gsonVersion}"
testCompileOnly 'jakarta.annotation:jakarta.annotation-api:2.1.1'
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testImplementation 'io.projectreactor:reactor-test'
testImplementation "org.slf4j:slf4j-simple:${slf4jVersion}"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
withJavadocJar()
}
processTestResources {
def nm = new LinkedHashMap<String, String>()
project.properties.forEach { k, v ->
nm.put(k, v.toString())
}
nm.put('project.artifactId', project.name)
def properties = loadProfileProperties()
properties.forEach { k, v ->
nm.put(String.valueOf(k), String.valueOf(v))
}
filter ReplaceTokens, beginToken: '#{', endToken: '}', tokens: nm
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/honhimW/meilisearch-rest-client")
credentials {
username = githubProperties().getProperty("gpr.user") as String
password = githubProperties().getProperty("gpr.key") as String
}
}
maven {
name = "sonatype-snapshots"
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
credentials {
username = sonatypeProperties().getProperty("sonatype.username") as String
password = sonatypeProperties().getProperty("sonatype.password") as String
}
}
maven {
name = "sonatype-releases"
url = uri("https://s01.oss.sonatype.org/content/repositories/releases/")
credentials {
username = sonatypeProperties().getProperty("sonatype.username") as String
password = sonatypeProperties().getProperty("sonatype.password") as String
}
}
maven {
name = "sonatype-central"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = sonatypeProperties().getProperty("sonatype.username") as String
password = sonatypeProperties().getProperty("sonatype.password") as String
}
}
}
publications {
create('gpr', MavenPublication) {
from components.java
pom {
name.set(title)
description.set(project.description)
url.set("https://github.com/honhimW/meilisearch-rest-client")
licenses {
license {
name.set('The Apache License, Version 2.0')
url.set('https://www.apache.org/licenses/LICENSE-2.0.txt')
}
}
developers {
developer {
name.set('honhimw')
email.set('[email protected]')
url.set('https://honhimW.github.io')
}
}
scm {
connection.set('scm:git:git://github.com/honhimW/meilisearch-rest-client.git')
developerConnection.set('scm:git:ssh://github.com/honhimW/meilisearch-rest-client.git')
url.set('https://github.com/honhimW/meilisearch-rest-client')
}
}
}
}
}
signing {
def props = sonatypeProperties()
def keyId = props.getProperty('signing.keyId')
def ringFile = props.getProperty('signing.secretKeyBase64')
def password = props.getProperty('signing.password')
if (!(keyId == null || ringFile == null || password == null)) {
useInMemoryPgpKeys(keyId, ringFile, password)
sign publishing.publications.gpr
}
}
jar {
enabled(true)
archiveClassifier = ''
}
tasks.withType(JavaCompile).configureEach {
options.encoding = UTF_8.name()
options.forkOptions.jvmArgs += ['-Duser.language=en', '-Duser.country=NO']
inputs.files(tasks.withType(ProcessResources))
// options.compilerArgs << "-Werror" << "-Xlint:deprecation" << "-Xlint:unchecked"
}
testing {
suites {
test {
useJUnitJupiter()
dependencies {
implementation platform('org.junit:junit-bom:5.11.3')
}
targets {
all {
testTask.configure {
testLogging {
events(
// 'passed',
'skipped',
'failed'
)
}
finalizedBy jacocoTestReport
}
}
}
}
}
}
jacocoTestReport {
reports {
xml.setRequired true
csv.setRequired false
html.setOutputLocation layout.buildDirectory.dir('jacocoHtml')
}
}
tasks.register('publish-snapshot') {
version = version + '-SNAPSHOT'
finalizedBy ':publishAllPublicationsToSonatype-snapshotsRepository'
}
tasks.register('publish-release') {
finalizedBy ':publishAllPublicationsToSonatype-releasesRepository'
}
tasks.register('publish-central') {
finalizedBy ':publishAllPublicationsToSonatype-centralRepository'
}
Properties loadProfileProperties() {
def properties = new Properties()
properties.put('meili-search.host', '127.0.0.1')
properties.put('meili-search.port', '7700')
properties.put('meili-search.api-key', 'MASTER_KEY')
properties.put('tests-index', 'movie_test')
def file = file("profile-${findProperty('profiles.active')}.properties")
if (file.exists()) {
file.withInputStream { properties.load(it) }
}
return properties
}
Properties githubProperties() {
def properties = new Properties()
def file = file("github.properties")
if (file.exists()) {
file.withInputStream { properties.load(it) }
}
return properties
}
Properties sonatypeProperties() {
def properties = new Properties()
def file = file("sonatype.properties")
if (file.exists()) {
file.withInputStream { properties.load(it) }
}
return properties
}