Fix def file substitutions
Properly handle the case when platform-specific property is specified but the base one isn't.
This commit is contained in:
committed by
SvyatoslavScherbina
parent
9926b281dd
commit
94ff4d69be
+8
-11
@@ -84,19 +84,16 @@ private fun String.targetSuffix(): String =
|
|||||||
// foo = ${foo} ${foo.${arch}} ${foo.${os}}
|
// foo = ${foo} ${foo.${arch}} ${foo.${os}}
|
||||||
private fun substitute(properties: Properties, substitutions: Map<String, String>) {
|
private fun substitute(properties: Properties, substitutions: Map<String, String>) {
|
||||||
for (key in properties.stringPropertyNames()) {
|
for (key in properties.stringPropertyNames()) {
|
||||||
if (key.contains('.')) {
|
for (substitution in substitutions.values) {
|
||||||
continue
|
val suffix = ".$substitution"
|
||||||
}
|
if (key.endsWith(suffix)) {
|
||||||
var value = ""
|
val baseKey = key.removeSuffix(suffix)
|
||||||
for (substitution in substitutions.keys) {
|
val oldValue = properties.getProperty(baseKey, "")
|
||||||
val property = properties.getProperty(key + "." + substitutions[substitution])
|
val appendedValue = properties.getProperty(key, "")
|
||||||
if (property != null) {
|
val newValue = if (oldValue != "") "$oldValue $appendedValue" else appendedValue
|
||||||
value += " " + property
|
properties.setProperty(baseKey, newValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (value != "") {
|
|
||||||
properties.setProperty(key, properties.getProperty(key, "") + " " + value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user