[KLIB] Compute relative path instead of absolute if relative base is provided
- normalize path if required - path it in JS/Native - path null for JVM (temporary) - fix build
This commit is contained in:
+3
-1
@@ -86,7 +86,9 @@ class IcSerializer(
|
||||
skipExpects = true,
|
||||
icMode = true,
|
||||
allowErrorStatementOrigins = true,
|
||||
compatibilityMode = CompatibilityMode.CURRENT
|
||||
compatibilityMode = CompatibilityMode.CURRENT,
|
||||
normalizeAbsolutePaths = false,
|
||||
sourceBaseDirs = emptyList()
|
||||
)
|
||||
|
||||
icDeclarationTable.inFile(file) {
|
||||
|
||||
@@ -782,6 +782,8 @@ fun serializeModuleIntoKlib(
|
||||
assert(files.size == moduleFragment.files.size)
|
||||
|
||||
val compatibilityMode = CompatibilityMode(abiVersion)
|
||||
val sourceBaseDirs = configuration[CommonConfigurationKeys.KLIB_RELATIVE_PATH_BASES] ?: emptyList()
|
||||
val absolutePathNormalization = configuration[CommonConfigurationKeys.KLIB_NORMALIZE_ABSOLUTE_PATH] ?: false
|
||||
|
||||
val serializedIr =
|
||||
JsIrModuleSerializer(
|
||||
@@ -789,7 +791,9 @@ fun serializeModuleIntoKlib(
|
||||
moduleFragment.irBuiltins,
|
||||
expectDescriptorToSymbol,
|
||||
compatibilityMode,
|
||||
skipExpects = !configuration.expectActualLinker
|
||||
skipExpects = !configuration.expectActualLinker,
|
||||
normalizeAbsolutePaths = absolutePathNormalization,
|
||||
sourceBaseDirs = sourceBaseDirs
|
||||
).serializedIrModule(moduleFragment)
|
||||
|
||||
val moduleDescriptor = moduleFragment.descriptor
|
||||
|
||||
+4
@@ -24,6 +24,8 @@ class JsIrFileSerializer(
|
||||
bodiesOnlyForInlines: Boolean = false,
|
||||
icMode: Boolean = false,
|
||||
allowErrorStatementOrigins: Boolean = false,
|
||||
normalizeAbsolutePaths: Boolean,
|
||||
sourceBaseDirs: Collection<String>
|
||||
) : IrFileSerializer(
|
||||
messageLogger,
|
||||
declarationTable,
|
||||
@@ -33,6 +35,8 @@ class JsIrFileSerializer(
|
||||
skipExpects = skipExpects,
|
||||
skipMutableState = icMode,
|
||||
allowErrorStatementOrigins = allowErrorStatementOrigins,
|
||||
normalizeAbsolutePaths = normalizeAbsolutePaths,
|
||||
sourceBaseDirs = sourceBaseDirs
|
||||
) {
|
||||
companion object {
|
||||
private val JS_EXPORT_FQN = FqName("kotlin.js.JsExport")
|
||||
|
||||
+13
-3
@@ -19,11 +19,21 @@ class JsIrModuleSerializer(
|
||||
irBuiltIns: IrBuiltIns,
|
||||
private val expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>,
|
||||
compatibilityMode: CompatibilityMode,
|
||||
val skipExpects: Boolean
|
||||
) : IrModuleSerializer<JsIrFileSerializer>(messageLogger, compatibilityMode) {
|
||||
val skipExpects: Boolean,
|
||||
normalizeAbsolutePaths: Boolean,
|
||||
sourceBaseDirs: Collection<String>
|
||||
) : IrModuleSerializer<JsIrFileSerializer>(messageLogger, compatibilityMode, normalizeAbsolutePaths, sourceBaseDirs) {
|
||||
|
||||
private val globalDeclarationTable = JsGlobalDeclarationTable(irBuiltIns)
|
||||
|
||||
override fun createSerializerForFile(file: IrFile): JsIrFileSerializer =
|
||||
JsIrFileSerializer(messageLogger, DeclarationTable(globalDeclarationTable), expectDescriptorToSymbol, skipExpects = skipExpects, compatibilityMode = compatibilityMode)
|
||||
JsIrFileSerializer(
|
||||
messageLogger,
|
||||
DeclarationTable(globalDeclarationTable),
|
||||
expectDescriptorToSymbol,
|
||||
skipExpects = skipExpects,
|
||||
compatibilityMode = compatibilityMode,
|
||||
normalizeAbsolutePaths = normalizeAbsolutePaths,
|
||||
sourceBaseDirs = sourceBaseDirs
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user