Skip to content

Commit

Permalink
Added F# project loading hack
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorFedchenko authored and Aaronontheweb committed Oct 28, 2019
1 parent 066d8ca commit 2044e8d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/Incrementalist.Cmd/Commands/LoadSolutionCmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,20 @@ protected override async Task<Solution> ProcessImpl(Task<string> previousTask)
$"solution filename. Instead returned {slnObject}");
var slnName = slnObject;
Contract.Assert(File.Exists(slnName), $"Expected to find {slnName} on the file system, but couldn't.");

// Log any solution loading issues
_workspace.WorkspaceFailed += (sender, args) =>
{
var message = $"Issue during solution loading: {sender}: {args.Diagnostic.Message}";
var logLevel = args.Diagnostic.Kind == WorkspaceDiagnosticKind.Failure ? LogLevel.Error : LogLevel.Warning;

Logger.Log(logLevel, message);
};

// Roslyn does not support FSharp projects, but .fsproj has same structure as .csproj files,
// so can treat them as a known project type to support diff tracking
_workspace.AssociateFileExtensionWithLanguage("fsproj", LanguageNames.CSharp);

return await _workspace.OpenSolutionAsync(slnName, _progress, CancellationToken);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task FSharpProjectDiff_should_be_tracked()
var emitTask = new EmitDependencyGraphTask(settings, workspace, logger);
var affectedFiles = (await emitTask.Run()).ToList();

affectedFiles.Should().HaveCount(2).And.Subject.Should().BeEquivalentTo(fsharpProjectFullPath, csharpProjectFullPath);
affectedFiles.Select(f => f.Key).Should().HaveCount(2).And.Subject.Should().BeEquivalentTo(fsharpProjectFullPath, csharpProjectFullPath);
}

private static MSBuildWorkspace SetupMsBuildWorkspace()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharpSampleProject", "FSharpSampleProject.fsproj", "{50FA647B-BAE4-4DF5-99CA-934B8227E236}"
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharpProject", "FSharpProject.fsproj", "{50FA647B-BAE4-4DF5-99CA-934B8227E236}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpProject", "CSharpProject.csproj", "{5FEC8D4E-75A8-4730-A57D-8258B2CD971C}"
EndProject
Expand Down

0 comments on commit 2044e8d

Please sign in to comment.