forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntime-jdk-provision.gradle
48 lines (44 loc) · 1.59 KB
/
runtime-jdk-provision.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
/*
* 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.
*/
import org.opensearch.gradle.Architecture
import org.opensearch.gradle.OS
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.info.BuildParams
apply plugin: 'opensearch.jdk-download'
if (BuildParams.getIsRuntimeJavaHomeSet()) {
configure(allprojects - project(':build-tools')) {
project.tasks.withType(Test).configureEach { Test test ->
if (BuildParams.getIsRuntimeJavaHomeSet()) {
if (OS.current() == OS.WINDOWS) {
test.executable = "${BuildParams.runtimeJavaHome}/bin/java.exe"
} else {
test.executable = "${BuildParams.runtimeJavaHome}/bin/java"
}
}
}
}
} else {
jdks {
provisioned_runtime {
vendor = VersionProperties.bundledJdkVendor
version = VersionProperties.getBundledJdk(OS.current().name().toLowerCase(), Architecture.current().name().toLowerCase())
platform = OS.current().name().toLowerCase()
architecture = Architecture.current().name().toLowerCase()
}
}
configure(allprojects - project(':build-tools')) {
project.tasks.withType(Test).configureEach { Test test ->
test.dependsOn(rootProject.jdks.provisioned_runtime)
test.executable = rootProject.jdks.provisioned_runtime.getBinJavaPath()
}
}
}
// if neither condition above is executed, tests will use the gradle jvm