Skip to content

Instantly share code, notes, and snippets.

@alllex
Last active January 23, 2024 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alllex/067d823b1cde0d651df7850892e85fe3 to your computer and use it in GitHub Desktop.
Save alllex/067d823b1cde0d651df7850892e85fe3 to your computer and use it in GitHub Desktop.
Gradle service graph visualization

Gradle service graph visualization

Branch: https://github.com/gradle/gradle/compare/alllex/service-registry-graph-tracing

On the branch, run any test, grep the test output for lines starting with YYY:. This provides a Mermaid diagram sources.

Caution

The graph is not correct, because it conflates nodes from different classloaders and processes

Embedded

Running: org.gradle.api.configuration.BuildFeaturesIntegrationTest#can inject service into project plugin

graph LR;

  sr1["Command-line logging (id=1)"]
  sr2["Native services (id=2)"]
  sr3["Validation services fixture (id=3)"]
  sr4["Global services (id=4)"]
  sr4 --> sr1
  sr4 --> sr2
  sr4 --> sr3
  sr5["cross session services (id=5)"]
  sr5 --> sr4
  sr6["services for Gradle user home dir /Users/asemin/projects/gradle/build-tool/core1/intTestHomeDir/distributions-jvm (id=6)"]
  sr6 --> sr4
  sr7["default services (id=7)"]
  sr8["registry with no services (id=8)"]
  sr9["build session services (id=9)"]
  sr9 --> sr6
  sr9 --> sr5
  sr10["build tree services (id=10)"]
  sr10 --> sr9
  sr11["Build scope services (id=11)"]
  sr11 --> sr10
  sr12["Gradle-scope services (id=12)"]
  sr12 --> sr11
  sr13["Dependency resolution services (id=13)"]
  sr13 --> sr11
  sr14["Settings services (id=14)"]
  sr14 --> sr11
  sr15["Script plugin services (id=15)"]
  sr15 --> sr11
  sr16["Dependency resolution services (id=16)"]
  sr16 --> sr11
  sr17["Project services (id=17)"]
  sr17 --> sr12
  sr18["Dependency resolution services (id=18)"]
  sr18 --> sr11
  sr19["Script plugin services (id=19)"]
  sr19 --> sr11
  sr20["Configured project services for ':' (id=20)"]
  sr20 --> sr17

Forking

Running: org.gradle.api.configuration.BuildFeaturesIntegrationTest#can inject service into project plugin

graph LR;

sr1["Command-line logging (id=1)"]
sr2["Native services (id=2)"]
sr3["Validation services fixture (id=3)"]
sr4["Global services (id=4)"]
sr4 --> sr1
sr4 --> sr2
sr4 --> sr3
sr1["Command-line logging (id=1)"]
sr2["Native services (id=2)"]
sr3["Basic global services (id=3)"]
sr3 --> sr1
sr3 --> sr2
sr4["Daemon client global services (id=4)"]
sr4 --> sr2
sr4 --> sr3
sr5["Logging services (id=5)"]
sr5 --> sr4
sr6["Build-client services (id=6)"]
sr6 --> sr5
sr4["cross session services (id=4)"]
sr4 --> sr3
sr5["services for Gradle user home dir /Users/asemin/projects/gradle/build-tool/core1/intTestHomeDir/distributions-jvm (id=5)"]
sr5 --> sr3
sr6["default services (id=6)"]
sr7["registry with no services (id=7)"]
sr8["build session services (id=8)"]
sr8 --> sr5
sr8 --> sr4
sr9["build tree services (id=9)"]
sr9 --> sr8
sr10["Build scope services (id=10)"]
sr10 --> sr9
sr11["Gradle-scope services (id=11)"]
sr11 --> sr10
sr12["Dependency resolution services (id=12)"]
sr12 --> sr10
sr13["Settings services (id=13)"]
sr13 --> sr10
sr14["Script plugin services (id=14)"]
sr14 --> sr10
sr15["Dependency resolution services (id=15)"]
sr15 --> sr10
sr16["Project services (id=16)"]
sr16 --> sr11
sr17["Dependency resolution services (id=17)"]
sr17 --> sr10
sr18["Script plugin services (id=18)"]
sr18 --> sr10
sr19["Configured project services for ':' (id=19)"]
sr19 --> sr16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment