-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathbuild.gradle
333 lines (298 loc) · 10.5 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
plugins {
// Provide convenience executables for trying out the examples.
id 'application'
// Generate IntelliJ IDEA's .idea & .iml project files
id 'idea'
id 'maven-publish'
id 'signing'
alias(libs.plugins.spotless)
id 'java-library'
id 'jacoco'
// Build docs locally by running "site" command
alias(libs.plugins.sphinx)
}
repositories {
maven { // The google mirror is less flaky than mavenCentral()
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
mavenLocal()
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
allprojects {
version = '1.0.0-beta.2'
group = 'com.yelp.nrtsearch'
}
def _artifactId = 'server'
//This is for https://github.com/gradle/gradle/issues/11308
System.setProperty("org.gradle.internal.publish.checksums.insecure", "True")
dependencies {
//prometheus (metrics) deps
implementation libs.prometheus.metrics.core
implementation libs.prometheus.metrics.exposition.formats
implementation libs.prometheus.metrics.instrumentation.jvm
//logging deps
implementation libs.slf4j.api
implementation libs.log4j.api
implementation libs.log4j.core
implementation libs.log4j.slf4j2.impl
implementation libs.disruptor
//lucene deps
implementation libs.lucene.analysis.common
implementation libs.lucene.backward.codecs
implementation libs.lucene.core
implementation libs.lucene.codecs
implementation libs.lucene.expressions
implementation libs.lucene.facet
implementation libs.lucene.grouping
implementation libs.lucene.highlighter
implementation libs.lucene.join
implementation libs.lucene.queries
implementation libs.lucene.queryparser
implementation libs.lucene.replicator
implementation libs.lucene.suggest
//cli deps
implementation libs.picocli
implementation libs.commons.csv
// other deps
implementation libs.aws.java.sdk.core
implementation libs.aws.java.sdk.s3
runtimeOnly libs.aws.java.sdk.sts
implementation libs.commons.compress
implementation libs.commons.io
implementation libs.fastutil
implementation libs.grpc.netty.shaded
implementation libs.grpc.services
implementation libs.gson
implementation libs.guice
implementation libs.jackson.databind
implementation libs.jackson.dataformat.yaml
implementation libs.jakarta.xml.bind.api
implementation libs.lz4.java
implementation libs.snakeyaml
// test deps
testImplementation libs.junit
testImplementation libs.grpc.inprocess
testImplementation libs.grpc.testing
testImplementation libs.mockito.core
testImplementation libs.lucene.test.framework
testImplementation libs.spatial4j
testImplementation libs.s3mock
testImplementation libs.assertj.core
api project(':clientlib')
}
startScripts.enabled = false
task luceneServer(type: CreateStartScripts) {
mainClass = 'com.yelp.nrtsearch.server.grpc.NrtsearchServer'
applicationName = 'lucene-server'
outputDir = new File(project.buildDir, 'tmp-app')
classpath = startScripts.classpath
// Add additional dependencies, e.g. custom loggers
classpath += files('$APP_HOME/additional_libs')
}
task luceneServerClient(type: CreateStartScripts) {
mainClass = 'com.yelp.nrtsearch.tools.cli.NrtsearchClientCommand'
applicationName = 'lucene-client'
outputDir = new File(project.buildDir, 'tmp-app')
classpath = startScripts.classpath
}
task nrtsearchServer(type: CreateStartScripts) {
mainClass = 'com.yelp.nrtsearch.server.grpc.NrtsearchServer'
applicationName = 'nrtsearch_server'
outputDir = new File(project.buildDir, 'tmp-app')
classpath = startScripts.classpath
// Add additional dependencies, e.g. custom loggers
classpath += files('$APP_HOME/additional_libs')
}
task nrtsearchServerClient(type: CreateStartScripts) {
mainClass = 'com.yelp.nrtsearch.tools.cli.NrtsearchClientCommand'
applicationName = 'nrtsearch_client'
outputDir = new File(project.buildDir, 'tmp-app')
classpath = startScripts.classpath
}
task nrtUtils(type: CreateStartScripts) {
mainClass = 'com.yelp.nrtsearch.tools.nrt_utils.NrtUtilsCommand'
applicationName = 'nrt_utils'
outputDir = new File(project.buildDir, 'tmp-app')
classpath = startScripts.classpath
}
applicationDistribution.into('bin') {
from(luceneServer)
from(luceneServerClient)
from(nrtsearchServer)
from(nrtsearchServerClient)
from(nrtUtils)
fileMode = 0755
}
task buildGrpcGateway(dependsOn: installDist, type: Exec) {
workingDir = '.'
executable = 'bash'
args = ['-c', './build_grpc_gateway.sh']
}
//Dynamic exclude through property defined in the build.gradle file
//e.g. to include perfTests: ./gradlew test -PincludePerfTests=true
//e.g. default is to exclude perfTests: ./gradlew test
test {
finalizedBy 'spotlessJavaCheck'
// Used by NrtsearchConfigTest
environment(Map.of('CUSTOM_HOST', 'my_custom_host', 'VAR1', 'v1', 'VAR2', 'v2', 'VAR3', 'v3'))
if (project.hasProperty('longRunningTestsOnly')) {
include '**/IncrementalDataCleanupCommandTest.class'
include '**/CleanupDataCommandTest.class'
} else {
if (!project.hasProperty('includePerfTests')) {
exclude '**/YelpReviewsTest.class'
exclude '**/MergeBehaviorTests.class'
exclude '**/IncrementalDataCleanupCommandTest.class'
exclude '**/CleanupDataCommandTest.class'
filter {
excludeTestsMatching '*.NodeNameResolverAndLoadBalancingTests.testSimpleLoadBalancingAsync'
}
}
}
systemProperties System.properties
testLogging {
events "failed"
exceptionFormat "full"
showStackTraces true
//showStandardStreams = true
}
}
jacocoTestReport {
reports {
csv.required = true
}
}
task javadocs(type: Javadoc) {
source = sourceSets.main.java.srcDirs
}
task javadocsJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadocs.destinationDir
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.java.srcDirs
}
task testsJar(type: Jar) {
archiveClassifier = 'tests'
from sourceSets.test.output
}
signing {
if (project.hasProperty("signing.keyId")) {
sign publishing.publications
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.group
artifactId = _artifactId
version = project.version
artifact tasks.jar
artifact tasks.javadocsJar
artifact tasks.sourcesJar
artifact tasks.testsJar
pom {
name = 'nrtSearch Server'
description = 'GRPC server using near-real-time replication'
url = 'https://github.com/Yelp/nrtsearch'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
// Adding all developers in alphabetical order
developer {
id = 'alok'
name = 'Alok Mysore'
email = '[email protected]'
}
developer {
id = 'erikyang'
name = 'Erik Yang'
email = '[email protected]'
}
developer {
id = 'karthik'
name = 'Karthik Alle'
email = '[email protected]'
}
developer {
id = 'sarthakn'
name = 'Sarthak Nandi'
email = '[email protected]'
}
developer {
id = 'umesh'
name = 'Umesh Dangat'
email = '[email protected]'
}
}
// Links to nrtSearch github
scm {
connection = 'scm:git:git://github.com/Yelp/nrtsearch.git'
developerConnection = 'scm:git:ssh://github.com/Yelp/nrtsearch.git'
url = 'https://github.com/Yelp/nrtsearch'
}
}
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
repositories {
mavenCentral {
if (project.hasProperty("signing.keyId")) {
credentials {
// The credentials are picked up from your gradle.properties file
username ossrhUsername
password ossrhPassword
}
}
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
spotless {
java {
licenseHeaderFile 'license_header'
removeUnusedImports()
endWithNewline()
trimTrailingWhitespace()
googleJavaFormat()
}
}
sphinx {
sourceDirectory = "${projectDir}/docs"
outputDirectory = "${project.buildDir}/docs"
// Remove if not using OS X. This is required on non-Intel macs since aarch-64 build is not available.
binaryUrl = 'https://github.com/trustin/sphinx-binary/releases/download/v0.8.2/sphinx.osx-x86_64'
}
// Inject properties file containing the project version into resources.
// Used to get version info at runtime.
task createProperties(dependsOn: processResources) {
doLast {
new File("$buildDir/resources/main/version.properties").withWriter { w ->
Properties p = new Properties()
p['version'] = project.version.toString()
p.store w, null
}
}
}
classes {
dependsOn createProperties
}