diff --git a/README.md b/README.md
index f6d1084..b1e2f7b 100644
--- a/README.md
+++ b/README.md
@@ -97,7 +97,7 @@ classDef andNode fill:#baffc9,color:#333333;
classDef javaNode fill:#ffb3ba,color:#333333;
%% Modules
-subgraph
+subgraph
direction LR;
:example:feature{{:example:feature}}:::javaNode;
:example:models{{:example:models}}:::javaNode;
@@ -132,7 +132,7 @@ classDef andNode fill:#baffc9,color:#333333;
classDef javaNode fill:#ffb3ba,color:#333333;
%% Modules
-subgraph
+subgraph
direction LR;
:example:data{{:example:data}}:::javaNode;
:example:domain[:example:domain]:::javaNode;
@@ -173,4 +173,4 @@ Feel free to open a issue or submit a pull request for any bugs/improvements.
## License 📄
-This template is licensed under the MIT License - see the [License](License) file for details.
+This template is licensed under the MIT License - see the [License](License) file for details.
\ No newline at end of file
diff --git a/plugin-build/gradle.properties b/plugin-build/gradle.properties
index 14d60f4..15804a0 100644
--- a/plugin-build/gradle.properties
+++ b/plugin-build/gradle.properties
@@ -1,5 +1,5 @@
ID=io.github.adityabhaskar.dependencygraph
-VERSION=0.1.6
+VERSION=0.2.0
GROUP=io.github.adityabhaskar
DISPLAY_NAME=Gradle module dependency graphs
DESCRIPTION=A plugin to automatically produce Github/mermaid compatible dependency graphs
diff --git a/plugin-build/plugin/src/main/kotlin/io/github/adityabhaskar/dependencygraph/plugin/core/DrawGraph.kt b/plugin-build/plugin/src/main/kotlin/io/github/adityabhaskar/dependencygraph/plugin/core/DrawGraph.kt
index cc094c9..9150ed5 100644
--- a/plugin-build/plugin/src/main/kotlin/io/github/adityabhaskar/dependencygraph/plugin/core/DrawGraph.kt
+++ b/plugin-build/plugin/src/main/kotlin/io/github/adityabhaskar/dependencygraph/plugin/core/DrawGraph.kt
@@ -48,14 +48,24 @@ internal fun drawDependencyGraph(
var fileText = """
```mermaid
- %%{ init: { 'theme': 'base' } }%%
+ %%{
+ init: {
+ "theme": "base",
+ "themeVariables": {
+ "nodeTextColor": "#333333",
+ "clusterBorder": "#a0a0a0",
+ "nodeBorder": "#767676"
+ }
+ }
+ }%%
+
graph LR;
%% Styling for module nodes by type
classDef rootNode stroke-width:4px;
- classDef mppNode fill:#ffd2b3,color:#333333;
- classDef andNode fill:#baffc9,color:#333333;
- classDef javaNode fill:#ffb3ba,color:#333333;
+ classDef mppNode fill:#ffd2b3;
+ classDef andNode fill:#baffc9;
+ classDef javaNode fill:#ffb3ba;
$legendText
%% Modules
@@ -78,7 +88,7 @@ internal fun drawDependencyGraph(
var rootMap = mutableMapOf()
for (project in relevantProjects) {
- rootMap = mapProjectListToGroups(
+ rootMap = groupSubModules(
currentPath = "",
project = project,
remainingPath = project.path,
@@ -122,10 +132,10 @@ internal fun drawDependencyGraph(
val isDirectDependency = origin == currentProject
val arrow = when {
- isApi && isDirectDependency -> ConnecterType.DirectApi
- isApi -> ConnecterType.IndirectApi
- isDirectDependency -> ConnecterType.Direct
- else -> ConnecterType.Indirect
+ isApi && isDirectDependency -> ConnectorType.DirectApi
+ isApi -> ConnectorType.IndirectApi
+ isDirectDependency -> ConnectorType.Direct
+ else -> ConnectorType.Indirect
}
fileText += "${origin.path}${arrow}${target.path}\n"
}
@@ -290,7 +300,7 @@ private data class ProjectOrSubMap(
}
}
-private fun mapProjectListToGroups(
+private fun groupSubModules(
currentPath: String,
project: ModuleProject,
remainingPath: String,
@@ -319,7 +329,7 @@ private fun mapProjectListToGroups(
} else {
"$currentPath:${nextPath[0]}"
}
- val subMap = mapProjectListToGroups(
+ val subMap = groupSubModules(
currentPath = key,
project = project,
remainingPath = nowRemainingPath,
@@ -330,6 +340,13 @@ private fun mapProjectListToGroups(
}
}
+@Suppress("UnusedPrivateMember")
+private fun mapProjectListToGroups() {
+ // TODO: 04/08/2023 When encountering a sub project, add it to a list but only record parent
+ // folder name Then when drawing dependencies, check the list and draw it to parent folder
+ // when sub project falls under it
+}
+
/**
* Returns a list of all modules that are direct or indirect dependencies of the provided module.
* @param currentProjectAndDependencies the module(s) whose dependencies we need
@@ -403,7 +420,7 @@ private object NodeClass {
const val Java = ":::javaNode"
}
-private object ConnecterType {
+private object ConnectorType {
const val DirectApi = "==API===>"
const val IndirectApi = "--API--->"
const val Direct = "===>"