1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 08:38:13 -07:00

Fix file names with variants.

This commit is contained in:
Cedric Beust 2015-11-15 21:27:23 -08:00
parent b08790cf50
commit 1590128a11
2 changed files with 22 additions and 10 deletions

View file

@ -204,4 +204,19 @@ class Variant(val productFlavorName: String = "", val buildTypeName: String = ""
return result
}
}
fun archiveName(project: Project, archiveName: String?, suffix: String) : String {
val result: String =
if (isDefault) archiveName ?: project.name + "-" + project.version + suffix
else {
val base = if (archiveName != null) archiveName.substring(0, archiveName.length - suffix.length)
else project.name + "-" + project.version
base +
if (productFlavorName.isEmpty()) "" else "-$productFlavorName" +
if (buildTypeName.isEmpty()) "" else "-$buildTypeName" +
suffix
}
return result
}
}