Skip to content

Commit

Permalink
Add other platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
kpgalligan committed Apr 21, 2024
1 parent d57d3de commit cb12f2c
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion kmmbridge/src/main/kotlin/domain/TargetName.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
;
}
20 changes: 10 additions & 10 deletions kmmbridge/src/main/kotlin/domain/extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
61 changes: 61 additions & 0 deletions kmmbridge/src/main/kotlin/dsl/TargetPlatformDsl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<PlatformVersionDsl>) {
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<PlatformVersionDsl>) {
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<PlatformVersionDsl>) {
watchOS { ConfigureUtil.configure(version, this) }
}

private fun targetsInternal(names: List<TargetName>, configure: PlatformVersionDsl.() -> Unit) {
val platformVersion: PlatformVersion = PlatformVersionDsl().apply(configure).version ?: return

Expand Down
5 changes: 3 additions & 2 deletions website/docs/spm/01_IOS_SPM.md
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
}
}
```

Expand Down

0 comments on commit cb12f2c

Please sign in to comment.