Can't generate module graph
sureshg opened this issue · comments
Using the latest version of plugin in a kotlin multiplatform multi module project and createModuleGraph
task fails with the following error.
> Task :createModuleGraph FAILED
List contains no element matching the predicate.
java.util.NoSuchElementException: List contains no element matching the predicate.
at dev.iurysouza.modulegraph.graph.ExtKt.getProjectName(Ext.kt:16)
at dev.iurysouza.modulegraph.graph.DigraphBuilder.buildModel(DigraphBuilder.kt:46)
at dev.iurysouza.modulegraph.graph.DigraphBuilder.build(DigraphBuilder.kt:19)
at dev.iurysouza.modulegraph.Mermaid.generateGraph(Mermaid.kt:13)
at dev.iurysouza.modulegraph.gradle.CreateModuleGraphTask.execute(CreateModuleGraphTask.kt:91)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
Hey, @sureshg could you check if you're using any filters? For example:
excludedConfigurationsRegex.set(".*test.*")
excludedModulesRegex.set(".*moduleName.*")
focusedModulesRegex.set(".*(projectName).*")
These might be triggering the issue. I think in this case it's specifically the excludedModuleRegex
. I'll work on adding more explicit error messages for such scenarios too.
Thanks for looking into it. No, i haven't used any filters. Here is the only config that get added to the root project.
moduleGraphConfig {
readmePath = "./README.md"
heading = "### Module Dependency"
}
Interesting. Can please share the output of running
$ ./gradlew projects
from the root of your project?
> Task :projects
------------------------------------------------------------
Root project 'kotlin-mpp-app'
------------------------------------------------------------
Root project 'kotlin-mpp-app'
+--- Project ':backend'
| +--- Project ':backend:data' - Kotlin Data Science!
| +--- Project ':backend:jvm' - Ktor backend jvm application
| +--- Project ':backend:native' - Ktor native application
| +--- Project ':backend:profiling' - JVM Profiling and Monitoring!
| \--- Project ':backend:security' - Certificate and Security!
+--- Project ':benchmark' - Kotlin benchmarking tests
+--- Project ':dep-mgmt'
| +--- Project ':dep-mgmt:bom' - A platform (BOM) used to align all module versions
| \--- Project ':dep-mgmt:catalog' - Publish gradle version catalog!
+--- Project ':meta'
| +--- Project ':meta:compiler'
| | \--- Project ':meta:compiler:plugin' - Kotlin Compiler Plugin
| \--- Project ':meta:ksp'
| \--- Project ':meta:ksp:processor' - Kotlin KSP Processor
+--- Project ':shared' - Shared common module for all projects
\--- Project ':web'
+--- Project ':web:js' - Kotlin/JS Web application
\--- Project ':web:wasm' - WasmJS Web application
Included builds
\--- Included build ':build-logic'
i have the exact same problem in a multi-module android project
works fine if it included in a singular module, but when added in the project level gradle file this error happens
Hey @FreedomChuks & @sureshg , do you mind trying again on the latest version? 0.8.1
Cheers
Certainly
@iurysza it works now thanks