automatically use toolchain if on right platform or download otherwise
Vampire opened this issue · 0 comments
Vampire commented
I envision some convenient and declarative way to express what the subject says.
What I have currently is
val isWindows = Os.isFamily(FAMILY_WINDOWS)
val isLinux = Os.isFamily(FAMILY_UNIX)
if (isWindows || isLinux) {
targetPlatform(if (isWindows) "windows" else "linux") {
setJdkHome(javaToolchains.launcherFor(java.toolchain).get().executablePath.asFile.parentFile.parentFile)
}
}
if (!version.toString().endsWith("-SNAPSHOT")) {
if (!isWindows) {
targetPlatform("windows") {
setJdkHome(jdkDownload("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.1%2B12/OpenJDK17U-jdk_x64_windows_hotspot_17.0.1_12.zip"))
}
}
if (!isLinux) {
targetPlatform("linux") {
setJdkHome(jdkDownload("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.1%2B12/OpenJDK17U-jdk_x64_linux_hotspot_17.0.1_12.tar.gz"))
}
}
}
so that I can test using runtime
task without the need to download either JDK (will report a different issue about that) and when releasing the JDK for the other platform is downloaded.