Source libraries: Codestyle and messages fixes
This commit is contained in:
committed by
Ilya Matveev
parent
2297b52596
commit
d3ab5b0969
@@ -190,11 +190,12 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
else -> put(GENERATE_TEST_RUNNER, TestRunnerKind.NONE)
|
||||
}
|
||||
// We need to download dependencies only if we use them ( = there are files to compile).
|
||||
put(CHECK_DEPENDENCIES, if (configuration.kotlinSourceRoots.isNotEmpty() || !arguments.sourceLibraries.isNullOrEmpty()) {
|
||||
true
|
||||
} else {
|
||||
arguments.checkDependencies
|
||||
})
|
||||
put(
|
||||
CHECK_DEPENDENCIES,
|
||||
configuration.kotlinSourceRoots.isNotEmpty()
|
||||
|| !arguments.sourceLibraries.isNullOrEmpty()
|
||||
|| arguments.checkDependencies
|
||||
)
|
||||
if (arguments.friendModules != null)
|
||||
put(FRIEND_MODULES, arguments.friendModules!!.split(File.pathSeparator).filterNot(String::isEmpty))
|
||||
|
||||
@@ -310,8 +311,11 @@ private fun selectSourceLibraries(
|
||||
val produceBinaryOrBitcode = outputKind.let { it.isNativeBinary || it == CompilerOutputKind.BITCODE }
|
||||
|
||||
return if (sourceLibraries.isNotEmpty() && !produceBinaryOrBitcode) {
|
||||
configuration.report(ERROR, "The $SOURCE_LIBRARY_ARG flag is only supported when producing native binaries or bitcode files, " +
|
||||
"but the compiler is producing ${outputKind.name.toLowerCase()}")
|
||||
configuration.report(
|
||||
ERROR,
|
||||
"The $SOURCE_LIBRARY_ARG flag is only supported when producing native binaries or bitcode files, " +
|
||||
"but the compiler is producing ${outputKind.name.toLowerCase()}"
|
||||
)
|
||||
emptyList()
|
||||
} else {
|
||||
sourceLibraries
|
||||
|
||||
@@ -160,7 +160,7 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(
|
||||
value = SOURCE_LIBRARY_ARG,
|
||||
valueDescription = "<path>",
|
||||
description = "A library to be processed in the same manner as source files (test processing, ObjC export etc).\n" +
|
||||
description = "A library to be processed in the same manner as source files.\n" +
|
||||
"Must be one of libraries passed with '-library'"
|
||||
)
|
||||
var sourceLibraries: Array<String>? = null
|
||||
@@ -193,7 +193,7 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(
|
||||
value = "-Xlibrary-to-cover",
|
||||
valueDescription = "<path>",
|
||||
description = "A library that should be covered.\n" +
|
||||
description = "Provide code coverage for the given library.\n" +
|
||||
"Must be one of libraries passed with '-library'",
|
||||
delimiter = ""
|
||||
)
|
||||
|
||||
+7
-3
@@ -80,7 +80,11 @@ private sealed class FeaturedLibrariesReporter {
|
||||
protected abstract fun notIncludedLibraryMessageTitle(): String
|
||||
|
||||
override fun reportIllegalKind(library: KonanLibrary) {
|
||||
val kind = if (library.isInterop) "Interop" else "Default"
|
||||
val kind = when {
|
||||
library.isInterop -> "Interop"
|
||||
library.isDefault -> "Default"
|
||||
else -> "Unknown kind"
|
||||
}
|
||||
configuration.report(CompilerMessageSeverity.STRONG_WARNING, illegalKindMessage(kind, library.libraryName))
|
||||
}
|
||||
|
||||
@@ -115,10 +119,10 @@ private sealed class FeaturedLibrariesReporter {
|
||||
|
||||
private class CoveredLibraryReporter(configuration: CompilerConfiguration): BaseReporter(configuration) {
|
||||
override fun illegalKindMessage(kind: String, libraryName: String): String =
|
||||
"$kind library $libraryName can't be covered"
|
||||
"Cannot provide the code coverage for the $kind library $libraryName."
|
||||
|
||||
override fun notIncludedLibraryMessageTitle(): String =
|
||||
"Following libraries are specified to be covered with -Xlibrary-to-cover, but not included to the build:"
|
||||
"The code coverage is enabled for the following libraries, but they are not included to the build:"
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
+2
-1
@@ -39,7 +39,8 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
internal val target = targetManager.target
|
||||
internal val phaseConfig = configuration.get(CLIConfigurationKeys.PHASE_CONFIG)!!
|
||||
|
||||
val infoArgsOnly = configuration.kotlinSourceRoots.isEmpty() && configuration[KonanConfigKeys.SOURCE_LIBRARIES].isNullOrEmpty()
|
||||
val infoArgsOnly = configuration.kotlinSourceRoots.isEmpty()
|
||||
&& configuration[KonanConfigKeys.SOURCE_LIBRARIES].isNullOrEmpty()
|
||||
|
||||
// TODO: debug info generation mode and debug/release variant selection probably requires some refactoring.
|
||||
val debug: Boolean get() = configuration.getBoolean(KonanConfigKeys.DEBUG)
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ class KonanConfigKeys {
|
||||
val RUNTIME_FILE: CompilerConfigurationKey<String?>
|
||||
= CompilerConfigurationKey.create("override default runtime file path")
|
||||
val SOURCE_LIBRARIES: CompilerConfigurationKey<List<String>>
|
||||
= CompilerConfigurationKey("a klibraries used to produce the final binaries instead of source code") // TODO: Better description.
|
||||
= CompilerConfigurationKey("libraries used to be processed in the same manner as source files")
|
||||
val SOURCE_MAP: CompilerConfigurationKey<List<String>>
|
||||
= CompilerConfigurationKey.create("generate source map")
|
||||
val STATIC_FRAMEWORK: CompilerConfigurationKey<Boolean>
|
||||
|
||||
Reference in New Issue
Block a user