-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove JVM target version override (#2515)
Previously, we were setting kotlin.jvmTarget version to 1.8 if it was null or < 1.8. As an unintended consequence we were also overriding a version set by the jvmToolchain property. So while users expected the jvmToolchain property to set both jdk home & jdk target, we were quietly overriding jdk target. At the same time, Kotlin 1.7 sets the minimum target version to 1.8 anyway, so our override does not make sense with Kotlin 1.7+. This commit removes overriding altogether. Fixes #2511
- Loading branch information
1 parent
75f4f1d
commit 7e574a0
Showing
8 changed files
with
56 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/utils/jdkUtls.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2020-2022 JetBrains s.r.o. and respective authors and developers. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. | ||
*/ | ||
|
||
package org.jetbrains.compose.test.utils | ||
|
||
import java.io.File | ||
|
||
const val JDK_11_BYTECODE_VERSION = 55 | ||
|
||
fun readClassFileVersion(classFile: File): Int { | ||
val url = classFile.toURI().toURL().toExternalForm() | ||
val javapResult = runJavaTool("javap", "-verbose", url) | ||
val majorVersionRegex = "major version: (\\d+)".toRegex() | ||
val bytecode = javapResult.out | ||
val match = majorVersionRegex.find(bytecode) | ||
?: error(buildString { | ||
appendLine("Could not find 'major version' in '$classFile' bytecode:") | ||
appendLine(bytecode) | ||
}) | ||
return match.groupValues[1].toInt() | ||
} | ||
|
||
fun runJavaTool(toolName: String, vararg args: String): ProcessRunResult { | ||
val javaHome = File(System.getProperty("java.home")) | ||
val toolExecutableName = if (isWindows) "$toolName.exe" else toolName | ||
val executable = javaHome.resolve("bin/$toolExecutableName") | ||
check(executable.isFile) { "Could not find tool '$toolName' at specified path: $executable" } | ||
return runProcess(executable, args.toList()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ pluginManagement { | |
google() | ||
} | ||
} | ||
rootProject.name = "simple" | ||
rootProject.name = "mpp" |