modules-graph-assert icon indicating copy to clipboard operation
modules-graph-assert copied to clipboard

Not all modules are detected at once

Open haluzpav opened this issue 2 years ago • 7 comments

I have a project with about 100 modules. When running your plugin on the root app module it doesn't see all modules.

My setup:

app/build.gradle.kts:

plugins {
    // ...
    id("com.jraska.module.graph.assertion") version "2.4.1"
}
// no custom configuration in moduleGraphAssert
dependencies {
    implementation(project(":amount"))
    // ...
}

core/build.gradle.kts:

plugins {
    // ...
    id("com.jraska.module.graph.assertion") version "2.4.1"
}
// no custom configuration in moduleGraphAssert
dependencies {
    api(project(":tools"))
    // ...
}

Gradle version: 8.1.1

Actual

Output of ./gradlew generateModulesGraphStatistics --rerun-tasks:

...
> Task :app:generateModulesGraphStatistics
GraphStatistics(modulesCount=79, edgesCount=82, height=2, longestPath=':app -> :amount -> :core')

> Task :core:generateModulesGraphStatistics
GraphStatistics(modulesCount=7, edgesCount=6, height=1, longestPath=':core -> :tools')

Expected

From the longestPath, you can notice that app depends on core, and core depends on tools. But then the longest path of app should actually be longestPath=':app -> :amount -> :core -> :tools', no? (In my case, there should be also much longer chains, I just use output of the plugin here as an example.)

Notes

The other tasks seem to have the same problem. For example when I set moduleGraphAssert { maxHeight = 2 } and run assertModuleGraph, it doesn't fail.

It also doesn't change the output of app tasks when I remove the plugin from core module - I've added it there for debugging.

Switching api and implementation in various ways doesn't help either.

I have tested this also with org.gradle.configuration-cache=false in gradle.properties.

Let me know if you have any hint or you want more info. I can't share my project.

haluzpav avatar Jun 20 '23 11:06 haluzpav