Fix reading manifest properties got from def file (#7)
This commit is contained in:
committed by
Ilya Matveev
parent
a6cb5e408a
commit
e3d9169d25
@@ -51,7 +51,7 @@ val KonanLibrary.uniqueName
|
|||||||
get() = manifestProperties.getProperty(KLIB_PROPERTY_UNIQUE_NAME)!!
|
get() = manifestProperties.getProperty(KLIB_PROPERTY_UNIQUE_NAME)!!
|
||||||
|
|
||||||
val KonanLibrary.unresolvedDependencies: List<UnresolvedLibrary>
|
val KonanLibrary.unresolvedDependencies: List<UnresolvedLibrary>
|
||||||
get() = manifestProperties.propertyList(KLIB_PROPERTY_DEPENDS)
|
get() = manifestProperties.propertyList(KLIB_PROPERTY_DEPENDS, escapeInQuotes = true)
|
||||||
.map {
|
.map {
|
||||||
UnresolvedLibrary(it, manifestProperties.getProperty("dependency_version_$it"))
|
UnresolvedLibrary(it, manifestProperties.getProperty("dependency_version_$it"))
|
||||||
}
|
}
|
||||||
@@ -63,11 +63,11 @@ val KonanLibrary.packageFqName
|
|||||||
get() = manifestProperties.getProperty(KLIB_PROPERTY_PACKAGE)
|
get() = manifestProperties.getProperty(KLIB_PROPERTY_PACKAGE)
|
||||||
|
|
||||||
val KonanLibrary.exportForwardDeclarations
|
val KonanLibrary.exportForwardDeclarations
|
||||||
get() = manifestProperties.getProperty(KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS)
|
get() = manifestProperties.propertyList(KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS, escapeInQuotes = true)
|
||||||
.split(' ').asSequence()
|
.asSequence()
|
||||||
.map { it.trim() }
|
.map { it.trim() }
|
||||||
.filter { it.isNotEmpty() }
|
.filter { it.isNotEmpty() }
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
val KonanLibrary.includedHeaders
|
val KonanLibrary.includedHeaders
|
||||||
get() = manifestProperties.getProperty(KLIB_PROPERTY_INCLUDED_HEADERS).split(' ')
|
get() = manifestProperties.propertyList(KLIB_PROPERTY_INCLUDED_HEADERS, escapeInQuotes = true)
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ class KonanLibraryImpl(
|
|||||||
get() = manifestProperties.readKonanLibraryVersioning()
|
get() = manifestProperties.readKonanLibraryVersioning()
|
||||||
|
|
||||||
override val linkerOpts: List<String>
|
override val linkerOpts: List<String>
|
||||||
get() = manifestProperties.propertyList(KLIB_PROPERTY_LINKED_OPTS)
|
get() = manifestProperties.propertyList(KLIB_PROPERTY_LINKED_OPTS, escapeInQuotes = true)
|
||||||
|
|
||||||
override val bitcodePaths: List<String>
|
override val bitcodePaths: List<String>
|
||||||
get() = layout.realFiles { (it.kotlinDir.listFilesOrEmpty + it.nativeDir.listFilesOrEmpty).map { it.absolutePath } }
|
get() = layout.realFiles { (it.kotlinDir.listFilesOrEmpty + it.nativeDir.listFilesOrEmpty).map { it.absolutePath } }
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.konan.properties
|
|||||||
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the whole file!
|
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the whole file!
|
||||||
|
|
||||||
import org.jetbrains.kotlin.konan.file.*
|
import org.jetbrains.kotlin.konan.file.*
|
||||||
|
import org.jetbrains.kotlin.konan.util.parseSpaceSeparatedArgs
|
||||||
|
|
||||||
typealias Properties = java.util.Properties
|
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
|
* functionality borrowed from def file parser and unified for interop tool
|
||||||
* and kotlin compiler.
|
* and kotlin compiler.
|
||||||
*/
|
*/
|
||||||
fun Properties.propertyList(key: String, suffix: String? = null): List<String> {
|
fun Properties.propertyList(key: String, suffix: String? = null, escapeInQuotes: Boolean = false): List<String> {
|
||||||
val value = this.getProperty(key.suffix(suffix)) ?: this.getProperty(key)
|
val value = this.getProperty(key.suffix(suffix)) ?: this.getProperty(key)
|
||||||
if (value?.isBlank() == true) return emptyList()
|
if (value?.isBlank() == true) return emptyList()
|
||||||
|
return if (escapeInQuotes) value?.let { parseSpaceSeparatedArgs(it) } ?: emptyList()
|
||||||
return value?.split(Regex("\\s+")) ?: emptyList()
|
else value?.split(Regex("\\s+")) ?: emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Properties.hasProperty(key: String, suffix: String? = null): Boolean
|
fun Properties.hasProperty(key: String, suffix: String? = null): Boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user