jean
11/15/2023, 8:02 PMA problem occurred configuring project ':logic'.
> Could not create task ':logic:compileKotlinIosArm64'.
> Task with name 'kspCommonMainKotlinMetadata' not found in project ':logic'.
logic
is the name of my module. I did work all good when I had a single module structure.
I did add the plugins the same way it’s done hete https://github.com/google/ksp/blob/main/examples/multiplatform/workload/build.gradle.kts
Any idea how I can fix this?Ting-Yuan Huang
11/15/2023, 8:54 PMTaskCollection.getByName
?
https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskCollection.htmljean
11/15/2023, 8:57 PMdependencies {
add("kspCommonMainMetadata", "com.jeantuffier.statemachine:processor:$stateMachineVersion")
}
Ting-Yuan Huang
11/15/2023, 9:16 PMjean
11/16/2023, 7:31 AMtasks.withType<KotlinNativeCompile>().configureEach {
dependsOn(tasks.named("kspCommonMainKotlinMetadata"))
}
I did add a bunch of similar tasks because the compiler was asking for it a while agodependencies {
add("kspCommonMainMetadata", "com.jeantuffier.statemachine:processor:$stateMachineVersion")
}
tasks.named("build") {
dependsOn(tasks.named("kspCommonMainKotlinMetadata"))
}
tasks.withType<KotlinCompile>().configureEach {
dependsOn(tasks.named("kspCommonMainKotlinMetadata"))
}
tasks.withType<KotlinNativeCompile>().configureEach {
dependsOn(tasks.named("kspCommonMainKotlinMetadata"))
}
tasks.named("compileKotlinJvm") {
dependsOn(tasks.named("kspCommonMainKotlinMetadata"))
}
tasks.named("jvmSourcesJar") {
dependsOn(tasks.named("kspCommonMainKotlinMetadata"))
}
tasks.named("sourcesJar") {
dependsOn(tasks.named("kspCommonMainKotlinMetadata"))
}
Ting-Yuan Huang
11/16/2023, 4:40 PMjean
11/16/2023, 7:31 PM* What went wrong:
A problem was found with the configuration of task ':logic:compileDebugKotlinAndroid' (type 'KotlinCompile').
- Gradle detected a problem with the following location: '.../logic/build/generated/ksp/metadata/commonMain/kotlin'.
Reason: Task ':logic:compileDebugKotlinAndroid' uses this output of task ':logic:kspCommonMainKotlinMetadata' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':logic:kspCommonMainKotlinMetadata' as an input of ':logic:compileDebugKotlinAndroid'.
2. Declare an explicit dependency on ':logic:kspCommonMainKotlinMetadata' from ':logic:compileDebugKotlinAndroid' using Task#dependsOn.
3. Declare an explicit dependency on ':logic:kspCommonMainKotlinMetadata' from ':logic:compileDebugKotlinAndroid' using Task#mustRunAfter.
For more information, please refer to <https://docs.gradle.org/8.2/userguide/validation_problems.html#implicit_dependency> in the Gradle documentation.
I’ll add logic:
to all the tasks and see if it fixes the issuetasks.named(":logic:compileDebugKotlinAndroid") {
dependsOn(tasks.named(":logic:kspCommonMainKotlinMetadata"))
}
as suggested in Declare an explicit dependency on ':logic:kspCommonMainKotlinMetadata' from ':logic:compileDebugKotlinAndroid' using Task#dependsOn
I get the following error