2021-04-09 15:28:18 -04:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* The OpenSearch Contributors require contributions made to
|
|
|
|
* this file be licensed under the Apache-2.0 license or a
|
|
|
|
* compatible open source license.
|
|
|
|
*
|
|
|
|
* Modifications Copyright OpenSearch Contributors. See
|
|
|
|
* GitHub history for details.
|
|
|
|
*/
|
|
|
|
|
2021-03-12 13:49:28 -05:00
|
|
|
import org.opensearch.gradle.Architecture
|
|
|
|
import org.opensearch.gradle.OS
|
|
|
|
import org.opensearch.gradle.VersionProperties
|
|
|
|
import org.opensearch.gradle.info.BuildParams
|
2019-11-18 03:27:28 -05:00
|
|
|
|
2021-03-12 13:49:28 -05:00
|
|
|
apply plugin: 'opensearch.jdk-download'
|
2019-11-18 03:27:28 -05:00
|
|
|
|
2020-09-23 19:55:47 -04:00
|
|
|
if (BuildParams.getIsRuntimeJavaHomeSet()) {
|
|
|
|
configure(allprojects - project(':build-tools')) {
|
|
|
|
project.tasks.withType(Test).configureEach { Test test ->
|
|
|
|
if (BuildParams.getIsRuntimeJavaHomeSet()) {
|
|
|
|
test.executable = "${BuildParams.runtimeJavaHome}/bin/java"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-05 19:31:10 -04:00
|
|
|
} else {
|
2020-09-23 19:55:47 -04:00
|
|
|
jdks {
|
|
|
|
provisioned_runtime {
|
|
|
|
vendor = VersionProperties.bundledJdkVendor
|
|
|
|
version = VersionProperties.getBundledJdk(OS.current().name().toLowerCase())
|
|
|
|
platform = OS.current().name().toLowerCase()
|
|
|
|
architecture = Architecture.current().name().toLowerCase()
|
|
|
|
}
|
2019-11-18 04:13:40 -05:00
|
|
|
}
|
2019-11-18 03:27:28 -05:00
|
|
|
|
2020-09-23 19:55:47 -04:00
|
|
|
configure(allprojects - project(':build-tools')) {
|
|
|
|
project.tasks.withType(Test).configureEach { Test test ->
|
2019-11-22 13:59:46 -05:00
|
|
|
test.dependsOn(rootProject.jdks.provisioned_runtime)
|
|
|
|
test.executable = rootProject.jdks.provisioned_runtime.getBinJavaPath()
|
2019-11-18 03:27:28 -05:00
|
|
|
}
|
2019-11-18 04:13:40 -05:00
|
|
|
}
|
|
|
|
}
|
2020-09-23 19:55:47 -04:00
|
|
|
// if neither condition above is executed, tests will use the gradle jvm
|