Skip to content

Commit 2c45ac8

Browse files
committed
[Build] Replace IPipelineContext with IModuleContext and update stream handling for solution parsing.
1 parent 0e88529 commit 2c45ac8

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

build/Modules/CompileProjectsModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected override async Task ExecuteModuleAsync(IModuleContext context, Cancell
2222
}
2323
}
2424

25-
private static async Task<CommandResult> CompileAsync(IPipelineContext context, string configuration, CancellationToken cancellationToken)
25+
private static async Task<CommandResult> CompileAsync(IModuleContext context, string configuration, CancellationToken cancellationToken)
2626
{
2727
return await context.DotNet().Build(new DotNetBuildOptions
2828
{

build/Modules/GenerateGitHubChangelogModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public sealed class GenerateGitHubChangelogModule : Module<string>
2323
/// <summary>
2424
/// Append a GitHub compare URL to the changelog if it is not already included.
2525
/// </summary>
26-
private static string AppendGitHubCompareUrl(IPipelineContext context, string changelog, ResolveVersioningResult versioning)
26+
private static string AppendGitHubCompareUrl(IModuleContext context, string changelog, ResolveVersioningResult versioning)
2727
{
2828
if (changelog.Contains("Full changelog", StringComparison.OrdinalIgnoreCase)) return changelog;
2929

build/Modules/ResolveConfigurationsModule.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,19 @@ public sealed class ResolveConfigurationsModule : Module<string[]>
2424
return configurations;
2525
}
2626

27-
private static async Task<SolutionModel> LoadSolutionModelAsync(IPipelineContext context, CancellationToken cancellationToken)
27+
private static async Task<SolutionModel> LoadSolutionModelAsync(IModuleContext context, CancellationToken cancellationToken)
2828
{
2929
var solution = context.Git().RootDirectory.FindFile(file => file.Extension == ".slnx");
3030
if (solution is not null)
3131
{
32-
return await SolutionSerializers.SlnXml.OpenAsync(solution.GetStream(), cancellationToken);
32+
await using var slnxStream = solution.GetStream();
33+
return await SolutionSerializers.SlnXml.OpenAsync(slnxStream, cancellationToken);
3334
}
3435

3536
solution = context.Git().RootDirectory.FindFile(file => file.Extension == ".sln");
3637
solution.ShouldNotBeNull("Solution file not found.");
3738

38-
return await SolutionSerializers.SlnFileV12.OpenAsync(solution.GetStream(), cancellationToken);
39+
await using var slnStream = solution.GetStream();
40+
return await SolutionSerializers.SlnFileV12.OpenAsync(slnStream, cancellationToken);
3941
}
4042
}

build/Modules/ResolveVersioningModule.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public sealed class ResolveVersioningModule(IOptions<PublishOptions> publishOpti
2929
/// <summary>
3030
/// Resolve versions using the specified version string.
3131
/// </summary>
32-
private static async Task<ResolveVersioningResult> CreateFromVersionStringAsync(IPipelineContext context, string version)
32+
private static async Task<ResolveVersioningResult> CreateFromVersionStringAsync(IModuleContext context, string version)
3333
{
3434
var versionParts = version.Split('-');
3535

@@ -46,7 +46,7 @@ private static async Task<ResolveVersioningResult> CreateFromVersionStringAsync(
4646
/// <summary>
4747
/// Retrieves the previous version from the git history.
4848
/// </summary>
49-
private static async Task<string> FetchPreviousVersionAsync(IPipelineContext context)
49+
private static async Task<string> FetchPreviousVersionAsync(IModuleContext context)
5050
{
5151
var describeResult = await context.Git().Commands.Describe(
5252
new GitDescribeOptions

build/Modules/TestProjectsModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected override async Task ExecuteModuleAsync(IModuleContext context, Cancell
3131
/// <summary>
3232
/// Test the add-in project for the specified configuration.
3333
/// </summary>
34-
private static async Task<CommandResult> CompileAsync(IPipelineContext context, string configuration, CancellationToken cancellationToken)
34+
private static async Task<CommandResult> CompileAsync(IModuleContext context, string configuration, CancellationToken cancellationToken)
3535
{
3636
return await context.DotNet().Test(new DotNetTestOptions
3737
{

0 commit comments

Comments
 (0)