Skip to content

Commit

Permalink
#762 added support custom build configuration for apple target
Browse files Browse the repository at this point in the history
  • Loading branch information
ExNDY committed Sep 6, 2024
1 parent 9743493 commit 5e4700d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle/moko.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
resourcesVersion = "0.24.2"
resourcesVersion = "0.24.3"

[libraries]
resources = { module = "dev.icerock.moko:resources", version.ref = "resourcesVersion" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ internal fun registerCopyFrameworkResourcesToAppTask(
?: emptyMap()

val configName: String = (configMap[configuration]?.name ?: configuration).lowercase()
// Map any configuration to standard with two types: "Debug/Release" builds
val clearConfigurationName: String = when{
configName.matches(".*debug.*".toRegex()) -> "debug"
configName.matches(".*release.*".toRegex()) -> "release"
else -> throw IllegalArgumentException(
"Invalid build configuration name: $configName. Please, update your configuration." +
"Configuration name should contains Debug or Release in name"
)
}
val requiredKonanTargets: List<String> =
AppleSdk.defineNativeTargets(platform, archs).map { it.name }
val frameworkNames: DomainObjectSet<String> =
Expand All @@ -179,7 +188,7 @@ internal fun registerCopyFrameworkResourcesToAppTask(
it.dependsOn(
project.tasks.withType<CopyFrameworkResourcesToAppTask>().matching { copyTask ->
val isCorrectConfiguration: Boolean =
copyTask.configuration.lowercase() == configName
copyTask.configuration.lowercase() == clearConfigurationName
val isCorrectFrameworkPrefix: Boolean =
copyTask.frameworkPrefix == frameworkPrefix
val isCorrectKonanTarget: Boolean =
Expand Down

0 comments on commit 5e4700d

Please sign in to comment.