[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'")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,13 @@ package org.jetbrains.kotlin.js.config;
|
||||
|
||||
import org.jetbrains.kotlin.konan.file.ZipFileSystemAccessor;
|
||||
import org.jetbrains.kotlin.config.CompilerConfigurationKey;
|
||||
import org.jetbrains.kotlin.config.PartialLinkageLogLevel;
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalNextRoundChecker;
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider;
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumer;
|
||||
import org.jetbrains.kotlin.serialization.js.ModuleKind;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -102,7 +102,10 @@ public class JSConfigurationKeys {
|
||||
CompilerConfigurationKey.create("set up policy to ignore compilation errors");
|
||||
|
||||
public static final CompilerConfigurationKey<Boolean> PARTIAL_LINKAGE =
|
||||
CompilerConfigurationKey.create("allows some symbols in klibs be missed");
|
||||
CompilerConfigurationKey.create("enables partial linkage mode");
|
||||
|
||||
public static final CompilerConfigurationKey<PartialLinkageLogLevel> PARTIAL_LINKAGE_LOG_LEVEL =
|
||||
CompilerConfigurationKey.create("partial linkage compile-time log level");
|
||||
|
||||
public static final CompilerConfigurationKey<Boolean> PROPERTY_LAZY_INITIALIZATION =
|
||||
CompilerConfigurationKey.create("perform lazy initialization for properties");
|
||||
|
||||
+2
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.config.PartialLinkageLogLevel
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
import org.jetbrains.kotlin.konan.library.KonanLibrary
|
||||
import org.jetbrains.kotlin.konan.properties.loadProperties
|
||||
@@ -400,6 +401,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
internal val useDebugInfoInNativeLibs= configuration.get(BinaryOptions.stripDebugInfoFromNativeLibs) == false
|
||||
|
||||
internal val partialLinkageEnabled = configuration[KonanConfigKeys.PARTIAL_LINKAGE] ?: false
|
||||
internal val partialLinkageLogLevel = configuration[KonanConfigKeys.PARTIAL_LINKAGE_LOG_LEVEL] ?: PartialLinkageLogLevel.DEFAULT
|
||||
|
||||
internal val additionalCacheFlags by lazy { platformManager.loader(target).additionalCacheFlags }
|
||||
|
||||
|
||||
+3
-1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.backend.konan
|
||||
|
||||
import org.jetbrains.kotlin.config.CompilerConfigurationKey
|
||||
import org.jetbrains.kotlin.config.PartialLinkageLogLevel
|
||||
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
||||
|
||||
class KonanConfigKeys {
|
||||
@@ -158,7 +159,8 @@ class KonanConfigKeys {
|
||||
val LLVM_VARIANT: CompilerConfigurationKey<LlvmVariant?> = CompilerConfigurationKey.create("llvm variant")
|
||||
val RUNTIME_LOGS: CompilerConfigurationKey<String> = CompilerConfigurationKey.create("enable runtime logging")
|
||||
val LAZY_IR_FOR_CACHES: CompilerConfigurationKey<Boolean> = CompilerConfigurationKey.create("use lazy IR for cached libraries")
|
||||
val PARTIAL_LINKAGE: CompilerConfigurationKey<Boolean> = CompilerConfigurationKey.create("allows some symbols in klibs be missed")
|
||||
val PARTIAL_LINKAGE: CompilerConfigurationKey<Boolean> = CompilerConfigurationKey.create("enables partial linkage mode")
|
||||
val PARTIAL_LINKAGE_LOG_LEVEL: CompilerConfigurationKey<PartialLinkageLogLevel> = CompilerConfigurationKey.create("partial linkage compile-time log level")
|
||||
val TEST_DUMP_OUTPUT_PATH: CompilerConfigurationKey<String?> = CompilerConfigurationKey.create("path to a file to dump the list of all available tests")
|
||||
val OMIT_FRAMEWORK_BINARY: CompilerConfigurationKey<Boolean> = CompilerConfigurationKey.create("do not generate binary in framework")
|
||||
val COMPILE_FROM_BITCODE: CompilerConfigurationKey<String?> = CompilerConfigurationKey.create("path to bitcode file to compile")
|
||||
|
||||
+4
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.cli.common.config.kotlinSourceRoots
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.PartialLinkageLogLevel
|
||||
import org.jetbrains.kotlin.config.getModuleNameForSource
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
||||
@@ -272,6 +273,8 @@ fun CompilerConfiguration.setupFromArguments(arguments: K2NativeCompilerArgument
|
||||
putIfNotNull(BUNDLE_ID, parseBundleId(arguments, outputKind, this@setupFromArguments))
|
||||
arguments.testDumpOutputPath?.let { put(TEST_DUMP_OUTPUT_PATH, it) }
|
||||
put(PARTIAL_LINKAGE, arguments.partialLinkage)
|
||||
arguments.partialLinkageLogLevel?.let { put(PARTIAL_LINKAGE_LOG_LEVEL, PartialLinkageLogLevel.resolveLogLevel(it)) }
|
||||
|
||||
put(OMIT_FRAMEWORK_BINARY, arguments.omitFrameworkBinary)
|
||||
putIfNotNull(COMPILE_FROM_BITCODE, parseCompileFromBitcode(arguments, this@setupFromArguments, outputKind))
|
||||
putIfNotNull(SERIALIZED_DEPENDENCIES, parseSerializedDependencies(arguments, this@setupFromArguments))
|
||||
@@ -285,6 +288,7 @@ internal fun CompilerConfiguration.setupCommonOptionsForCaches(konanConfig: Kona
|
||||
put(TARGET, konanConfig.target.toString())
|
||||
put(DEBUG, konanConfig.debug)
|
||||
put(PARTIAL_LINKAGE, konanConfig.partialLinkageEnabled)
|
||||
put(PARTIAL_LINKAGE_LOG_LEVEL, konanConfig.partialLinkageLogLevel)
|
||||
putIfNotNull(EXTERNAL_DEPENDENCIES, konanConfig.externalDependenciesFile?.absolutePath)
|
||||
put(BinaryOptions.memoryModel, konanConfig.memoryModel)
|
||||
put(PROPERTY_LAZY_INITIALIZATION, konanConfig.propertyLazyInitialization)
|
||||
|
||||
Reference in New Issue
Block a user