Skip to content

Commit a21b2b2

Browse files
authored
Merge pull request #62 from devlead/feature/updateDepAndCakecs
Refactor ProjectCollection to primary constructor record and update d…
2 parents bc64d63 + 3133f5d commit a21b2b2

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

build/helpers.cs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,22 @@ static ProjectCollection GetProjects(ConvertableFilePath slnPath, string configu
2020
var solution = ParseSolution(slnPath);
2121
var projects = solution.Projects.Where(p => p.Type != "{2150E333-8FDC-42A3-9474-1A3956D46DE8}");
2222
var testAssemblies = projects.Where(p => p.Name.Contains(".Tests")).Select(p => p.Path.GetDirectory() + "/bin/" + configuration + "/" + p.Name + ".dll");
23-
return new ProjectCollection {
24-
SolutionPath = slnPath,
25-
SourceProjects = projects.Where(p => !p.Name.Contains(".Tests")),
26-
TestProjects = projects.Where(p => p.Name.Contains(".Tests"))
27-
};
23+
return new ProjectCollection(
24+
SolutionPath: slnPath,
25+
SourceProjects: projects.Where(p => !p.Name.Contains(".Tests")),
26+
TestProjects: projects.Where(p => p.Name.Contains(".Tests"))
27+
);
2828

2929
}
3030
}
3131

32-
public class ProjectCollection {
33-
public ConvertableFilePath SolutionPath { get; set;}
34-
public IEnumerable<SolutionProject> SourceProjects { get; set;}
35-
public IEnumerable<DirectoryPath> SourceProjectPaths {get { return SourceProjects.Select(p => p.Path.GetDirectory()); } }
36-
public IEnumerable<SolutionProject> TestProjects {get;set;}
37-
public IEnumerable<DirectoryPath> TestProjectPaths { get { return TestProjects.Select(p => p.Path.GetDirectory()); } }
38-
public IEnumerable<SolutionProject> AllProjects { get { return SourceProjects.Concat(TestProjects); } }
39-
public IEnumerable<DirectoryPath> AllProjectPaths { get { return AllProjects.Select(p => p.Path.GetDirectory()); } }
32+
public record ProjectCollection(
33+
ConvertableFilePath SolutionPath,
34+
IEnumerable<SolutionProject> SourceProjects,
35+
IEnumerable<SolutionProject> TestProjects)
36+
{
37+
public ICollection<DirectoryPath> SourceProjectPaths => field ??= [.. SourceProjects.Select(p => p.Path.GetDirectory())];
38+
public ICollection<DirectoryPath> TestProjectPaths => field ??= [.. TestProjects.Select(p => p.Path.GetDirectory())];
39+
public ICollection<SolutionProject> AllProjects => field ??= [.. SourceProjects.Concat(TestProjects)];
40+
public ICollection<DirectoryPath> AllProjectPaths => field ??= [.. AllProjects.Select(p => p.Path.GetDirectory())];
4041
}

build/version.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
public static partial class Program
22
{
3-
private static string? fallbackVersion = Argument<string?>("force-version", EnvironmentVariable("FALLBACK_VERSION") ?? "0.1.0");
3+
private static string fallbackVersion = Argument<string?>("force-version", EnvironmentVariable("FALLBACK_VERSION") ?? "0.1.0");
44

55
static string BuildVersion(string fallbackVersion) {
66
var PackageVersion = string.Empty;

samples/Example.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</ItemGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.1" />
21+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.2" />
2222
</ItemGroup>
2323

2424
</Project>

src/Spectre.Console.Cli.Extensions.DependencyInjection/Spectre.Console.Cli.Extensions.DependencyInjection.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<ItemGroup>
1919
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
2020
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" Condition="'$(TargetFramework)' == 'net8.0'" />
21-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.11" Condition="'$(TargetFramework)' == 'net9.0'" />
22-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.1" Condition="'$(TargetFramework)' == 'net10.0'" />
21+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.12" Condition="'$(TargetFramework)' == 'net9.0'" />
22+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.2" Condition="'$(TargetFramework)' == 'net10.0'" />
2323
<PackageReference Include="Spectre.Console.Cli" Version="0.53.1" />
2424
</ItemGroup>
2525

0 commit comments

Comments
 (0)