Skip to content

Commit

Permalink
Fixed invalid printing versions when built on packaging.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Oct 15, 2024
1 parent 1254b55 commit 754d4f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
26 changes: 11 additions & 15 deletions RelaxVersioner.Core/Processor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ static string FormatSignature(Signature? sig) => sig is { } s ?
keyValues[entry.key] = entry.value;
}

writeProvider.Write(context, keyValues, generated);
if (!string.IsNullOrWhiteSpace(context.OutputPath))
{
writeProvider.Write(context, keyValues, generated);
}

return new Result(
versionLabel,
Expand All @@ -182,20 +185,13 @@ public async Task<Result> RunAsync(
using var repository = await Utilities.OpenRepositoryAsync(
logger, context.ProjectDirectory);

try
{
return await WriteVersionSourceFileAsync(
logger,
writeProvider,
context,
repository?.Head,
DateTimeOffset.Now,
ct);
}
finally
{
repository?.Dispose();
}
return await WriteVersionSourceFileAsync(
logger,
writeProvider,
context,
repository?.Head,
DateTimeOffset.Now,
ct);
}

public static void WriteSafeTransacted(
Expand Down
1 change: 1 addition & 0 deletions RelaxVersioner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public static async Task<int> Main(string[] args)
{
"Text" => context.IsDryRun,
"Replace" => context.IsDryRun,
"NPM" => context.IsDryRun,
_ => true,
})
{
Expand Down

0 comments on commit 754d4f9

Please sign in to comment.