/
build.gradle
555 lines (544 loc) · 20.4 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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
apply plugin: 'elasticsearch.build'
apply plugin: 'elasticsearch.string-templates'
dependencies {
compileOnly project(':server')
compileOnly project('ann')
annotationProcessor project('gen')
testImplementation project(':test:framework')
testImplementation(project(xpackModule('ql')))
}
tasks.named("compileJava").configure {
options.compilerArgs.addAll(["-s", "${projectDir}/src/main/generated"])
}
tasks.named('checkstyleMain').configure {
source = "src/main/java"
excludes = [ "**/*.java.st" ]
}
tasks.named("spotlessJava") { dependsOn stringTemplates }
spotless {
java {
/*
* Generated files go here.
*/
targetExclude "src/main/generated/**/*.java"
}
}
def prop(Type, type, TYPE, BYTES, Array, Hash) {
return [
"Type" : Type,
"type" : type,
"TYPE" : TYPE,
"BYTES" : BYTES,
"Array" : Array,
"Hash" : Hash,
"int" : type == "int" ? "true" : "",
"long" : type == "long" ? "true" : "",
"double" : type == "double" ? "true" : "",
"BytesRef" : type == "BytesRef" ? "true" : "",
"boolean" : type == "boolean" ? "true" : "",
]
}
tasks.named('stringTemplates').configure {
var intProperties = prop("Int", "int", "INT", "Integer.BYTES", "IntArray", "LongHash")
var longProperties = prop("Long", "long", "LONG", "Long.BYTES", "LongArray", "LongHash")
var doubleProperties = prop("Double", "double", "DOUBLE", "Double.BYTES", "DoubleArray", "LongHash")
var bytesRefProperties = prop("BytesRef", "BytesRef", "BYTES_REF", "org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_REF", "", "BytesRefHash")
var booleanProperties = prop("Boolean", "boolean", "BOOLEAN", "Byte.BYTES", "BitArray", "")
// primitive vectors
File vectorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-Vector.java.st")
template {
it.properties = intProperties
it.inputFile = vectorInputFile
it.outputFile = "org/elasticsearch/compute/data/IntVector.java"
}
template {
it.properties = longProperties
it.inputFile = vectorInputFile
it.outputFile = "org/elasticsearch/compute/data/LongVector.java"
}
template {
it.properties = doubleProperties
it.inputFile = vectorInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleVector.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = vectorInputFile
it.outputFile = "org/elasticsearch/compute/data/BytesRefVector.java"
}
template {
it.properties = booleanProperties
it.inputFile = vectorInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanVector.java"
}
// array vector implementations
File arrayVectorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-ArrayVector.java.st")
template {
it.properties = intProperties
it.inputFile = arrayVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/IntArrayVector.java"
}
template {
it.properties = longProperties
it.inputFile = arrayVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/LongArrayVector.java"
}
template {
it.properties = doubleProperties
it.inputFile = arrayVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleArrayVector.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = arrayVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/BytesRefArrayVector.java"
}
template {
it.properties = booleanProperties
it.inputFile = arrayVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanArrayVector.java"
}
// BigArray vector implementations
File bigArrayVectorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-BigArrayVector.java.st")
template {
it.properties = intProperties
it.inputFile = bigArrayVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/IntBigArrayVector.java"
}
template {
it.properties = longProperties
it.inputFile = bigArrayVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/LongBigArrayVector.java"
}
template {
it.properties = doubleProperties
it.inputFile = bigArrayVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleBigArrayVector.java"
}
template {
it.properties = booleanProperties
it.inputFile = bigArrayVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanBigArrayVector.java"
}
// constant vectors
File constantVectorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-ConstantVector.java.st")
template {
it.properties = intProperties
it.inputFile = constantVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/ConstantIntVector.java"
}
template {
it.properties = longProperties
it.inputFile = constantVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/ConstantLongVector.java"
}
template {
it.properties = doubleProperties
it.inputFile = constantVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/ConstantDoubleVector.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = constantVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/ConstantBytesRefVector.java"
}
template {
it.properties = booleanProperties
it.inputFile = constantVectorInputFile
it.outputFile = "org/elasticsearch/compute/data/ConstantBooleanVector.java"
}
// primitive blocks
File blockInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-Block.java.st")
template {
it.properties = intProperties
it.inputFile = blockInputFile
it.outputFile = "org/elasticsearch/compute/data/IntBlock.java"
}
template {
it.properties = longProperties
it.inputFile = blockInputFile
it.outputFile = "org/elasticsearch/compute/data/LongBlock.java"
}
template {
it.properties = doubleProperties
it.inputFile = blockInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleBlock.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = blockInputFile
it.outputFile = "org/elasticsearch/compute/data/BytesRefBlock.java"
}
template {
it.properties = booleanProperties
it.inputFile = blockInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanBlock.java"
}
// array blocks
File arrayBlockInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-ArrayBlock.java.st")
template {
it.properties = intProperties
it.inputFile = arrayBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/IntArrayBlock.java"
}
template {
it.properties = longProperties
it.inputFile = arrayBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/LongArrayBlock.java"
}
template {
it.properties = doubleProperties
it.inputFile = arrayBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleArrayBlock.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = arrayBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/BytesRefArrayBlock.java"
}
template {
it.properties = booleanProperties
it.inputFile = arrayBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanArrayBlock.java"
}
// BigArray block implementations
File bigArrayBlockInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-BigArrayBlock.java.st")
template {
it.properties = intProperties
it.inputFile = bigArrayBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/IntBigArrayBlock.java"
}
template {
it.properties = longProperties
it.inputFile = bigArrayBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/LongBigArrayBlock.java"
}
template {
it.properties = doubleProperties
it.inputFile = bigArrayBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleBigArrayBlock.java"
}
template {
it.properties = booleanProperties
it.inputFile = bigArrayBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanBigArrayBlock.java"
}
// vector blocks
File vectorBlockInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-VectorBlock.java.st")
template {
it.properties = intProperties
it.inputFile = vectorBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/IntVectorBlock.java"
}
template {
it.properties = longProperties
it.inputFile = vectorBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/LongVectorBlock.java"
}
template {
it.properties = doubleProperties
it.inputFile = vectorBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleVectorBlock.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = vectorBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/BytesRefVectorBlock.java"
}
template {
it.properties = booleanProperties
it.inputFile = vectorBlockInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanVectorBlock.java"
}
// block builders
File blockBuildersInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-BlockBuilder.java.st")
template {
it.properties = intProperties
it.inputFile = blockBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/IntBlockBuilder.java"
}
template {
it.properties = longProperties
it.inputFile = blockBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/LongBlockBuilder.java"
}
template {
it.properties = doubleProperties
it.inputFile = blockBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleBlockBuilder.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = blockBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/BytesRefBlockBuilder.java"
}
template {
it.properties = booleanProperties
it.inputFile = blockBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanBlockBuilder.java"
}
// vector builders
File vectorBuildersInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-VectorBuilder.java.st")
template {
it.properties = intProperties
it.inputFile = vectorBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/IntVectorBuilder.java"
}
template {
it.properties = longProperties
it.inputFile = vectorBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/LongVectorBuilder.java"
}
template {
it.properties = doubleProperties
it.inputFile = vectorBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleVectorBuilder.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = vectorBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/BytesRefVectorBuilder.java"
}
template {
it.properties = booleanProperties
it.inputFile = vectorBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanVectorBuilder.java"
}
File vectorFixedBuildersInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-VectorFixedBuilder.java.st")
template {
it.properties = intProperties
it.inputFile = vectorFixedBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/IntVectorFixedBuilder.java"
}
template {
it.properties = longProperties
it.inputFile = vectorFixedBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/LongVectorFixedBuilder.java"
}
template {
it.properties = doubleProperties
it.inputFile = vectorFixedBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleVectorFixedBuilder.java"
}
template {
it.properties = booleanProperties
it.inputFile = vectorFixedBuildersInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanVectorFixedBuilder.java"
}
File stateInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/aggregation/X-State.java.st")
template {
it.properties = intProperties
it.inputFile = stateInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/IntState.java"
}
template {
it.properties = longProperties
it.inputFile = stateInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/LongState.java"
}
template {
it.properties = doubleProperties
it.inputFile = stateInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/DoubleState.java"
}
// block builders
File lookupInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/X-Lookup.java.st")
template {
it.properties = intProperties
it.inputFile = lookupInputFile
it.outputFile = "org/elasticsearch/compute/data/IntLookup.java"
}
template {
it.properties = longProperties
it.inputFile = lookupInputFile
it.outputFile = "org/elasticsearch/compute/data/LongLookup.java"
}
template {
it.properties = doubleProperties
it.inputFile = lookupInputFile
it.outputFile = "org/elasticsearch/compute/data/DoubleLookup.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = lookupInputFile
it.outputFile = "org/elasticsearch/compute/data/BytesRefLookup.java"
}
template {
it.properties = booleanProperties
it.inputFile = lookupInputFile
it.outputFile = "org/elasticsearch/compute/data/BooleanLookup.java"
}
File arrayStateInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/aggregation/X-ArrayState.java.st")
template {
it.properties = intProperties
it.inputFile = arrayStateInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/IntArrayState.java"
}
template {
it.properties = longProperties
it.inputFile = arrayStateInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/LongArrayState.java"
}
template {
it.properties = doubleProperties
it.inputFile = arrayStateInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/DoubleArrayState.java"
}
File valuesAggregatorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/aggregation/X-ValuesAggregator.java.st")
template {
it.properties = intProperties
it.inputFile = valuesAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/ValuesIntAggregator.java"
}
template {
it.properties = longProperties
it.inputFile = valuesAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/ValuesLongAggregator.java"
}
template {
it.properties = doubleProperties
it.inputFile = valuesAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/ValuesDoubleAggregator.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = valuesAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/ValuesBytesRefAggregator.java"
}
File rateAggregatorInputFile = file("src/main/java/org/elasticsearch/compute/aggregation/X-RateAggregator.java.st")
template {
it.properties = intProperties
it.inputFile = rateAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/RateIntAggregator.java"
}
template {
it.properties = longProperties
it.inputFile = rateAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/RateLongAggregator.java"
}
template {
it.properties = doubleProperties
it.inputFile = rateAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/RateDoubleAggregator.java"
}
File multivalueDedupeInputFile = file("src/main/java/org/elasticsearch/compute/operator/mvdedupe/X-MultivalueDedupe.java.st")
template {
it.properties = intProperties
it.inputFile = multivalueDedupeInputFile
it.outputFile = "org/elasticsearch/compute/operator/mvdedupe/MultivalueDedupeInt.java"
}
template {
it.properties = longProperties
it.inputFile = multivalueDedupeInputFile
it.outputFile = "org/elasticsearch/compute/operator/mvdedupe/MultivalueDedupeLong.java"
}
template {
it.properties = doubleProperties
it.inputFile = multivalueDedupeInputFile
it.outputFile = "org/elasticsearch/compute/operator/mvdedupe/MultivalueDedupeDouble.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = multivalueDedupeInputFile
it.outputFile = "org/elasticsearch/compute/operator/mvdedupe/MultivalueDedupeBytesRef.java"
}
File blockHashInputFile = file("src/main/java/org/elasticsearch/compute/aggregation/blockhash/X-BlockHash.java.st")
template {
it.properties = intProperties
it.inputFile = blockHashInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/blockhash/IntBlockHash.java"
}
template {
it.properties = longProperties
it.inputFile = blockHashInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/blockhash/LongBlockHash.java"
}
template {
it.properties = doubleProperties
it.inputFile = blockHashInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/blockhash/DoubleBlockHash.java"
}
template {
it.properties = bytesRefProperties
it.inputFile = blockHashInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/blockhash/BytesRefBlockHash.java"
}
File keyExtractorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/operator/topn/X-KeyExtractor.java.st")
template {
it.properties = bytesRefProperties
it.inputFile = keyExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/KeyExtractorForBytesRef.java"
}
template {
it.properties = booleanProperties
it.inputFile = keyExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/KeyExtractorForBoolean.java"
}
template {
it.properties = intProperties
it.inputFile = keyExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/KeyExtractorForInt.java"
}
template {
it.properties = longProperties
it.inputFile = keyExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/KeyExtractorForLong.java"
}
template {
it.properties = doubleProperties
it.inputFile = keyExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/KeyExtractorForDouble.java"
}
File valueExtractorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/operator/topn/X-ValueExtractor.java.st")
template {
it.properties = bytesRefProperties
it.inputFile = valueExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ValueExtractorForBytesRef.java"
}
template {
it.properties = booleanProperties
it.inputFile = valueExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ValueExtractorForBoolean.java"
}
template {
it.properties = intProperties
it.inputFile = valueExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ValueExtractorForInt.java"
}
template {
it.properties = longProperties
it.inputFile = valueExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ValueExtractorForLong.java"
}
template {
it.properties = doubleProperties
it.inputFile = valueExtractorInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ValueExtractorForDouble.java"
}
File resultBuilderInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/operator/topn/X-ResultBuilder.java.st")
template {
it.properties = bytesRefProperties
it.inputFile = resultBuilderInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ResultBuilderForBytesRef.java"
}
template {
it.properties = booleanProperties
it.inputFile = resultBuilderInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ResultBuilderForBoolean.java"
}
template {
it.properties = intProperties
it.inputFile = resultBuilderInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ResultBuilderForInt.java"
}
template {
it.properties = longProperties
it.inputFile = resultBuilderInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ResultBuilderForLong.java"
}
template {
it.properties = doubleProperties
it.inputFile = resultBuilderInputFile
it.outputFile = "org/elasticsearch/compute/operator/topn/ResultBuilderForDouble.java"
}
}