11/*
2- * Copyright 2015-2024 the original author or authors.
2+ * Copyright 2015-2025 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -18,9 +18,21 @@ package rsocketbuild
1818
1919import org.gradle.jvm.toolchain.*
2020import org.gradle.kotlin.dsl.*
21+ import org.jetbrains.kotlin.gradle.*
2122import org.jetbrains.kotlin.gradle.dsl.*
2223
23- fun KotlinMultiplatformExtension.appleTargets () {
24+ fun KotlinMultiplatformExtension.allTargets (
25+ supportsWasi : Boolean = true,
26+ supportsBrowser : Boolean = true,
27+ ) {
28+ jvmTarget()
29+ jsTarget(supportsBrowser = supportsBrowser)
30+ wasmJsTarget(supportsBrowser = supportsBrowser)
31+ if (supportsWasi) wasmWasiTarget()
32+ nativeTargets()
33+ }
34+
35+ fun KotlinMultiplatformExtension.nativeTargets () {
2436 macosX64()
2537 macosArm64()
2638
@@ -32,29 +44,20 @@ fun KotlinMultiplatformExtension.appleTargets() {
3244 watchosArm32()
3345 watchosArm64()
3446 watchosSimulatorArm64()
35- // https://youtrack.jetbrains.com/issue/KTOR-6368, supported by kotlinx-io
36- // watchosDeviceArm64()
47+ watchosDeviceArm64()
3748
3849 tvosX64()
3950 tvosArm64()
4051 tvosSimulatorArm64()
41- }
4252
43- fun KotlinMultiplatformExtension.nixTargets () {
44- appleTargets()
4553 linuxX64()
4654 linuxArm64()
47- }
48-
49- fun KotlinMultiplatformExtension.nativeTargets () {
50- nixTargets()
5155 mingwX64()
5256
53- // not supported by ktor, supported by kotlinx-io
54- // androidNativeX64()
55- // androidNativeX86()
56- // androidNativeArm64()
57- // androidNativeArm32()
57+ androidNativeX64()
58+ androidNativeX86()
59+ androidNativeArm64()
60+ androidNativeArm32()
5861}
5962
6063fun KotlinMultiplatformExtension.jsTarget (
@@ -67,6 +70,24 @@ fun KotlinMultiplatformExtension.jsTarget(
6770 }
6871}
6972
73+ @OptIn(ExperimentalWasmDsl ::class )
74+ fun KotlinMultiplatformExtension.wasmJsTarget (
75+ supportsNode : Boolean = true,
76+ supportsBrowser : Boolean = true,
77+ ) {
78+ wasmJs {
79+ if (supportsNode) nodejs()
80+ if (supportsBrowser) browser()
81+ }
82+ }
83+
84+ @OptIn(ExperimentalWasmDsl ::class )
85+ fun KotlinMultiplatformExtension.wasmWasiTarget () {
86+ wasmWasi {
87+ nodejs()
88+ }
89+ }
90+
7091fun KotlinMultiplatformExtension.jvmTarget (
7192 jdkVersion : Int = 8,
7293 jdkAdditionalTestVersions : Set <Int > = setOf(11, 17, 21),
0 commit comments