-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve msbuild instance scoring (#1545)
* improve msbuild instance scoring * include mono * added tests * added ability to manually override msbuild path * added test for override of msbuild * revert namespace change
- Loading branch information
Showing
10 changed files
with
160 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/OmniSharp.Host/MSBuild/Discovery/Providers/MSBuildOverrideOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace OmniSharp.MSBuild.Discovery.Providers | ||
{ | ||
internal class MSBuildOverrideOptions | ||
{ | ||
public Dictionary<string, string> PropertyOverrides { get; set; } | ||
|
||
public string MSBuildPath { get; set; } | ||
|
||
public string Name { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/OmniSharp.Host/MSBuild/Discovery/Providers/UserOverrideInstanceProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
using System.Collections.Immutable; | ||
|
||
namespace OmniSharp.MSBuild.Discovery.Providers | ||
{ | ||
internal class UserOverrideInstanceProvider : MSBuildInstanceProvider | ||
{ | ||
private readonly MSBuildOverrideOptions _options; | ||
|
||
public UserOverrideInstanceProvider(ILoggerFactory loggerFactory, IConfiguration configuration) | ||
: base(loggerFactory) | ||
{ | ||
_options = configuration.GetSection("msbuildoverride").Get<MSBuildOverrideOptions>(); | ||
} | ||
|
||
public override ImmutableArray<MSBuildInstance> GetInstances() | ||
{ | ||
if (_options == null || string.IsNullOrWhiteSpace(_options.MSBuildPath)) | ||
{ | ||
return ImmutableArray<MSBuildInstance>.Empty; | ||
} | ||
|
||
var builder = ImmutableArray.CreateBuilder<MSBuildInstance>(); | ||
builder.Add( | ||
new MSBuildInstance( | ||
_options.Name ?? $"Overridden MSBuild from {_options.MSBuildPath}", | ||
_options.MSBuildPath, | ||
new Version(99, 0), | ||
DiscoveryType.UserOverride, | ||
_options.PropertyOverrides?.ToImmutableDictionary())); | ||
return builder.ToImmutable(); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters