[PL] Introduce new CLI parameter: -Xpartial-linkage-loglevel
The parameter controls the level of logs produced during the compile time by the partial linkage: 'info', 'warn' (default for now), and 'error'.
This commit is contained in:
committed by
Space Team
parent
d8902816d0
commit
831611d577
+8
-1
@@ -540,13 +540,20 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xpartial-linkage", description = "Allow unlinked symbols")
|
||||
@Argument(value = "-Xpartial-linkage", description = "Enable partial linkage mode")
|
||||
var partialLinkage = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xpartial-linkage-loglevel", valueDescription = "{info|warning|error}", description = "Partial linkage compile-time log level")
|
||||
var partialLinkageLogLevel: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xwasm", description = "Use experimental WebAssembly compiler backend")
|
||||
var wasm = false
|
||||
set(value) {
|
||||
|
||||
+8
-1
@@ -424,9 +424,16 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(value = "-Xlazy-ir-for-caches", valueDescription = "{disable|enable}", description = "Use lazy IR for cached libraries")
|
||||
var lazyIrForCaches: String? = null
|
||||
|
||||
@Argument(value = "-Xpartial-linkage", description = "Allow unlinked symbols")
|
||||
@Argument(value = "-Xpartial-linkage", description = "Enable partial linkage mode")
|
||||
var partialLinkage: Boolean = false
|
||||
|
||||
@Argument(value = "-Xpartial-linkage-loglevel", valueDescription = "{info|warning|error}", description = "Partial linkage compile-time log level")
|
||||
var partialLinkageLogLevel: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xomit-framework-binary", description = "Omit binary when compiling framework")
|
||||
var omitFrameworkBinary: Boolean = false
|
||||
|
||||
|
||||
@@ -170,6 +170,9 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
configuration.put(JSConfigurationKeys.TRANSITIVE_LIBRARIES, libraries)
|
||||
|
||||
configuration.put(JSConfigurationKeys.PARTIAL_LINKAGE, arguments.partialLinkage)
|
||||
arguments.partialLinkageLogLevel?.let {
|
||||
configuration.put(JSConfigurationKeys.PARTIAL_LINKAGE_LOG_LEVEL, PartialLinkageLogLevel.resolveLogLevel(it))
|
||||
}
|
||||
|
||||
configuration.put(JSConfigurationKeys.WASM_ENABLE_ARRAY_RANGE_CHECKS, arguments.wasmEnableArrayRangeChecks)
|
||||
configuration.put(JSConfigurationKeys.WASM_ENABLE_ASSERTS, arguments.wasmEnableAsserts)
|
||||
|
||||
+3
-1
@@ -40,7 +40,9 @@ where advanced options include:
|
||||
-Xir-safe-external-boolean-diagnostic={log|exception}
|
||||
Enable runtime diagnostics when access safely to boolean in external declarations
|
||||
-Xmetadata-only Generate *.meta.js and *.kjsm files only
|
||||
-Xpartial-linkage Allow unlinked symbols
|
||||
-Xpartial-linkage Enable partial linkage mode
|
||||
-Xpartial-linkage-loglevel={info|warning|error}
|
||||
Partial linkage compile-time log level
|
||||
-Xstrict-implicit-export-types Generate strict types for implicitly exported entities inside d.ts files. Available in IR backend only.
|
||||
-Xtyped-arrays Translate primitive arrays to JS typed arrays
|
||||
-Xes-classes Generated JavaScript will use ES2015 classes.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.config
|
||||
|
||||
enum class PartialLinkageLogLevel {
|
||||
INFO, WARNING, ERROR;
|
||||
|
||||
companion object {
|
||||
val DEFAULT = WARNING
|
||||
|
||||
fun resolveLogLevel(key: String): PartialLinkageLogLevel = when (key.uppercase()) {
|
||||
"INFO" -> INFO
|
||||
"WARNING" -> WARNING
|
||||
"ERROR" -> ERROR
|
||||
else -> error("Unknown partial linkage compile-time log level '$key'")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user