Skip to content

Commit

Permalink
Use a different color (skyblue) for project references
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Mar 11, 2024
1 parent 042be29 commit cf7f515
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
16 changes: 15 additions & 1 deletion src/Chisel/DependencyGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ private static Package CreatePackage(LockFileTargetLibrary library)
{
var name = library.Name ?? throw new ArgumentException("The library must have a name", nameof(library));
var version = library.Version?.ToString() ?? throw new ArgumentException("The library must have a version", nameof(library));
var type = library.Type switch
{
"package" => PackageType.Package,
"project" => PackageType.Project,
_ => PackageType.Unknown,
};
var dependencies = library.Dependencies.Select(e => e.Id).ToList();
return new Package(name, version, dependencies);
return new Package(name, version, type, dependencies);
}

public DependencyGraph(HashSet<string> resolvedPackages, string projectAssetsFile, string tfm, string rid, IEnumerable<string> ignores)
Expand Down Expand Up @@ -178,6 +184,14 @@ public void Write(TextWriter writer, GraphDirection graphDirection = GraphDirect
{
writer.Write(" [ color = lightcoral ]");
}
else if (package.Type == PackageType.Project)
{
writer.Write(" [ color = skyblue ]");
}
else if (package.Type == PackageType.Unknown)
{
writer.Write(" [ color = khaki ]");
}
writer.WriteLine();
}
writer.WriteLine();
Expand Down
4 changes: 3 additions & 1 deletion src/Chisel/Package.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ namespace Chisel;
[DebuggerDisplay("{Name}/{Version}")]
internal sealed class Package : IEquatable<Package>
{
public Package(string name, string version, IReadOnlyCollection<string> dependencies)
public Package(string name, string version, PackageType type, IReadOnlyCollection<string> dependencies)
{
Name = name;
Version = version;
Type = type;
Dependencies = dependencies;
}

public string Name { get; }
public string Version { get; }
public PackageType Type { get; }
public IReadOnlyCollection<string> Dependencies { get; }

public string Id => $"{Name}/{Version}";
Expand Down
8 changes: 8 additions & 0 deletions src/Chisel/PackageType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Chisel;

internal enum PackageType
{
Unknown,
Package,
Project,
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ digraph
"Microsoft.Data.SqlClient.SNI.runtime/5.2.0"
"Microsoft.Data.SqlClient/5.2.0"
"Microsoft.Identity.Client.Extensions.Msal/4.56.0" [ color = lightcoral ]
"Microsoft.Identity.Client/4.56.0"
"Microsoft.Identity.Client/4.56.0" [ color = skyblue ]
"Microsoft.IdentityModel.Abstractions/6.35.0" [ color = lightcoral ]
"Microsoft.IdentityModel.JsonWebTokens/6.35.0" [ color = lightcoral ]
"Microsoft.IdentityModel.Logging/6.35.0" [ color = lightcoral ]
Expand Down

0 comments on commit cf7f515

Please sign in to comment.