From ac5b499731ed96fe2bea4c175f8104bdab35ea9f Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 20 Nov 2024 11:30:48 +0100 Subject: [PATCH] fix double log message (cherry picked from commit 6f375b0c90bb0c86afb1d408c161adff377d1220) --- src/Elastic.Markdown/DocumentationGenerator.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Elastic.Markdown/DocumentationGenerator.cs b/src/Elastic.Markdown/DocumentationGenerator.cs index 6b847b7d..5ec176dc 100644 --- a/src/Elastic.Markdown/DocumentationGenerator.cs +++ b/src/Elastic.Markdown/DocumentationGenerator.cs @@ -128,6 +128,11 @@ private bool CompilationNotNeeded(GenerationState? generationState, out HashSet< outputSeenChanges = generationState?.LastSeenChanges ?? DateTimeOffset.MinValue; if (generationState == null) return false; + if (Context.Force) + { + _logger.LogInformation($"Full compilation: --force was specified"); + return false; + } if (Context.Git != generationState.Git) { @@ -144,7 +149,6 @@ private bool CompilationNotNeeded(GenerationState? generationState, out HashSet< _logger.LogInformation($"Incremental compilation. since: {generationState.LastSeenChanges}"); else if (DocumentationSet.LastWrite <= outputSeenChanges) { - _logger.LogInformation($"No compilation: no changes since last observed: {generationState.LastSeenChanges}"); _logger.LogInformation($"No compilation: no changes since last observed: {generationState.LastSeenChanges} " + "Pass --force to force a full regeneration"); return true; @@ -157,6 +161,7 @@ private async Task GenerateLinkReference(Cancel ctx) { var file = DocumentationSet.LinkReferenceFile; var state = LinkReference.Create(DocumentationSet); + var bytes = JsonSerializer.SerializeToUtf8Bytes(state, SourceGenerationContext.Default.LinkReference); await DocumentationSet.OutputPath.FileSystem.File.WriteAllBytesAsync(file.FullName, bytes, ctx); }