Allow to use Gradle property to configure JDK path
This commit is contained in:
committed by
Ilya Chernikov
parent
4428ba0bb7
commit
3d8486e8a6
@@ -40,6 +40,8 @@ In order to build Kotlin distribution you need to have:
|
|||||||
|
|
||||||
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 8 installed, and to point all of the environment variables mentioned above to your JDK 8 installation.
|
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 8 installed, and to point all of the environment variables mentioned above to your JDK 8 installation.
|
||||||
|
|
||||||
|
You also can use [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties) to setup JDK_* variables.
|
||||||
|
|
||||||
> Note: The JDK 6 for MacOS is not available on Oracle's site. You can [download it here](https://support.apple.com/kb/DL1572).
|
> Note: The JDK 6 for MacOS is not available on Oracle's site. You can [download it here](https://support.apple.com/kb/DL1572).
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ data class JdkId(val explicit: Boolean, val majorVersion: JdkMajorVersion, var v
|
|||||||
fun Project.getConfiguredJdks(): List<JdkId> {
|
fun Project.getConfiguredJdks(): List<JdkId> {
|
||||||
val res = arrayListOf<JdkId>()
|
val res = arrayListOf<JdkId>()
|
||||||
for (jdkMajorVersion in JdkMajorVersion.values()) {
|
for (jdkMajorVersion in JdkMajorVersion.values()) {
|
||||||
val explicitJdkEnvVal = System.getenv(jdkMajorVersion.name)
|
val explicitJdkEnvVal = findProperty(jdkMajorVersion.name)?.toString()
|
||||||
|
?: System.getenv(jdkMajorVersion.name)
|
||||||
?: jdkAlternativeVarNames[jdkMajorVersion]?.mapNotNull { System.getenv(it) }?.firstOrNull()
|
?: jdkAlternativeVarNames[jdkMajorVersion]?.mapNotNull { System.getenv(it) }?.firstOrNull()
|
||||||
?: continue
|
?: continue
|
||||||
val explicitJdk = File(explicitJdkEnvVal)
|
val explicitJdk = File(explicitJdkEnvVal)
|
||||||
|
|||||||
Reference in New Issue
Block a user