axeon
05/14/2024, 11:13 AMFAILURE: Build failed with an exception.
* What went wrong:
Circular dependency between the following tasks:
:compileJava
\--- :compileKotlinJvm
\--- :kspCommonMainKotlinMetadata
+--- :jvmJar
| +--- :compileJava (*)
| +--- :compileKotlinJvm (*)
| \--- :jvmMainClasses
| +--- :compileJava (*)
| \--- :compileKotlinJvm (*)
\--- :ksp:jvmJar
+--- :ksp:compileJava
| +--- :jvmJar (*)
| \--- :ksp:compileKotlinJvm
| \--- :jvmJar (*)
+--- :ksp:compileKotlinJvm (*)
\--- :ksp:jvmMainClasses
+--- :ksp:compileJava (*)
\--- :ksp:compileKotlinJvm (*)
(*) - details omitted (listed previously)
axeon
05/14/2024, 11:14 AMaxeon
05/14/2024, 11:17 AMplugins {
kotlin("multiplatform") version "1.9.22"
id("com.google.devtools.ksp") version "1.9.22-1.0.18"
/* ... */
}
repositories {
/* ... */
}
kotlin {
jvm {
withJava()
compilations.all {
kotlinOptions.jvmTarget = "17"
}
} // i'm unsure whether i need to add jvm as a target in order for ksp to work. project does not rely on jvm
val mingwTarget = mingwX64()
sourceSets {
val commonMain by getting {
kotlin.srcDir("build/generated/ksp/commonMain/kotlin")
dependencies {
implementation("dev.kord:kord-core:feature-native-SNAPSHOT")
}
}
mingwTarget.apply {
compilations["main"].defaultSourceSet.apply {
dependsOn(commonMain)
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
if (name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
}
}
dependencies {
add("kspCommonMainMetadata", project(":ksp"))
}
axeon
05/14/2024, 11:18 AM:ksp
submodule build file:
plugins {
kotlin("multiplatform") version "1.9.22"
}
repositories {
mavenCentral()
}
kotlin {
jvm {
withJava()
compilations.all {
kotlinOptions.jvmTarget = "17"
}
}
sourceSets {
val jvmMain by getting {
dependencies {
implementation("com.google.devtools.ksp:symbol-processing-api:1.9.22-1.0.18")
implementation("com.squareup:kotlinpoet:1.16.0")
implementation("com.squareup:kotlinpoet-ksp:1.16.0")
implementation(project(":"))
}
kotlin.srcDir("src/jvmMain/kotlin")
resources.srcDir("src/jvmMain/resources")
}
}
}
Vampire
05/14/2024, 12:28 PMimplementation(project(":"))
.
If you need the :ksp
result to compile :
but :ksp
needs :
to compile, you are in chicken-and-egg situation.axeon
05/14/2024, 1:01 PMVampire
05/14/2024, 1:02 PMephemient
05/14/2024, 3:52 PM