The README states:
If using only graph calls, then the Primary Graph doesn't need to be setup at all! You can see this in the samples above.
In practice (v0.13.0), the primary graph is always emitted — into the root README.md under # Module Graph —
even when the moduleGraphConfig block contains only graph calls and no top-level primary
properties.
Reproduction
plugins {
id("dev.iurysouza.modulegraph") version "0.13.0"
}
moduleGraphConfig {
graph(
readmePath = "./docs/MODULE_GRAPHS.md",
heading = "## My Custom Graph",
) {
orientation = Orientation.LEFT_TO_RIGHT
theme = Theme.NEUTRAL
rootModulesRegex = "^:app$"
}
}
Run ./gradlew createModuleGraph.
Expected: only docs/MODULE_GRAPHS.md is updated; README.md is untouched.
Actual: README.md is rewritten with a # Module Graph section containing the full project graph, in addition
to the configured docs/MODULE_GRAPHS.md output.
Root cause
In ModuleGraphPlugin.getPrimaryGraphConfig(), the primary readmePath and heading are read with fallback
defaults before the "any configured?" check:
val readmePath = task.readmePath.orNull
?: task.project.rootDir.resolve("README.md").absolutePath
val heading = task.heading.orNull ?: "# Module Graph"
// …
val params: List<Any?> = listOf(readmePath, heading, theme, orientation, …)
val hasPrimaryConfig = params.any { it != null }
if (!hasPrimaryConfig) return null
Because readmePath and heading are seeded with non-null defaults and then included in params, hasPrimaryConfig is always true. The "skip primary graph" branch is unreachable.
The README states:
In practice (v0.13.0), the primary graph is always emitted — into the root
README.mdunder# Module Graph—even when the
moduleGraphConfigblock contains onlygraphcalls and no top-level primaryproperties.
Reproduction
plugins { id("dev.iurysouza.modulegraph") version "0.13.0" } moduleGraphConfig { graph( readmePath = "./docs/MODULE_GRAPHS.md", heading = "## My Custom Graph", ) { orientation = Orientation.LEFT_TO_RIGHT theme = Theme.NEUTRAL rootModulesRegex = "^:app$" } }Run
./gradlew createModuleGraph.Expected: only
docs/MODULE_GRAPHS.mdis updated;README.mdis untouched.Actual:
README.mdis rewritten with a# Module Graphsection containing the full project graph, in additionto the configured
docs/MODULE_GRAPHS.mdoutput.Root cause
In
ModuleGraphPlugin.getPrimaryGraphConfig(), the primaryreadmePathand heading are read with fallbackdefaults before the "any configured?" check:
Because
readmePathandheadingare seeded with non-null defaults and then included in params,hasPrimaryConfigis always true. The "skip primary graph" branch is unreachable.