-
Notifications
You must be signed in to change notification settings - Fork 25.2k
/
Copy pathbuild.gradle
93 lines (80 loc) · 3.66 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
import org.elasticsearch.gradle.internal.test.TestUtil
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
apply plugin: org.elasticsearch.gradle.internal.ElasticsearchJavaBasePlugin
apply plugin: 'java-library'
apply plugin: 'application'
var os = org.gradle.internal.os.OperatingSystem.current()
application {
mainClass = 'org.openjdk.jmh.Main'
}
tasks.named("assemble").configure { enabled = false }
base {
archivesName = 'elasticsearch-benchmarks'
}
tasks.named("test").configure { enabled = false }
tasks.named("javadoc").configure { enabled = false }
configurations {
expression
painless
nativeLib
}
dependencies {
api(project(":server")) {
// JMH ships with the conflicting version 4.6. This prevents us from using jopt-simple in benchmarks (which should be ok) but allows
// us to invoke the JMH uberjar as usual.
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'
}
api(project(':libs:h3'))
api(project(':modules:aggregations'))
api(project(':x-pack:plugin:esql-core'))
api(project(':x-pack:plugin:esql'))
api(project(':x-pack:plugin:esql:compute'))
implementation project(path: ':libs:simdvec')
expression(project(path: ':modules:lang-expression', configuration: 'zip'))
painless(project(path: ':modules:lang-painless', configuration: 'zip'))
nativeLib(project(':libs:native'))
api "org.openjdk.jmh:jmh-core:$versions.jmh"
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
// Dependencies of JMH
runtimeOnly 'net.sf.jopt-simple:jopt-simple:5.0.4'
runtimeOnly 'org.apache.commons:commons-math3:3.6.1'
}
// enable the JMH's BenchmarkProcessor to generate the final benchmark classes
// needs to be added separately otherwise Gradle will quote it and javac will fail
tasks.named("compileJava").configure {
options.compilerArgs.addAll(["-processor", "org.openjdk.jmh.generators.BenchmarkProcessor"])
// org.elasticsearch.plugins.internal is used in signatures classes used in benchmarks but we don't want to expose it publicly
// adding an export to allow compilation with gradle. This does not solve a problem in intellij as it does not use compileJava task
options.compilerArgs.addAll(["--add-exports", "org.elasticsearch.server/org.elasticsearch.plugins.internal=ALL-UNNAMED"])
}
tasks.register('copyExpression', Copy) {
dependsOn configurations.expression
from { configurations.expression.collect { zipTree(it) } }
into "${buildDir}/plugins/expression"
}
tasks.register("copyPainless", Copy) {
dependsOn configurations.painless
from { configurations.painless.collect { zipTree(it) } }
into "${buildDir}/plugins/painless"
}
tasks.named("run").configure {
executable = "${buildParams.runtimeJavaHome.get()}/bin/java"
args << "-Dplugins.dir=${buildDir}/plugins" << "-Dtests.index=${buildDir}/index"
dependsOn "copyExpression", "copyPainless", configurations.nativeLib
systemProperty 'es.nativelibs.path', TestUtil.getTestLibraryPath(file("../libs/native/libraries/build/platform/").toString())
}
spotless {
java {
// IDEs can sometimes run annotation processors that leave files in
// here, causing Spotless to complain. Even though this path ought not
// to exist, exclude it anyway in order to avoid spurious failures.
targetExclude 'src/main/generated/**/*.java'
}
}