diff --git a/gradle.properties b/gradle.properties index cd42606f..b31e61cc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,7 @@ org.gradle.jvmargs=-Xmx4g #RELEASE_SIGNING_ENABLED=false GROUP=co.touchlab.kmmbridge -VERSION_NAME=0.5.4 +VERSION_NAME=0.5.5 VERSION_NAME_3x=0.3.7 POM_URL=https://github.com/touchlab/KMMBridge diff --git a/kmmbridge/src/main/kotlin/domain/TargetName.kt b/kmmbridge/src/main/kotlin/domain/TargetName.kt index 70afb71d..48878ca0 100644 --- a/kmmbridge/src/main/kotlin/domain/TargetName.kt +++ b/kmmbridge/src/main/kotlin/domain/TargetName.kt @@ -3,5 +3,16 @@ package co.touchlab.faktory.domain internal enum class TargetName(val identifier: String) { IOSarm64("iosArm64"), IOSx64("iosX64"), - IOSSimulatorArm64("iosSimulatorArm64"); + IOSSimulatorArm64("iosSimulatorArm64"), + macosArm64("macosArm64"), + macosX64("macosX64"), + tvosX64("tvosX64"), + tvosArm64("tvosArm64"), + tvosSimulatorArm64("tvosSimulatorArm64"), + watchosX64("watchosX64"), + watchosArm32("watchosArm32"), + watchosArm64("watchosArm64"), + watchosDeviceArm64("watchosDeviceArm64"), + watchosSimulatorArm64("watchosSimulatorArm64") + ; } \ No newline at end of file diff --git a/kmmbridge/src/main/kotlin/domain/extensions.kt b/kmmbridge/src/main/kotlin/domain/extensions.kt index 99b7ce53..3adf1f0f 100644 --- a/kmmbridge/src/main/kotlin/domain/extensions.kt +++ b/kmmbridge/src/main/kotlin/domain/extensions.kt @@ -18,14 +18,14 @@ internal val TargetName.konanTarget: KonanTarget TargetName.IOSarm64 -> KonanTarget.IOS_ARM64 TargetName.IOSx64 -> KonanTarget.IOS_X64 TargetName.IOSSimulatorArm64 -> KonanTarget.IOS_SIMULATOR_ARM64 -// TargetName.WatchOSarm32 -> KonanTarget.WATCHOS_ARM32 -// TargetName.WatchOSarm64 -> KonanTarget.WATCHOS_ARM64 -// TargetName.WatchOSx86 -> KonanTarget.WATCHOS_X86 -// TargetName.WatchOSx64 -> KonanTarget.WATCHOS_X64 -// TargetName.WatchOSSimulatorArm64 -> KonanTarget.WATCHOS_SIMULATOR_ARM64 -// TargetName.TvOSarm64 -> KonanTarget.TVOS_ARM64 -// TargetName.TvOSx64 -> KonanTarget.TVOS_X64 -// TargetName.TvOSSimulatorArm64 -> KonanTarget.TVOS_SIMULATOR_ARM64 -// TargetName.MacOSx64 -> KonanTarget.MACOS_X64 -// TargetName.MacOSArm64 -> KonanTarget.MACOS_ARM64 + TargetName.watchosArm32 -> KonanTarget.WATCHOS_ARM32 + TargetName.watchosArm64 -> KonanTarget.WATCHOS_ARM64 + TargetName.watchosX64 -> KonanTarget.WATCHOS_X64 + TargetName.watchosSimulatorArm64 -> KonanTarget.WATCHOS_SIMULATOR_ARM64 + TargetName.tvosArm64 -> KonanTarget.TVOS_ARM64 + TargetName.tvosX64 -> KonanTarget.TVOS_X64 + TargetName.tvosSimulatorArm64 -> KonanTarget.TVOS_SIMULATOR_ARM64 + TargetName.macosX64 -> KonanTarget.MACOS_X64 + TargetName.macosArm64 -> KonanTarget.MACOS_ARM64 + TargetName.watchosDeviceArm64 -> KonanTarget.WATCHOS_DEVICE_ARM64 } \ No newline at end of file diff --git a/kmmbridge/src/main/kotlin/dsl/TargetPlatformDsl.kt b/kmmbridge/src/main/kotlin/dsl/TargetPlatformDsl.kt index 2cf69dca..0ac962bf 100644 --- a/kmmbridge/src/main/kotlin/dsl/TargetPlatformDsl.kt +++ b/kmmbridge/src/main/kotlin/dsl/TargetPlatformDsl.kt @@ -32,6 +32,67 @@ public class TargetPlatformDsl { iOS { ConfigureUtil.configure(version, this) } } + /** + * Adds all macOS targets as a [TargetPlatform] using the provided [version] + * + * @param version builder for an instance of [PlatformVersion] + */ + public fun macOS(version: PlatformVersionDsl.() -> Unit) { + targetsInternal( + listOf( + TargetName.macosArm64, + TargetName.macosX64, + ), + version + ) + } + + public fun macOS(version: Closure) { + macOS { ConfigureUtil.configure(version, this) } + } + + /** + * Adds all tvOS targets as a [TargetPlatform] using the provided [version] + * + * @param version builder for an instance of [PlatformVersion] + */ + public fun tvOS(version: PlatformVersionDsl.() -> Unit) { + targetsInternal( + listOf( + TargetName.tvosX64, + TargetName.tvosArm64, + TargetName.tvosSimulatorArm64, + ), + version + ) + } + + public fun tvOS(version: Closure) { + tvOS { ConfigureUtil.configure(version, this) } + } + + /** + * Adds all watchOS targets as a [TargetPlatform] using the provided [version] + * + * @param version builder for an instance of [PlatformVersion] + */ + public fun watchOS(version: PlatformVersionDsl.() -> Unit) { + targetsInternal( + listOf( + TargetName.watchosX64, + TargetName.watchosArm32, + TargetName.watchosArm64, + TargetName.watchosDeviceArm64, + TargetName.watchosSimulatorArm64, + ), + version + ) + } + + public fun watchOS(version: Closure) { + watchOS { ConfigureUtil.configure(version, this) } + } + private fun targetsInternal(names: List, configure: PlatformVersionDsl.() -> Unit) { val platformVersion: PlatformVersion = PlatformVersionDsl().apply(configure).version ?: return diff --git a/website/docs/spm/01_IOS_SPM.md b/website/docs/spm/01_IOS_SPM.md index dfb803ae..92ce9bae 100644 --- a/website/docs/spm/01_IOS_SPM.md +++ b/website/docs/spm/01_IOS_SPM.md @@ -42,9 +42,10 @@ You can use the `targetPlatforms` lambda to add a targets and versions. Currentl ```kotlin kmmbridge { ... - spm(targetPlatforms = { + spm { iOS { v("14") } - }) + macOS { v("12") } + } } ```