feat(build): add module dependency graph generation#4042
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4042 +/- ##
=====================================
Coverage 0.60% 0.60%
=====================================
Files 406 406
Lines 24283 24283
Branches 3121 3121
=====================================
Hits 148 148
Misses 24112 24112
Partials 23 23 ☔ View full report in Codecov by Sentry. |
a0a7609 to
a7af838
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces automated module dependency graph generation using Gradle tasks and Mermaid diagrams. The changes replace the removed dependency-analysis plugin with a custom solution that generates and maintains visual dependency graphs in module README files.
Key changes:
- New
Graph.ktconvention plugin createsgraphDumpandgraphUpdateGradle tasks to generate Mermaid dependency graphs - Package namespace refactored from
com.geeksville.mesh.buildlogictoorg.meshtastic.buildlogicacross all build-logic files - README.md files added to all modules containing auto-generated dependency graphs with collapsible legends
Reviewed changes
Copilot reviewed 47 out of 48 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/Graph.kt | New file implementing dependency graph generation logic with Mermaid syntax |
| build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/ProjectExtensions.kt | New file with utility extensions for accessing version catalog and config properties |
| build-logic/convention/src/main/kotlin/com/geeksville/mesh/buildlogic/ProjectExtensions.kt | Replaced with RootConventionPlugin to configure graph tasks on all subprojects |
| build-logic/convention/build.gradle.kts | Updated group name and registered new root convention plugin |
| gradle/libs.versions.toml | Removed dependency-analysis plugin, added meshtastic-root plugin |
| build.gradle.kts | Removed dependency-analysis configuration, applied meshtastic-root plugin |
| .github/workflows/scheduled-updates.yml | Added graphUpdate task to scheduled workflow |
| Multiple build-logic files | Refactored package names from com.geeksville.mesh.buildlogic to org.meshtastic.buildlogic |
| Multiple module README.md files | Added with generated dependency graphs |
| mesh_service_example/build.gradle.kts | Updated imports and changed android block to configure |
| app/build.gradle.kts | Refactored to use configProperties extension and configure |
Comments suppressed due to low confidence (1)
gradle/libs.versions.toml:1
- Commented-out code should be removed entirely rather than left as a comment. Since this plugin has been removed as part of the PR's purpose, the line should be deleted completely.
| @@ -0,0 +1,17 @@ | |||
| # `${projectPath.get()}` | |||
There was a problem hiding this comment.
The README contains unprocessed template variables. This appears to be a template file that should have been processed by the graphUpdate task but wasn't. The file should either be regenerated or removed.
| (this as ExtensionAware).extensions.configure<KotlinMultiplatformAndroidLibraryTarget>("android") { | ||
| compileSdk = this@with.configProperties.getProperty("COMPILE_SDK").toInt() | ||
| minSdk = this@with.configProperties.getProperty("MIN_SDK").toInt() |
There was a problem hiding this comment.
The nested scope references (this@with) and type cast make this code difficult to read. Consider extracting the android configuration to a separate variable or using a more explicit scope reference.
|
|
||
| package org.meshtastic.buildlogic | ||
|
|
||
| import com.android.utils.associateWithNotNull |
There was a problem hiding this comment.
Using an internal Android utility function (com.android.utils.associateWithNotNull) creates a dependency on Android internal APIs that may change without notice. Consider implementing this function locally or using standard Kotlin collection operations.
This commit introduces a new Gradle task to automatically generate and update module dependency graphs. Key changes: - A new `Graph.kt` convention plugin is added to the `build-logic` to handle graph generation using Mermaid syntax. - `graphDump` and `graphUpdate` tasks are created. `graphUpdate` is added to the `AndroidLibraryConventionPlugin` and `AndroidApplicationConventionPlugin`. - `README.md` files are added to most modules to display the generated dependency graphs. - The scheduled updates workflow is updated to run the `graphUpdate` task, ensuring the graphs are kept current. - The `dependency-analysis` plugin has been removed. - Refactored build scripts to use the `org.meshtastic` package name and improve Gradle configuration logic. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
a7af838 to
e5eceba
Compare
This commit introduces a new Gradle task to automatically generate and update module dependency graphs.
Key changes:
Graph.ktconvention plugin is added to thebuild-logicto handle graph generation using Mermaid syntax.graphDumpandgraphUpdatetasks are created.graphUpdateis added to theAndroidLibraryConventionPluginandAndroidApplicationConventionPlugin.README.mdfiles are added to most modules to display the generated dependency graphs.graphUpdatetask, ensuring the graphs are kept current.dependency-analysisplugin has been removed.org.meshtasticpackage name and improve Gradle configuration logic.