Skip to content

Commit beab0df

Browse files
committed
Upgrade to NET 8. Update libraries
1 parent 47806b0 commit beab0df

File tree

11 files changed

+64
-70
lines changed

11 files changed

+64
-70
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SDV - Solution Dependencies Visualiser
22

33
![MIT License](https://img.shields.io/github/license/AndriiLab/SDV)
4-
![.NET Core 7.0](https://img.shields.io/badge/.net%20core-7.0-blue)
4+
![.NET Core 8.0](https://img.shields.io/badge/.net%20core-8.0-blue)
55
![Last Commit](https://img.shields.io/github/last-commit/AndriiLab/SDV)
66
![Last release](https://img.shields.io/github/release-date/AndriiLab/SDV)
77

SDV.App/SDV.App.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net7.0-windows</TargetFramework>
5+
<TargetFramework>net8.0-windows</TargetFramework>
66
<Nullable>enable</Nullable>
77
<UseWPF>true</UseWPF>
8-
<Version>1.0.1</Version>
8+
<Version>1.0.2</Version>
9+
<LangVersion>default</LangVersion>
910
</PropertyGroup>
1011

1112
<ItemGroup>
12-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
13-
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
13+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
14+
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
1415
</ItemGroup>
1516

1617
<ItemGroup>

SDV.DependenciesAnalyzer/AssetsJson/AssetsExtractor.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ public IExtractor GetExtractor(string dependenciesSource, string csprojPath, str
3535

3636
private class AssetsExtractor : IExtractor
3737
{
38-
private readonly ILogger _log;
3938
private readonly ProjectAssetsJsonModel _assets;
4039
private readonly AssetsUtils _utils;
4140

4241
private AssetsExtractor(ILogger log, ProjectAssetsJsonModel assets)
4342
{
44-
_log = log;
4543
_assets = assets;
4644
_utils = new AssetsUtils(log);
4745
}

SDV.DependenciesAnalyzer/AssetsJson/AssetsUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class AssetsUtils
1212
private readonly ILogger _log;
1313

1414
private const string AbsentNupkgWarnMsg =
15-
@"Skipping adding this dependency to the dependency tree. This might be because the package already exists in a different NuGet cache, possibly the SDK's NuGetFallbackFolder cache. Removing the package from this cache may resolve the issue.";
15+
"Skipping adding this dependency to the dependency tree. This might be because the package already exists in a different NuGet cache, possibly the SDK's NuGetFallbackFolder cache. Removing the package from this cache may resolve the issue.";
1616

1717
public AssetsUtils(ILogger log)
1818
{
@@ -24,7 +24,7 @@ public List<string> GetDirectDependencies(ProjectAssetsJsonModel assets)
2424
var frameworks = assets.Project.Frameworks;
2525
if (frameworks is null)
2626
{
27-
return new List<string>(0);
27+
return [];
2828
}
2929

3030
var directDependencies = frameworks

SDV.DependenciesAnalyzer/Interfaces/INugetDependenciesGenerator.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ namespace SDV.DependenciesAnalyzer.Interfaces;
55
public interface INugetDependenciesGenerator
66
{
77
Tree Generate(string slnFilePath);
8+
9+
/// <summary>
10+
/// Generates a tree based on the provided configuration.
11+
/// </summary>
12+
/// <param name="configuration">The configuration used to generate the tree.</param>
13+
/// <returns>The generated tree.</returns>
814
Tree Generate(TreeGeneratorConfiguration configuration);
915
}
1016

SDV.DependenciesAnalyzer/NugetDependenciesGenerator.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using SDV.DependenciesAnalyzer.Structure;
66

77
namespace SDV.DependenciesAnalyzer;
8-
98
public class NugetDependenciesGenerator : INugetDependenciesGenerator
109
{
1110
private readonly ILogger _log;
@@ -31,9 +30,14 @@ public Tree Generate(TreeGeneratorConfiguration configuration)
3130
var solution = _solutionBuilder.CreateSolutionFile(configuration);
3231

3332
_log.LogInformation("Found {Number} projects in solution. Processing dependencies", solution.Projects.Count);
33+
34+
return BuildDependenciesTree(solution, configuration);
35+
}
3436

37+
private Tree BuildDependenciesTree(SolutionBuilder.Solution solution, TreeGeneratorConfiguration configuration)
38+
{
3539
var nugetDepsTree = new Tree(Path.GetFileNameWithoutExtension(configuration.SlnFilePath));
36-
// CreateSolutionFile the tree for each project.
40+
// Build the tree for each project.
3741
foreach (var project in solution.Projects)
3842
{
3943
var depsTree = _projectBuilder.CreateDependencyTree(project, configuration);
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7-
<Version>1.0.1</Version>
7+
<Version>1.0.2</Version>
8+
<LangVersion>default</LangVersion>
89
</PropertyGroup>
910

1011
<ItemGroup>
11-
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
12-
<PackageReference Include="NuGet.Packaging" Version="6.6.1" />
12+
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
13+
<PackageReference Include="NuGet.Packaging" Version="6.8.0" />
1314
</ItemGroup>
1415

1516
</Project>

SDV.DependenciesAnalyzer/Structure/SolutionBuilder.cs

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,38 @@ public Solution CreateSolutionFile(TreeGeneratorConfiguration configuration)
3232

3333
return new Solution(projects);
3434
}
35+
36+
private IEnumerable<ProjectBuilder.Project> LoadProjects()
37+
{
38+
var projectDeclarations = ParseSlnFile(_configuration.SlnFilePath);
39+
return projectDeclarations.Count > 0
40+
? LoadProjectsFromSolutionFile(projectDeclarations)
41+
: LoadSingleProjectFromDir();
42+
}
43+
44+
private IEnumerable<ProjectBuilder.Project> LoadProjectsFromSolutionFile(IEnumerable<string> slnProjects)
45+
{
46+
return slnProjects.SelectMany(ParseAndLoadProject);
47+
}
48+
49+
private IEnumerable<ProjectBuilder.Project> ParseAndLoadProject(string project)
50+
{
51+
try
52+
{
53+
var parsed = ParseProject(project, CommonUtils.GetProjectDirectoryName(_configuration.SlnFilePath));
54+
if (!CanProjectBeProcessed(parsed.ProjectName, parsed.CsprojPath))
55+
{
56+
return Enumerable.Empty<ProjectBuilder.Project>();
57+
}
58+
var pb = LoadProject(parsed.ProjectName, parsed.CsprojPath);
59+
return pb != null ? new[] { pb } : Enumerable.Empty<ProjectBuilder.Project>();
60+
}
61+
catch (Exception ex)
62+
{
63+
_logger.LogError(ex, "Failed parsing and loading project '{ProjectName}' from solution '{SolutionName}': {Error}", project, _configuration.SlnFilePath, ex.Message);
64+
return Enumerable.Empty<ProjectBuilder.Project>();
65+
}
66+
}
3567

3668
private List<string> GetDependenciesSources()
3769
{
@@ -57,46 +89,6 @@ private List<string> GetDependenciesSources()
5789
return curDependenciesSources;
5890
}
5991

60-
private IEnumerable<ProjectBuilder.Project> LoadProjects()
61-
{
62-
var projectsDeclarations = ParseSlnFile(_configuration.SlnFilePath);
63-
if (projectsDeclarations.Count > 0)
64-
{
65-
return LoadProjectsFromSolutionFile(projectsDeclarations);
66-
}
67-
return LoadSingleProjectFromDir();
68-
}
69-
70-
private IEnumerable<ProjectBuilder.Project> LoadProjectsFromSolutionFile(List<string> slnProjects)
71-
{
72-
foreach (var project in slnProjects)
73-
{
74-
ProjectBuilder.Project projectBuilder;
75-
try
76-
{
77-
var parsed = ParseProject(project, CommonUtils.GetProjectDirectoryName(_configuration.SlnFilePath));
78-
if (!CanProjectBeProcessed(parsed.ProjectName, parsed.CsprojPath))
79-
{
80-
continue;
81-
}
82-
83-
var pb = LoadProject(parsed.ProjectName, parsed.CsprojPath);
84-
if (pb is null)
85-
{
86-
continue;
87-
}
88-
projectBuilder = pb;
89-
}
90-
catch (Exception ex)
91-
{
92-
_logger.LogError(ex, "Failed parsing and loading project '{ProjectName}' from solution '{SolutionName}': {Error}", project, _configuration.SlnFilePath, ex.Message);
93-
continue;
94-
}
95-
96-
yield return projectBuilder;
97-
}
98-
}
99-
10092
private bool CanProjectBeProcessed(string name, string path)
10193
{
10294
if (!path.EndsWith(".csproj"))

SDV.GraphGenerator/SDV.GraphGenerator.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7-
<Version>1.0.1</Version>
7+
<Version>1.0.2</Version>
88
</PropertyGroup>
99

1010
<ItemGroup>

SDV.GraphGenerator/package-lock.json

Lines changed: 4 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)