iurysza / module-graph

A Gradle Plugin for visualizing your project's structure, powered by mermaidjs

Home Page:https://plugins.gradle.org/plugin/dev.iurysouza.modulegraph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty generated graph

ferinagy opened this issue · comments

After applying the plugin (version 0.4.0) to our project, the createModuleGraph task runs successfully, but the created graph is empty. I have seen #10 and in our case ./gradlew projects gives output of 100+ projects.

This is currently created graph:

### Dependency Diagram

```mermaid
%%{
  init: {
    'theme': 'dark'
  }
}%%

graph TB


```

I tried looking into the issue a bit and it seems that the parseProjectStructure() method is called before the projects are configured, so sourceProject.configurations is empty at the time.

Interesting!
The parseProjectStructure() call happens only when the apply method is called, but by this time the project configuration has already happened.

Can you maybe describe what your project looks like?
For reference, I'm using this plugin on a multimodule project setup here. Perhaps it's useful for you to take a look and see what might be causing this.

I managed to track this down to this block in our root project:

allprojects {
    project.tasks.all {

    }
}

If I add it to the sample module, it also creates an empty graph. It appears to affect the order in which the projects are configured. Same seems to happen with the --configure-on-demand option.

I also had this issue and I tried commenting out all allprojects blocks from root build.gradle.kts file since these are only used to configure ktlint, detekt and other similar tools for all modules.

Once I did that, the plugin worked :)
Hope that helps!