diff --git a/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/KonanLibrary.kt b/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/KonanLibrary.kt index b99db471866..46caf2c654b 100644 --- a/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/KonanLibrary.kt +++ b/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/KonanLibrary.kt @@ -51,7 +51,7 @@ val KonanLibrary.uniqueName get() = manifestProperties.getProperty(KLIB_PROPERTY_UNIQUE_NAME)!! val KonanLibrary.unresolvedDependencies: List - get() = manifestProperties.propertyList(KLIB_PROPERTY_DEPENDS) + get() = manifestProperties.propertyList(KLIB_PROPERTY_DEPENDS, escapeInQuotes = true) .map { UnresolvedLibrary(it, manifestProperties.getProperty("dependency_version_$it")) } @@ -63,11 +63,11 @@ val KonanLibrary.packageFqName get() = manifestProperties.getProperty(KLIB_PROPERTY_PACKAGE) val KonanLibrary.exportForwardDeclarations - get() = manifestProperties.getProperty(KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS) - .split(' ').asSequence() + get() = manifestProperties.propertyList(KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS, escapeInQuotes = true) + .asSequence() .map { it.trim() } .filter { it.isNotEmpty() } .toList() val KonanLibrary.includedHeaders - get() = manifestProperties.getProperty(KLIB_PROPERTY_INCLUDED_HEADERS).split(' ') + get() = manifestProperties.propertyList(KLIB_PROPERTY_INCLUDED_HEADERS, escapeInQuotes = true) diff --git a/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/impl/KonanLibraryImpl.kt b/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/impl/KonanLibraryImpl.kt index 77bf2096ab8..f5fc2735917 100644 --- a/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/impl/KonanLibraryImpl.kt +++ b/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/impl/KonanLibraryImpl.kt @@ -51,7 +51,7 @@ class KonanLibraryImpl( get() = manifestProperties.readKonanLibraryVersioning() override val linkerOpts: List - get() = manifestProperties.propertyList(KLIB_PROPERTY_LINKED_OPTS) + get() = manifestProperties.propertyList(KLIB_PROPERTY_LINKED_OPTS, escapeInQuotes = true) override val bitcodePaths: List get() = layout.realFiles { (it.kotlinDir.listFilesOrEmpty + it.nativeDir.listFilesOrEmpty).map { it.absolutePath } } diff --git a/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Properties.kt b/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Properties.kt index eb886881b61..d95b5ffca8b 100644 --- a/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Properties.kt +++ b/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Properties.kt @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.konan.properties // FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the whole file! import org.jetbrains.kotlin.konan.file.* +import org.jetbrains.kotlin.konan.util.parseSpaceSeparatedArgs typealias Properties = java.util.Properties @@ -47,11 +48,11 @@ fun Properties.propertyString(key: String, suffix: String? = null): String? = ge * functionality borrowed from def file parser and unified for interop tool * and kotlin compiler. */ -fun Properties.propertyList(key: String, suffix: String? = null): List { +fun Properties.propertyList(key: String, suffix: String? = null, escapeInQuotes: Boolean = false): List { val value = this.getProperty(key.suffix(suffix)) ?: this.getProperty(key) if (value?.isBlank() == true) return emptyList() - - return value?.split(Regex("\\s+")) ?: emptyList() + return if (escapeInQuotes) value?.let { parseSpaceSeparatedArgs(it) } ?: emptyList() + else value?.split(Regex("\\s+")) ?: emptyList() } fun Properties.hasProperty(key: String, suffix: String? = null): Boolean