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}}
|
||||
private fun substitute(properties: Properties, substitutions: Map<String, String>) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user