Skip to content

Commit 748ad6c

Browse files
authored
Merge pull request #2 from JakeWharton/jw.all-targets.2023-01-18
Build all possible targets
2 parents 9c38fc9 + 538a959 commit 748ad6c

File tree

5 files changed

+46
-93
lines changed

5 files changed

+46
-93
lines changed

build.gradle.kts

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import java.util.Properties
22
import org.gradle.api.publish.maven.MavenPublication
33
import org.gradle.api.tasks.bundling.Jar
4+
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
45

56
plugins {
67
kotlin("multiplatform") version "1.8.0"
@@ -16,53 +17,73 @@ repositories {
1617
}
1718

1819
kotlin {
20+
androidNativeArm32()
21+
androidNativeArm64()
22+
androidNativeX86()
23+
androidNativeX64()
24+
25+
iosArm32()
26+
iosArm64()
27+
iosX64()
28+
iosSimulatorArm64()
29+
30+
js(IR) {
31+
browser {}
32+
}
33+
1934
jvm {
2035
compilations.all {
2136
kotlinOptions.jvmTarget = "11"
2237
}
23-
withJava()
2438
testRuns["test"].executionTask.configure {
2539
useJUnitPlatform()
2640
}
2741
}
28-
29-
js(IR) {
30-
browser {}
31-
}
32-
33-
val hostOs = System.getProperty("os.name")
34-
val isMingwX64 = hostOs.startsWith("Windows")
35-
val nativeTarget = when {
36-
hostOs == "Mac OS X" -> macosX64("native")
37-
hostOs == "Linux" -> linuxX64("native")
38-
isMingwX64 -> mingwX64("native")
39-
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
40-
}
41-
42-
sourceSets {
43-
val commonImplementation by creating
4442

43+
linuxArm64()
44+
linuxArm32Hfp()
45+
linuxX64()
46+
47+
macosX64()
48+
macosArm64()
49+
50+
mingwX64()
51+
mingwX86()
52+
53+
tvosArm64()
54+
tvosX64()
55+
tvosSimulatorArm64()
56+
57+
wasm32()
58+
59+
watchosArm32()
60+
watchosArm64()
61+
watchosDeviceArm64()
62+
watchosX86()
63+
watchosX64()
64+
watchosSimulatorArm64()
65+
66+
sourceSets {
4567
val commonMain by getting
4668
val commonTest by getting {
4769
dependencies {
4870
implementation(kotlin("test"))
4971
}
5072
}
5173

52-
val jvmMain by getting
53-
val jvmTest by getting {
54-
dependsOn(commonImplementation)
74+
val commonImplementation by creating {
75+
dependsOn(commonMain)
5576
}
5677

57-
val jsMain by getting {
78+
val jvmTest by getting {
5879
dependsOn(commonImplementation)
5980
}
60-
val jsTest by getting
81+
}
6182

62-
val nativeMain by getting {
63-
dependsOn(commonImplementation)
83+
targets.onEach {
84+
if (it.platformType != KotlinPlatformType.jvm) {
85+
it.compilations.getByName("main").source(sourceSets.getByName("commonImplementation"))
6486
}
65-
val nativeTest by getting
6687
}
6788
}
6889

File renamed without changes.
File renamed without changes.

src/nativeMain/kotlin/CodePoints.kt

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/nativeMain/kotlin/StringExtensions.kt

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)