Support two more Apple targets #49

Merged
CommanderTvis merged 1 commits from commandertvis/apple into dev 2022-10-22 22:42:30 +03:00
2 changed files with 20 additions and 4 deletions

View File

@ -212,8 +212,10 @@ public enum class KotlinNativePreset {
linuxX64,
mingwX64,
macosX64,
macosArm64,
iosX64,
iosArm64
iosArm64,
iosSimulatorArm64,
}
public data class KScienceNativeTarget(
@ -225,8 +227,10 @@ public data class KScienceNativeTarget(
public val linuxX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.linuxX64)
public val mingwX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.mingwX64)
public val macosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64)
public val macosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64)
public val iosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosX64)
public val iosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosArm64)
public val iosSimulatorArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosSimulatorArm64)
}
}
@ -235,15 +239,17 @@ public class KScienceNativeConfiguration {
KScienceNativeTarget.linuxX64,
KScienceNativeTarget.mingwX64,
KScienceNativeTarget.macosX64,
KScienceNativeTarget.macosArm64,
KScienceNativeTarget.iosX64,
KScienceNativeTarget.iosArm64,
).associateBy { it.preset }.toMutableMap()
KScienceNativeTarget.iosSimulatorArm64,
).associateByTo(mutableMapOf()) { it.preset }
/**
* Replace all targets
*/
public fun setTargets(vararg target: KScienceNativeTarget) {
targets = target.associateBy { it.preset }.toMutableMap()
targets = target.associateByTo(mutableMapOf()) { it.preset }
}
/**
@ -325,6 +331,11 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
nativeTarget.targetConfiguration
)
KotlinNativePreset.macosArm64 -> macosX64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
)
KotlinNativePreset.iosX64 -> iosX64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
@ -335,6 +346,11 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
nativeTarget.targetConfiguration
)
KotlinNativePreset.iosSimulatorArm64 -> iosArm64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
)
// else -> {
// logger.error("Native preset ${nativeTarget.preset} not recognised.")
// null

View File

@ -254,7 +254,7 @@ public open class KScienceProjectPlugin : Plugin<Project> {
val pattern = "publish(?<publication>.*)PublicationTo${repositoryNameCapitalized}Repository"
.toRegex()
tasks.withType<PublishToMavenRepository>().toList().forEach forEachPublication@{
tasks.withType<PublishToMavenRepository>().forEach forEachPublication@{
val matchResult = pattern.matchEntire(it.name) ?: return@forEachPublication
val publicationName = matchResult.groups["publication"]!!.value.capitalize()
val releaseTaskName = "release$publicationName"