K
Kord•5mo ago
Tic

Support of native targets (not Discord bot)

Hello I tried to add the support of native targets (not for my discord bot), so I have: (code in comment) However, I have the following error:
KotlinSourceSet with name 'nativeTest' not found.
KotlinSourceSet with name 'nativeTest' not found.
Do you have an idea why I have this error. That's not appears with the code applied:
when {
isMacOs && isArm64 -> macosArm64("native")
isMacOs && !isArm64 -> macosX64("native")
isLinux && isArm64 -> linuxArm64("native")
isLinux && !isArm64 -> linuxX64("native")
isWindows -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
when {
isMacOs && isArm64 -> macosArm64("native")
isMacOs && !isArm64 -> macosX64("native")
isLinux && isArm64 -> linuxArm64("native")
isLinux && !isArm64 -> linuxX64("native")
isWindows -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
3 Replies
Tic
TicOP•5mo ago
vyfor
vyfor•5mo ago
i usually do
val nativeTest by creating {}
val mingwX64Test by getting {
dependsOn(nativeTest)
}
val linuxArm64Test by getting {
dependsOn(nativeTest)
}
val linuxX64Test by getting {
dependsOn(nativeTest)
}
val macosArm64Test by getting {
dependsOn(nativeTest)
}
val macosX64Test by getting {
dependsOn(nativeTest)
}
/* ... */
val nativeTest by creating {}
val mingwX64Test by getting {
dependsOn(nativeTest)
}
val linuxArm64Test by getting {
dependsOn(nativeTest)
}
val linuxX64Test by getting {
dependsOn(nativeTest)
}
val macosArm64Test by getting {
dependsOn(nativeTest)
}
val macosX64Test by getting {
dependsOn(nativeTest)
}
/* ... */
Tic
TicOP•5mo ago
Ok thanks that works But I have this warning:
w: Please choose a JavaScript environment to build distributions and run tests.
Not choosing any of them will be an error in the future releases.
kotlin {
js {
// To build distributions for and run tests on browser or Node.js use one or both of:
browser()
nodejs()
}
}
w: Please choose a JavaScript environment to build distributions and run tests.
Not choosing any of them will be an error in the future releases.
kotlin {
js {
// To build distributions for and run tests on browser or Node.js use one or both of:
browser()
nodejs()
}
}
And this is my code:
js {
nodejs()
binaries.library()
useCommonJs()
generateTypeScriptDefinitions()
}
wasmJs()
js {
nodejs()
binaries.library()
useCommonJs()
generateTypeScriptDefinitions()
}
wasmJs()
So that's not p ossible to have nodejs & wasmJs 🤔 ? Well
fun KotlinJsTargetDsl.jsAndWasmSharedConfigurationTarget() {
nodejs()
binaries.library()
useCommonJs()
generateTypeScriptDefinitions()
}
js {
jsAndWasmSharedConfigurationTarget()
}
wasmJs {
jsAndWasmSharedConfigurationTarget()
}
fun KotlinJsTargetDsl.jsAndWasmSharedConfigurationTarget() {
nodejs()
binaries.library()
useCommonJs()
generateTypeScriptDefinitions()
}
js {
jsAndWasmSharedConfigurationTarget()
}
wasmJs {
jsAndWasmSharedConfigurationTarget()
}
fixed the warning
Want results from more Discord servers?
Add your server