Skip to content

Commit 7b44430

Browse files
authored
Use test util for finding platform dir (elastic#112286)
The native platform dir can be found using a TestUtil method, but benchmarks was trying to construct it on its own. This commit switches to using the util method.
1 parent 3cbb526 commit 7b44430

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

benchmarks/build.gradle

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.elasticsearch.gradle.internal.info.BuildParams
2+
import org.elasticsearch.gradle.internal.test.TestUtil
23

34
/*
45
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -29,6 +30,7 @@ tasks.named("javadoc").configure { enabled = false }
2930
configurations {
3031
expression
3132
painless
33+
nativeLib
3234
}
3335

3436
dependencies {
@@ -45,6 +47,7 @@ dependencies {
4547
implementation project(path: ':libs:elasticsearch-simdvec')
4648
expression(project(path: ':modules:lang-expression', configuration: 'zip'))
4749
painless(project(path: ':modules:lang-painless', configuration: 'zip'))
50+
nativeLib(project(':libs:elasticsearch-native'))
4851
api "org.openjdk.jmh:jmh-core:$versions.jmh"
4952
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
5053
// Dependencies of JMH
@@ -76,17 +79,8 @@ tasks.register("copyPainless", Copy) {
7679
tasks.named("run").configure {
7780
executable = "${BuildParams.runtimeJavaHome}/bin/java"
7881
args << "-Dplugins.dir=${buildDir}/plugins" << "-Dtests.index=${buildDir}/index"
79-
dependsOn "copyExpression", "copyPainless"
80-
systemProperty 'es.nativelibs.path', file("../libs/native/libraries/build/platform/${platformName()}-${os.arch}")
81-
}
82-
83-
String platformName() {
84-
String name = System.getProperty("os.name");
85-
if (name.startsWith("Mac")) {
86-
return "darwin";
87-
} else {
88-
return name.toLowerCase(Locale.ROOT);
89-
}
82+
dependsOn "copyExpression", "copyPainless", configurations.nativeLib
83+
systemProperty 'es.nativelibs.path', TestUtil.getTestLibraryPath(file("../libs/native/libraries/build/platform/").toString())
9084
}
9185

9286
spotless {

0 commit comments

Comments
 (0)