Commit 700cb6c2 authored by Alexey Tsvetkov's avatar Alexey Tsvetkov

Use Gradle JVM as Java Home

This mainly affects running tasks from Intellij,
where changing JAVA_HOME can be inconvenient.

In command-line `./gradlew` Gradle JVM is equal to JAVA_HOME by default
parent 9403cb1f
...@@ -76,7 +76,13 @@ tasks.withType(CppCompile::class.java).configureEach { ...@@ -76,7 +76,13 @@ tasks.withType(CppCompile::class.java).configureEach {
fileTree("$projectDir/../skija/src/main/cc"), fileTree("$projectDir/../skija/src/main/cc"),
fileTree("$projectDir/src/jvmMain/cpp") fileTree("$projectDir/src/jvmMain/cpp")
) )
val jdkHome = System.getenv("JAVA_HOME") // Prefer 'java.home' system property to simplify overriding from Intellij.
// When used from command-line, it is effectively equal to JAVA_HOME.
if (JavaVersion.current() < JavaVersion.VERSION_11) {
error("JDK 11+ is required, but Gradle JVM is ${JavaVersion.current()}. " +
"Check JAVA_HOME (CLI) or Gradle settings (Intellij).")
}
val jdkHome = System.getProperty("java.home") ?: error("'java.home' is null")
compilerArgs.addAll(listOf( compilerArgs.addAll(listOf(
"-I$jdkHome/include", "-I$jdkHome/include",
"-I$skiaDir", "-I$skiaDir",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment