Skip to content

Commit

Permalink
Allow to use Gradle property to configure JDK path
Browse files Browse the repository at this point in the history
  • Loading branch information
gildor authored and ligee committed Sep 26, 2017
1 parent 4428ba0 commit 3d8486e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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).
## Building
Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/jdksFinder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ data class JdkId(val explicit: Boolean, val majorVersion: JdkMajorVersion, var v
fun Project.getConfiguredJdks(): List<JdkId> {
val res = arrayListOf<JdkId>()
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()
?: continue
val explicitJdk = File(explicitJdkEnvVal)
Expand Down

0 comments on commit 3d8486e

Please sign in to comment.