Introduce '-Xskip-runtime-version-check' command line option
This commit is contained in:
+3
@@ -98,6 +98,9 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
|
||||
@Argument(value = "Xskip-metadata-version-check", description = "Load classes with bad metadata version anyway (incl. pre-release classes)")
|
||||
public boolean skipMetadataVersionCheck;
|
||||
|
||||
@Argument(value = "Xskip-runtime-version-check", description = "Allow Kotlin runtime libraries of incompatible versions in the classpath")
|
||||
public boolean skipRuntimeVersionCheck;
|
||||
|
||||
@Argument(value = "Xdump-declarations-to", description = "Path to JSON file to dump Java to Kotlin declaration mappings")
|
||||
@ValueDescription("<path>")
|
||||
public String declarationsOutputPath;
|
||||
|
||||
+4
-1
@@ -113,7 +113,10 @@ object JvmRuntimeVersionsConsistencyChecker {
|
||||
if (runtimeJarsInfo.hasAnyJarsToCheck) {
|
||||
val languageVersion = languageVersionSettings?.let { MavenComparableVersion(it.languageVersion) } ?: CURRENT_COMPILER_VERSION
|
||||
|
||||
checkCompilerClasspathConsistency(messageCollector, languageVersion, runtimeJarsInfo)
|
||||
if (checkCompilerClasspathConsistency(messageCollector, languageVersion, runtimeJarsInfo)) {
|
||||
messageCollector.issue(null, "Some runtime JAR files in the classpath have an incompatible version. " +
|
||||
"Remove them from the classpath or use '-Xskip-runtime-version-check' to suppress errors")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -329,6 +329,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
configuration.put(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS, arguments.noParamAssertions)
|
||||
configuration.put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
|
||||
configuration.put(JVMConfigurationKeys.INHERIT_MULTIFILE_PARTS, arguments.inheritMultifileParts)
|
||||
configuration.put(JVMConfigurationKeys.SKIP_RUNTIME_VERSION_CHECK, arguments.skipRuntimeVersionCheck)
|
||||
configuration.put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage)
|
||||
configuration.put(CLIConfigurationKeys.REPORT_PERF, arguments.reportPerf)
|
||||
configuration.put(JVMConfigurationKeys.USE_SINGLE_MODULE, arguments.singleModule)
|
||||
|
||||
@@ -155,11 +155,15 @@ class KotlinCoreEnvironment private constructor(
|
||||
|
||||
val initialRoots = configuration.getList(JVMConfigurationKeys.CONTENT_ROOTS).classpathRoots()
|
||||
|
||||
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
||||
if (messageCollector != null) {
|
||||
val languageVersionSettings = configuration.get(CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS)
|
||||
val classpathJarRoots = initialRoots.mapNotNull { (file, type) -> if (type == JavaRoot.RootType.BINARY) file else null }
|
||||
JvmRuntimeVersionsConsistencyChecker.checkCompilerClasspathConsistency(messageCollector, languageVersionSettings, classpathJarRoots)
|
||||
if (!configuration.getBoolean(JVMConfigurationKeys.SKIP_RUNTIME_VERSION_CHECK)) {
|
||||
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
||||
if (messageCollector != null) {
|
||||
JvmRuntimeVersionsConsistencyChecker.checkCompilerClasspathConsistency(
|
||||
messageCollector,
|
||||
configuration.get(CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS),
|
||||
initialRoots.mapNotNull { (file, type) -> if (type == JavaRoot.RootType.BINARY) file else null }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// REPL and kapt2 update classpath dynamically
|
||||
|
||||
Reference in New Issue
Block a user