Skip to content

Enable default template hierarchy #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions examples/kotlin-multiplatform/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.konan.target.KonanTarget
import kotlinx.benchmark.gradle.JsBenchmarksExecutor

plugins {
Expand All @@ -23,10 +21,14 @@ kotlin {
compilations.create("builtInExecutor") { associateWith(compilations.main) }
}
wasm('wasmJs') { d8() }
if (HostManager.host == KonanTarget.MACOS_X64.INSTANCE) macosX64('native')
if (HostManager.host == KonanTarget.MACOS_ARM64.INSTANCE) macosArm64('native')
if (HostManager.hostIsLinux) linuxX64('native')
if (HostManager.hostIsMingw) mingwX64('native')

// Native targets
macosX64()
macosArm64()
linuxX64()
mingwX64()

applyDefaultHierarchyTemplate()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should strive that the project contains no custom dependsOn so that the template is applied automatically.


sourceSets.configureEach {
languageSettings {
Expand All @@ -50,9 +52,7 @@ kotlin {
jsBuiltInExecutor.dependsOn(it)
}

nativeMain {
dependsOn(commonMain)
}
nativeMain {}
}
}

Expand Down Expand Up @@ -121,6 +121,11 @@ benchmark {
jsBenchmarksExecutor = JsBenchmarksExecutor.BuiltIn
}
register("wasmJs")
register("native")

// Native targets
register("macosX64")
register("macosArm64")
register("linuxX64")
register("mingwX64")
}
}
60 changes: 26 additions & 34 deletions runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,40 @@ repositories {
}

kotlin {
infra {
// According to https://kotlinlang.org/docs/native-target-support.html
// According to https://kotlinlang.org/docs/native-target-support.html

// Tier 1
target("linuxX64")
// Tier 1
linuxX64()
macosX64()
macosArm64()
iosSimulatorArm64()
iosX64()

// Tier 2
target("linuxArm64")
// Tier 2
linuxArm64()
watchosSimulatorArm64()
watchosX64()
watchosArm32()
watchosArm64()
tvosSimulatorArm64()
tvosX64()
tvosArm64()
iosArm64()

// Tier 3
target("androidNativeArm32")
target("androidNativeArm64")
target("androidNativeX86")
target("androidNativeX64")
target("mingwX64")

common("darwin") {
// Tier 1
target("macosX64")
target("macosArm64")
target("iosSimulatorArm64")
target("iosX64")

// Tier 2
target("watchosSimulatorArm64")
target("watchosX64")
target("watchosArm32")
target("watchosArm64")
target("tvosSimulatorArm64")
target("tvosX64")
target("tvosArm64")
target("iosArm64")

// Tier 3
target("watchosDeviceArm64")
}
}
// Tier 3
androidNativeArm32()
androidNativeArm64()
androidNativeX86()
androidNativeX64()
mingwX64()
watchosDeviceArm64()

jvm()
js("jsIr", IR) { nodejs() }
wasm("wasmJs") { d8() }

applyDefaultHierarchyTemplate()

targets.configureEach {
compilations.configureEach {
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
Expand Down