Skip to content

Commit 5ced00f

Browse files
committed
Use @ instead of / as separator when including versions in the graph
1 parent e3f39a3 commit 5ced00f

13 files changed

+410
-407
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
* All nodes of the graph can now contain clickable links to their corresponding nuget.org page. This new behavior can be enabled by setting the `ChiselGraphIncludeLinks` MSBuild property to `true`. See the [ChiselGraphIncludeLinks](https://github.com/0xced/Chisel#chiselgraphincludelinks) documentation in the README for more information.
1010
* The graph now includes a title that defaults to `Dependency graph of $(MSBuildProjectName) ($(TargetFramework))`. See the [ChiselGraphTitle](https://github.com/0xced/Chisel#chiselgraphtitle) documentation in the README for more information.
11+
* The version numbers in the graph are now displayed with a `@` symbol instead of a `/` symbol when [ChiselGraphIncludeVersions](https://github.com/0xced/Chisel#chiselgraphincludeversions) is enabled.
1112

1213
## [1.1.2][1.1.2] - 2025-02-17
1314

README.md

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -100,41 +100,41 @@ classDef root stroke-width:4px
100100
classDef default fill:aquamarine,stroke:#009061,color:#333333
101101
classDef removed fill:lightcoral,stroke:#A42A2A
102102
103-
AWSSDK.SecurityToken/3.7.100.14 --> AWSSDK.Core/3.7.100.14
104-
DnsClient/1.6.1 --> Microsoft.Win32.Registry/5.0.0
105-
Microsoft.Win32.Registry/5.0.0 --> System.Security.AccessControl/5.0.0
106-
Microsoft.Win32.Registry/5.0.0 --> System.Security.Principal.Windows/5.0.0
107-
MongoDB.Bson/2.30.0 --> System.Runtime.CompilerServices.Unsafe/5.0.0
108-
MongoDB.Driver/2.30.0{{MongoDB.Driver/2.30.0}} --> Microsoft.Extensions.Logging.Abstractions/6.0.4
109-
MongoDB.Driver/2.30.0 --> MongoDB.Bson/2.30.0
110-
MongoDB.Driver/2.30.0 --> MongoDB.Driver.Core/2.30.0
111-
MongoDB.Driver/2.30.0 --> MongoDB.Libmongocrypt/1.12.0
112-
MongoDB.Driver.Core/2.30.0 --> AWSSDK.SecurityToken/3.7.100.14
113-
MongoDB.Driver.Core/2.30.0 --> DnsClient/1.6.1
114-
MongoDB.Driver.Core/2.30.0 --> Microsoft.Extensions.Logging.Abstractions/6.0.4
115-
MongoDB.Driver.Core/2.30.0 --> MongoDB.Bson/2.30.0
116-
MongoDB.Driver.Core/2.30.0 --> MongoDB.Libmongocrypt/1.12.0
117-
MongoDB.Driver.Core/2.30.0 --> SharpCompress/0.30.1
118-
MongoDB.Driver.Core/2.30.0 --> Snappier/1.0.0
119-
MongoDB.Driver.Core/2.30.0 --> ZstdSharp.Port/0.7.3
120-
System.Security.AccessControl/5.0.0 --> System.Security.Principal.Windows/5.0.0
121-
122-
class AWSSDK.Core/3.7.100.14 removed
123-
class AWSSDK.SecurityToken/3.7.100.14 removed
124-
class DnsClient/1.6.1 default
125-
class Microsoft.Extensions.Logging.Abstractions/6.0.4 default
126-
class Microsoft.Win32.Registry/5.0.0 default
127-
class MongoDB.Bson/2.30.0 default
128-
class MongoDB.Driver/2.30.0 root
129-
class MongoDB.Driver/2.30.0 default
130-
class MongoDB.Driver.Core/2.30.0 default
131-
class MongoDB.Libmongocrypt/1.12.0 default
132-
class SharpCompress/0.30.1 default
133-
class Snappier/1.0.0 default
134-
class System.Runtime.CompilerServices.Unsafe/5.0.0 default
135-
class System.Security.AccessControl/5.0.0 default
136-
class System.Security.Principal.Windows/5.0.0 default
137-
class ZstdSharp.Port/0.7.3 default
103+
AWSSDK.SecurityToken[AWSSDK.SecurityToken#64;3.7.100.14] --> AWSSDK.Core[AWSSDK.Core#64;3.7.100.14]
104+
DnsClient[DnsClient#64;1.6.1] --> Microsoft.Win32.Registry[Microsoft.Win32.Registry#64;5.0.0]
105+
Microsoft.Win32.Registry --> System.Security.AccessControl[System.Security.AccessControl#64;5.0.0]
106+
Microsoft.Win32.Registry --> System.Security.Principal.Windows[System.Security.Principal.Windows#64;5.0.0]
107+
MongoDB.Bson[MongoDB.Bson#64;2.30.0] --> System.Runtime.CompilerServices.Unsafe[System.Runtime.CompilerServices.Unsafe#64;5.0.0]
108+
MongoDB.Driver{{MongoDB.Driver#64;2.30.0}} --> Microsoft.Extensions.Logging.Abstractions[Microsoft.Extensions.Logging.Abstractions#64;2.0.0]
109+
MongoDB.Driver --> MongoDB.Bson
110+
MongoDB.Driver --> MongoDB.Driver.Core[MongoDB.Driver.Core#64;2.30.0]
111+
MongoDB.Driver --> MongoDB.Libmongocrypt[MongoDB.Libmongocrypt#64;1.12.0]
112+
MongoDB.Driver.Core --> AWSSDK.SecurityToken
113+
MongoDB.Driver.Core --> DnsClient
114+
MongoDB.Driver.Core --> Microsoft.Extensions.Logging.Abstractions
115+
MongoDB.Driver.Core --> MongoDB.Bson
116+
MongoDB.Driver.Core --> MongoDB.Libmongocrypt
117+
MongoDB.Driver.Core --> SharpCompress[SharpCompress#64;0.30.1]
118+
MongoDB.Driver.Core --> Snappier[Snappier#64;1.0.0]
119+
MongoDB.Driver.Core --> ZstdSharp.Port[ZstdSharp.Port#64;0.7.3]
120+
System.Security.AccessControl --> System.Security.Principal.Windows
121+
122+
class AWSSDK.Core removed
123+
class AWSSDK.SecurityToken removed
124+
class DnsClient default
125+
class Microsoft.Extensions.Logging.Abstractions default
126+
class Microsoft.Win32.Registry default
127+
class MongoDB.Bson default
128+
class MongoDB.Driver root
129+
class MongoDB.Driver default
130+
class MongoDB.Driver.Core default
131+
class MongoDB.Libmongocrypt default
132+
class SharpCompress default
133+
class Snappier default
134+
class System.Runtime.CompilerServices.Unsafe default
135+
class System.Security.AccessControl default
136+
class System.Security.Principal.Windows default
137+
class ZstdSharp.Port default
138138
```
139139

140140
Now, both `AWSSDK.Core.dll` and `AWSSDK.SecurityToken.dll` have disappeared from the build output.
@@ -338,7 +338,7 @@ To enable links, set the `ChiselGraphIncludeLinks` property to `true`.
338338

339339
defaults to `false`
340340

341-
Controls whether the dependency graph nodes are named `{package}` or `{package}/{version}`.
341+
Controls whether the dependency graph nodes are named `{package}` or `{package}@{version}`.
342342

343343
Example with `ChiselGraphIncludeVersions` set to `false`
344344

@@ -353,7 +353,7 @@ Example with `ChiselGraphIncludeVersions` set to `true`
353353
```mermaid
354354
graph LR
355355
classDef default fill:aquamarine,stroke:#009061,color:#333333
356-
Serilog.Sinks.File/5.0.0 --> Serilog/2.10.0
356+
Serilog.Sinks.File[Serilog.Sinks.File#64;5.0.0] --> Serilog[Serilog#64;2.10.0]
357357
```
358358

359359
### `ChiselGraphIgnore`

src/Chisel/GraphWriter.Graphviz.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ protected override void WriteEdge(Package package, Package dependency, GraphOpti
8484
Writer.WriteLine($" \"{GetPackageId(package, options)}\" -> \"{GetPackageId(dependency, options)}\"");
8585
}
8686

87+
private static string GetPackageId(Package package, GraphOptions options) => options.IncludeVersions ? $"{package.Name}@{package.Version}" : package.Name;
88+
8789
private static string Color(Color color)
8890
{
8991
var colorDefinition = $"fillcolor = {Fill(color)}, color = {Stroke(color)}";

src/Chisel/GraphWriter.Mermaid.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Chisel;
55

66
internal sealed class MermaidWriter(TextWriter writer) : GraphWriter(writer)
77
{
8-
private readonly HashSet<string> _rootEdges = [];
8+
private readonly HashSet<string> _nodes = [];
99

1010
public override string FormatName => "Mermaid";
1111

@@ -54,18 +54,20 @@ protected override void WriteFooter()
5454
{
5555
}
5656

57+
private static string GetRoot(Package package, GraphOptions options) => options.IncludeVersions ? $"{package.Name}{{{{{package.Name}#64;{package.Version}}}}}" : $"{package.Name}{{{{{package.Name}}}}}";
58+
59+
private static string GetEdge(Package package, GraphOptions options) => options.IncludeVersions ? $"{package.Name}[{package.Name}#64;{package.Version}]" : package.Name;
60+
5761
protected override void WriteRoot(Package package, GraphOptions options)
5862
{
59-
var packageId = GetPackageId(package, options);
60-
Writer.WriteLine($"{packageId}{{{{{packageId}}}}}");
63+
Writer.WriteLine(GetRoot(package, options));
6164
}
6265

6366
protected override void WriteNode(Package package, bool hasNuGetLink, GraphOptions options)
6467
{
65-
var packageId = GetPackageId(package, options);
6668
if (package.IsRoot)
6769
{
68-
Writer.WriteLine($"class {packageId} root");
70+
Writer.WriteLine($"class {package.Name} root");
6971
}
7072
var className = package.State switch
7173
{
@@ -75,17 +77,17 @@ protected override void WriteNode(Package package, bool hasNuGetLink, GraphOptio
7577
_ when hasNuGetLink && package.Link == null => "private",
7678
_ => "default",
7779
};
78-
Writer.WriteLine($"class {packageId} {className}");
80+
Writer.WriteLine($"class {package.Name} {className}");
7981
if (package.Link != null)
8082
{
81-
Writer.WriteLine($"click {packageId} \"{package.Link}\" \"{package.Name} {package.Version}\"");
83+
Writer.WriteLine($"click {package.Name} \"{package.Link}\" \"{package.Name} {package.Version}\"");
8284
}
8385
}
8486

8587
protected override void WriteEdge(Package package, Package dependency, GraphOptions options)
8688
{
87-
var packageId = GetPackageId(package, options);
88-
var source = package.IsRoot && _rootEdges.Add(packageId) ? $"{packageId}{{{{{packageId}}}}}" : packageId;
89-
Writer.WriteLine($"{source} --> {GetPackageId(dependency, options)}");
89+
var source = _nodes.Add(package.Name) ? package.IsRoot ? GetRoot(package, options) : GetEdge(package, options) : package.Name;
90+
var destination = _nodes.Add(dependency.Name) ? GetEdge(dependency, options) : dependency.Name;
91+
Writer.WriteLine($"{source} --> {destination}");
9092
}
9193
}

src/Chisel/GraphWriter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ public void Write(DependencyGraph graph, GraphOptions options)
3232
protected abstract void WriteNode(Package package, bool hasNuGetLink, GraphOptions options);
3333
protected abstract void WriteEdge(Package package, Package dependency, GraphOptions options);
3434

35-
protected static string GetPackageId(Package package, GraphOptions options) => options.IncludeVersions ? $"{package.Name}/{package.Version}" : package.Name;
36-
3735
protected static string GetGeneratedByComment()
3836
{
3937
var assembly = typeof(GraphWriter).Assembly;

0 commit comments

Comments
 (0)