diff --git a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt index e326038a1e5..146a8ad7f69 100644 --- a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt +++ b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt @@ -84,19 +84,16 @@ private fun String.targetSuffix(): String = // foo = ${foo} ${foo.${arch}} ${foo.${os}} private fun substitute(properties: Properties, substitutions: Map) { for (key in properties.stringPropertyNames()) { - if (key.contains('.')) { - continue - } - var value = "" - for (substitution in substitutions.keys) { - val property = properties.getProperty(key + "." + substitutions[substitution]) - if (property != null) { - value += " " + property + for (substitution in substitutions.values) { + val suffix = ".$substitution" + if (key.endsWith(suffix)) { + val baseKey = key.removeSuffix(suffix) + val oldValue = properties.getProperty(baseKey, "") + val appendedValue = properties.getProperty(key, "") + val newValue = if (oldValue != "") "$oldValue $appendedValue" else appendedValue + properties.setProperty(baseKey, newValue) } } - if (value != "") { - properties.setProperty(key, properties.getProperty(key, "") + " " + value) - } } }