Skip to content

Commit

Permalink
Improve module dependency report
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelprinz committed Jan 31, 2025
1 parent 0cc8bf2 commit 5775401
Showing 1 changed file with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,24 @@ fun isNonStable(version: String): Boolean {
return isStable.not()
}

fun isSpringManaged(candidate: ModuleComponentIdentifier, currentVersion: String): Boolean =
candidate.version != currentVersion && candidate.group in setOf(
"com.fasterxml.jackson.core",
"com.fasterxml.jackson.datatype",
"com.fasterxml.jackson.module",
"jakarta.persistence",
"jakarta.validation",
"org.apache.tomcat.embed",
"org.hamcrest",
"org.liquibase",
"org.neo4j.driver",
"org.slf4j",
)
fun isSpringManaged(
candidate: ModuleComponentIdentifier,
currentVersion: String,
): Boolean =
candidate.version != currentVersion &&
candidate.group in
setOf(
"com.fasterxml.jackson.core",
"com.fasterxml.jackson.datatype",
"com.fasterxml.jackson.module",
"jakarta.persistence",
"jakarta.validation",
"org.apache.tomcat.embed",
"org.hamcrest",
"org.liquibase",
"org.neo4j.driver",
"org.slf4j",
)

// Module Graph plugin configuration

Expand All @@ -61,16 +66,19 @@ val convertModuleGraphCodeBlockToStandaloneFile by tasks.registering {
mustRunAfter(tasks.named("createModuleGraph"))
doLast {
val outputFile = File(modulesFile)
val content = outputFile.readText()
val content = outputFile.readText().lineSequence()
val asciidocContent =
content
// Remove Markdown code blocks
.replace("```mermaid", "")
.replace("```", "")
.filterNot { it.startsWith("```mermaid") }
.filterNot { it.startsWith("```") }
// Filter root module, because it connects to everything and gives no information
.filterNot { it.contains(": --> :") }
// Work-around for "graph" being a reserved word, which leads to parsing errors
.replace(":g", ":G")
.map { it.replace(":g", ":G") }
// Remove emtpy lines at the top of the file
.replace("^\\s+".toRegex(), "")
.filter { it.isNotBlank() }
.joinToString("\n")
outputFile.writeText(asciidocContent)
}
}
Expand Down

0 comments on commit 5775401

Please sign in to comment.