Skip to content

Commit 188dc9c

Browse files
committed
refactor: disable native targets by default
1 parent 8a05205 commit 188dc9c

File tree

5 files changed

+44
-32
lines changed

5 files changed

+44
-32
lines changed

.github/workflows/check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ jobs:
3737
- name: Run unit tests
3838
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef # v2.3.3
3939
with:
40-
arguments: check --stacktrace
40+
arguments: check -PenableNativeTargets --stacktrace
4141

4242
- name: Run benchmarks
4343
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef # v2.3.3
4444
with:
45-
arguments: :benchmark:benchmark --stacktrace
45+
arguments: :benchmark:benchmark -PenableNativeTargets --stacktrace

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Publish
4343
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef # v2.3.3
4444
with:
45-
arguments: publishAllPublicationsToSonatypeRepository
45+
arguments: publishAllPublicationsToSonatypeRepository -PenableNativeTargets
4646
env:
4747
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.NEXUS_PUBLISH_GPG_KEY }}
4848
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.NEXUS_PUBLISH_GPG_KEY_PASSWORD }}
@@ -73,7 +73,7 @@ jobs:
7373
- name: Publish Windows artifacts
7474
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef # v2.3.3
7575
with:
76-
arguments: publishMingwX64PublicationToSonatypeRepository publishMingwX86PublicationToSonatypeRepository
76+
arguments: publishMingwX64PublicationToSonatypeRepository publishMingwX86PublicationToSonatypeRepository -PenableNativeTargets
7777
env:
7878
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.NEXUS_PUBLISH_GPG_KEY }}
7979
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.NEXUS_PUBLISH_GPG_KEY_PASSWORD }}

benchmark/build.gradle.kts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,21 @@ benchmark {
1818
register("js")
1919
register("jsIR")
2020
register("jvm")
21-
register("native")
21+
if (providers.gradleProperty("enableNativeTargets").isPresent) {
22+
register("native")
23+
}
2224
}
2325
}
2426

2527
kotlin {
2628
jvm()
2729
js { nodejs() }
2830
js("jsIR", IR) { nodejs() }
29-
if (HostManager.hostIsLinux) linuxX64("native") { configureTarget() }
30-
if (HostManager.hostIsMingw) mingwX64("native") { configureTarget() }
31-
if (HostManager.hostIsMac) macosX64("native") { configureTarget() }
31+
if (providers.gradleProperty("enableNativeTargets").isPresent) {
32+
if (HostManager.hostIsLinux) linuxX64("native") { configureTarget() }
33+
if (HostManager.hostIsMingw) mingwX64("native") { configureTarget() }
34+
if (HostManager.hostIsMac) macosX64("native") { configureTarget() }
35+
}
3236

3337
sourceSets["commonMain"].dependencies {
3438
implementation(project(":"))

build.gradle.kts

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import com.vanniktech.maven.publish.KotlinMultiplatform
33
import org.gradle.api.tasks.testing.Test
44
import org.gradle.api.tasks.testing.logging.TestLogEvent
55
import org.gradle.kotlin.dsl.withType
6+
import org.jetbrains.kotlin.konan.target.HostManager
67

78
plugins {
89
alias(libs.plugins.kotlinMultiplatform)
@@ -72,25 +73,31 @@ kotlin {
7273
}
7374
}
7475
}
75-
iosX64()
76-
iosArm32()
77-
iosArm64()
78-
tvosX64()
79-
tvosArm64()
80-
watchosX86()
81-
watchosX64()
82-
watchosArm32()
83-
watchosArm64()
84-
macosX64()
85-
mingwX86()
86-
mingwX64()
87-
linuxX64()
88-
macosArm64()
89-
iosSimulatorArm64()
90-
watchosSimulatorArm64()
91-
tvosSimulatorArm64()
92-
androidNativeArm32()
93-
androidNativeArm64()
76+
if (providers.gradleProperty("enableNativeTargets").isPresent) {
77+
if (HostManager.hostIsMac) {
78+
iosX64()
79+
iosArm32()
80+
iosArm64()
81+
tvosX64()
82+
tvosArm64()
83+
watchosX86()
84+
watchosX64()
85+
watchosArm32()
86+
watchosArm64()
87+
macosX64()
88+
macosArm64()
89+
iosSimulatorArm64()
90+
watchosSimulatorArm64()
91+
tvosSimulatorArm64()
92+
}
93+
if (HostManager.hostIsMingw) {
94+
mingwX86()
95+
mingwX64()
96+
}
97+
linuxX64()
98+
androidNativeArm32()
99+
androidNativeArm64()
100+
}
94101

95102
sourceSets {
96103
getByName("commonTest") {
@@ -104,7 +111,6 @@ kotlin {
104111

105112
tasks.withType<Test>().configureEach {
106113
testLogging { events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) }
107-
doNotTrackState("Prevent caching of tests so they are always executed")
108114
}
109115

110116
signing {

sample/build.gradle.kts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithHostTests
2+
import org.jetbrains.kotlin.konan.target.HostManager
23

34
plugins {
45
application
@@ -22,10 +23,11 @@ kotlin {
2223
}
2324
}
2425
}
25-
ios()
26-
linuxX64 { configureTarget() }
27-
mingwX64 { configureTarget() }
28-
macosX64 { configureTarget() }
26+
if (providers.gradleProperty("enableNativeTargets").isPresent) {
27+
if (HostManager.hostIsLinux) linuxX64 { configureTarget() }
28+
if (HostManager.hostIsMingw) mingwX64 { configureTarget() }
29+
if (HostManager.hostIsMac) macosX64 { configureTarget() }
30+
}
2931

3032
sourceSets { sourceSets["commonMain"].apply { dependencies { implementation(project(":")) } } }
3133
}

0 commit comments

Comments
 (0)