Check "kotlin" package usage when compiling common code

#KT-25369 Fixed
This commit is contained in:
Alexander Udalov
2018-07-24 13:43:32 +02:00
parent ddd3a0a46e
commit 3323fd5a11
5 changed files with 19 additions and 5 deletions
@@ -17,10 +17,7 @@
package org.jetbrains.kotlin.cli.metadata
import com.intellij.openapi.Disposable
import org.jetbrains.kotlin.cli.common.CLICompiler
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.CommonCompilerPerformanceManager
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.cli.common.*
import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
import org.jetbrains.kotlin.cli.common.messages.MessageUtil
@@ -71,6 +68,8 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
configuration.put(CommonConfigurationKeys.MODULE_NAME, arguments.moduleName ?: JvmAbi.DEFAULT_MODULE_NAME)
configuration.put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage)
val destination = arguments.destination
if (destination != null) {
if (destination.endsWith(".jar")) {
@@ -90,6 +89,8 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
return ExitCode.COMPILATION_ERROR
}
checkKotlinPackageUsage(environment, environment.getSourceFiles())
try {
val metadataVersion =
configuration.get(CommonConfigurationKeys.METADATA_VERSION) as? BuiltInsBinaryVersion ?: BuiltInsBinaryVersion.INSTANCE