Add -Xskip-prerelease-check compiler argument
#KT-38070 Fixed
This commit is contained in:
+5
-1
@@ -89,10 +89,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
|
||||
@Argument(
|
||||
value = "-Xskip-metadata-version-check",
|
||||
description = "Load classes with bad metadata version anyway (incl. pre-release classes)"
|
||||
description = "Allow to load classes with bad metadata version and pre-release classes"
|
||||
)
|
||||
var skipMetadataVersionCheck: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(value = "-Xskip-prerelease-check", description = "Allow to load pre-release classes")
|
||||
var skipPrereleaseCheck: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xallow-kotlin-package",
|
||||
description = "Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info"
|
||||
@@ -340,6 +343,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
||||
return HashMap<AnalysisFlag<*>, Any>().apply {
|
||||
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
|
||||
put(AnalysisFlags.skipPrereleaseCheck, skipPrereleaseCheck || skipMetadataVersionCheck)
|
||||
put(AnalysisFlags.multiPlatformDoNotCheckActual, noCheckActual)
|
||||
val experimentalFqNames = experimental?.toList().orEmpty()
|
||||
if (experimentalFqNames.isNotEmpty()) {
|
||||
|
||||
+10
-1
@@ -166,7 +166,7 @@ class AnalyzerWithCompilerReport(
|
||||
fun reportDiagnostics(diagnostics: Diagnostics, messageCollector: MessageCollector): Boolean {
|
||||
val hasErrors = reportDiagnostics(diagnostics, DefaultDiagnosticReporter(messageCollector))
|
||||
|
||||
if (diagnostics.any { it.factory == Errors.INCOMPATIBLE_CLASS || it.factory == Errors.PRE_RELEASE_CLASS }) {
|
||||
if (diagnostics.any { it.factory == Errors.INCOMPATIBLE_CLASS }) {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
"Incompatible classes were found in dependencies. " +
|
||||
@@ -174,6 +174,15 @@ class AnalyzerWithCompilerReport(
|
||||
)
|
||||
}
|
||||
|
||||
if (diagnostics.any { it.factory == Errors.PRE_RELEASE_CLASS }) {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
"Pre-release classes were found in dependencies. " +
|
||||
"Remove them from the classpath, recompile with a release compiler " +
|
||||
"or use '-Xskip-prerelease-check' to suppress errors"
|
||||
)
|
||||
}
|
||||
|
||||
if (diagnostics.any { it.factory == Errors.IR_COMPILED_CLASS }) {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
|
||||
Reference in New Issue
Block a user