From 98abb3c0ba508479e952f1072b15eb79bd1022b5 Mon Sep 17 00:00:00 2001 From: Dave Glick Date: Fri, 30 Oct 2020 16:48:02 -0400 Subject: [PATCH] A little cleanup --- ReleaseNotes.md | 5 ++++- src/Buildalyzer/Logging/EventProcessor.cs | 2 +- src/Buildalyzer/ProjectAnalyzer.cs | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 200df333..2d0991d6 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,4 +1,7 @@ -# 3.0.2 +# 3.1.0 + +- Added `SourceFiles` and `References` for F# projects (#146, thanks @dukedagmor) +- Fixed an inconsistency between Buildalyzer and MSBuild by adding a trailing directory separator to the solution path (#147, #148, thanks @laurenceSaes) # 3.0.1 diff --git a/src/Buildalyzer/Logging/EventProcessor.cs b/src/Buildalyzer/Logging/EventProcessor.cs index d321064d..5bcb44b5 100644 --- a/src/Buildalyzer/Logging/EventProcessor.cs +++ b/src/Buildalyzer/Logging/EventProcessor.cs @@ -116,7 +116,7 @@ private void MessageRaised(object sender, BuildMessageEventArgs e) { // Process the command line arguments for the Fsc task AnalyzerResult result = _currentResult.Count == 0 ? null : _currentResult.Peek(); - if (e.SenderName.Equals("Fsc", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(e.Message) && _targetStack.Any(x => x.TargetName == "CoreCompile") && _currentResult.Count != 0) + if (e.SenderName?.Equals("Fsc", StringComparison.OrdinalIgnoreCase) == true && !string.IsNullOrWhiteSpace(e.Message) && _targetStack.Any(x => x.TargetName == "CoreCompile") && _currentResult.Count != 0) { result.ProcessFscCommandLine(e.Message); } diff --git a/src/Buildalyzer/ProjectAnalyzer.cs b/src/Buildalyzer/ProjectAnalyzer.cs index 6d53835f..828c141a 100644 --- a/src/Buildalyzer/ProjectAnalyzer.cs +++ b/src/Buildalyzer/ProjectAnalyzer.cs @@ -209,6 +209,12 @@ private string GetCommand(BuildEnvironment buildEnvironment, string targetFramew // Setting the TargetFramework MSBuild property tells MSBuild which target framework to use for the outer build effectiveGlobalProperties[MsBuildProperties.TargetFramework] = targetFramework; } + if (Path.GetExtension(ProjectFile.Path).Equals(".fsproj", StringComparison.OrdinalIgnoreCase) + && effectiveGlobalProperties.ContainsKey(MsBuildProperties.SkipCompilerExecution)) + { + // We can't skip the compiler for design-time builds in F# (it causes strange errors regarding file copying) + effectiveGlobalProperties.Remove(MsBuildProperties.SkipCompilerExecution); + } string propertyArgument = effectiveGlobalProperties.Count == 0 ? string.Empty : $"/property:{string.Join(";", effectiveGlobalProperties.Select(x => $"{x.Key}={FormatArgument(x.Value)}"))}"; // Get the target argument (/target)