diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2NativeCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2NativeCompilerArguments.kt index 71e68791b85..4f98d2da25f 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2NativeCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2NativeCompilerArguments.kt @@ -128,7 +128,7 @@ class K2NativeCompilerArguments : CommonCompilerArguments() { valueDescription = "", description = "Library search path.\n" + "Note: This option is deprecated and will be removed in one of the future releases.\n" + - "Please use library paths instead of library names in all compiler options such as '-library'." + "Please use library paths instead of library names in all compiler options such as '-library' ('-l')." ) var repositories: Array? = null diff --git a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt index 9ffd028c1d7..d90f470c637 100644 --- a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt +++ b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt @@ -55,7 +55,9 @@ open class CommonInteropArguments(val argParser: ArgParser) { ArgType.String, shortName = "r", description = "repository to resolve dependencies", - deprecatedWarning = "This option is deprecated and will be removed in one of the future releases. Please use library paths instead of library names in all options such as '-library'" + // Use the name of the option directly in the deprecation message. This message is automatically printed to the console + // if the option has been specified. Without option name in the message it would be unclear which exactly option is deprecated. + deprecatedWarning = "'-repo' ('-r') option is deprecated and will be removed in one of the future releases. Please use library paths instead of library names in all options such as '-library' ('-l')." ).multiple() val nodefaultlibs by argParser.option(ArgType.Boolean, NODEFAULTLIBS, description = "don't link the libraries from dist/klib automatically").default(false) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/SetupConfiguration.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/SetupConfiguration.kt index 53bc3d12694..b35c8f3ad2a 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/SetupConfiguration.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/SetupConfiguration.kt @@ -46,6 +46,15 @@ fun CompilerConfiguration.setupFromArguments(arguments: K2NativeCompilerArgument put(INCLUDED_BINARY_FILES, arguments.includeBinaries.toNonNullList()) put(NATIVE_LIBRARY_FILES, arguments.nativeLibraries.toNonNullList()) + + if (arguments.repositories != null) { + // Show the warning also if `-repo` was really specified. + report( + WARNING, + "'-repo' ('-r') compiler option is deprecated and will be removed in one of the future releases. " + + "Please use library paths instead of library names in all compiler options such as '-library' ('-l')." + ) + } put(REPOSITORIES, arguments.repositories.toNonNullList()) // TODO: Collect all the explicit file names into an object diff --git a/kotlin-native/klib/src/main/kotlin/org/jetbrains/kotlin/cli/klib/main.kt b/kotlin-native/klib/src/main/kotlin/org/jetbrains/kotlin/cli/klib/main.kt index 8fb005aac7f..3ba4f49631d 100644 --- a/kotlin-native/klib/src/main/kotlin/org/jetbrains/kotlin/cli/klib/main.kt +++ b/kotlin-native/klib/src/main/kotlin/org/jetbrains/kotlin/cli/klib/main.kt @@ -172,9 +172,26 @@ open class ModuleDeserializer(val library: ByteArray) { } +private class KlibRepoDeprecationWarning { + private var alreadyLogged = false + + fun logOnceIfNecessary() { + if (!alreadyLogged) { + alreadyLogged = true + logWarning("Local KLIB repositories to be dropped soon. See https://youtrack.jetbrains.com/issue/KT-61098") + } + } +} + class Library(val libraryNameOrPath: String, val requestedRepository: String?) { - val repository = requestedRepository?.File() ?: defaultRepository + private val klibRepoDeprecationWarning = KlibRepoDeprecationWarning() + + val repository = requestedRepository?.let { + klibRepoDeprecationWarning.logOnceIfNecessary() // Due to use of "-repository" option. + File(it) + } ?: defaultRepository + fun info() { val library = libraryInRepoOrCurrentDir(repository, libraryNameOrPath) val headerAbiVersion = library.versions.abiVersion @@ -187,7 +204,7 @@ class Library(val libraryNameOrPath: String, val requestedRepository: String?) { println("Resolved to: ${library.libraryName.File().absolutePath}") println("Module name: $moduleName") println("ABI version: $headerAbiVersion") - println("Compiler version: ${headerCompilerVersion}") + println("Compiler version: $headerCompilerVersion") println("Library version: $headerLibraryVersion") println("Metadata version: $headerMetadataVersion") @@ -198,7 +215,7 @@ class Library(val libraryNameOrPath: String, val requestedRepository: String?) { } fun install() { - logWarning("Local KLIB repositories to be dropped soon. See https://youtrack.jetbrains.com/issue/KT-61098") + klibRepoDeprecationWarning.logOnceIfNecessary() if (!repository.exists) { logWarning("Repository does not exist: $repository. Creating...") @@ -216,7 +233,7 @@ class Library(val libraryNameOrPath: String, val requestedRepository: String?) { } fun remove(blind: Boolean = false) { - logWarning("Local KLIB repositories to be dropped soon. See https://youtrack.jetbrains.com/issue/KT-61098") + klibRepoDeprecationWarning.logOnceIfNecessary() if (!repository.exists) logError("Repository does not exist: $repository")