Skip to content

Commit

Permalink
Merge branch 'master' into update-roslyn-3.8.0-3
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich authored Sep 1, 2020
2 parents 86125a5 + 33b8d1a commit ec40651
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 40 deletions.
4 changes: 4 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ Task("CreateMSBuildFolder")
source: CombinePaths(msbuildSdkResolverSourceFolder, "Microsoft.DotNet.MSBuildSdkResolver.dll"),
destination: CombinePaths(msbuildSdkResolverTargetFolder, "Microsoft.DotNet.MSBuildSdkResolver.dll"));

FileHelper.Copy(
source: CombinePaths(msbuildSdkResolverSourceFolder, "Microsoft.DotNet.SdkResolver.dll"),
destination: CombinePaths(msbuildSdkResolverTargetFolder, "Microsoft.DotNet.SdkResolver.dll"));

if (Platform.Current.IsWindows)
{
CopyDotNetHostResolver(env, "win", "x86", "hostfxr.dll", msbuildSdkResolverTargetFolder, copyToArchSpecificFolder: true);
Expand Down
5 changes: 3 additions & 2 deletions src/OmniSharp.Host/CompositionHostBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ public CompositionHost Build(string workingDirectory)
// We must register an MSBuild instance before composing MEF to ensure that
// our AssemblyResolve event is hooked up first.
var msbuildLocator = _serviceProvider.GetRequiredService<IMSBuildLocator>();
var dotNetInfo = dotNetCliService.GetInfo(workingDirectory);

// Don't register the default instance if an instance is already registered!
// This is for tests, where the MSBuild instance may be registered early.
if (msbuildLocator.RegisteredInstance == null)
{
var dotNetInfo = dotNetCliService.GetInfo(workingDirectory);
msbuildLocator.RegisterDefaultInstance(logger, dotNetInfo);
}

Expand All @@ -82,7 +82,8 @@ public CompositionHost Build(string workingDirectory)
.WithProvider(MefValueProvider.From(analyzerAssemblyLoader))
.WithProvider(MefValueProvider.From(dotNetCliService))
.WithProvider(MefValueProvider.From(msbuildLocator))
.WithProvider(MefValueProvider.From(eventEmitter));
.WithProvider(MefValueProvider.From(eventEmitter))
.WithProvider(MefValueProvider.From(dotNetInfo));

foreach (var exportDescriptorProvider in _exportDescriptorProviders)
{
Expand Down
17 changes: 5 additions & 12 deletions src/OmniSharp.MSBuild/ProjectSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ internal class ProjectSystem : IProjectSystem
private readonly ILoggerFactory _loggerFactory;
private readonly ILogger _logger;
private readonly IAnalyzerAssemblyLoader _assemblyLoader;
private readonly DotNetInfo _dotNetInfo;
private readonly ImmutableArray<IMSBuildEventSink> _eventSinks;
private PackageDependencyChecker _packageDependencyChecker;
private ProjectManager _manager;
Expand All @@ -66,7 +67,8 @@ public ProjectSystem(
ILoggerFactory loggerFactory,
CachingCodeFixProviderForProjects codeFixesForProjects,
IAnalyzerAssemblyLoader assemblyLoader,
[ImportMany] IEnumerable<IMSBuildEventSink> eventSinks)
[ImportMany] IEnumerable<IMSBuildEventSink> eventSinks,
DotNetInfo dotNetInfo)
{
_environment = environment;
_workspace = workspace;
Expand All @@ -81,6 +83,7 @@ public ProjectSystem(
_eventSinks = eventSinks.ToImmutableArray();
_logger = loggerFactory.CreateLogger<ProjectSystem>();
_assemblyLoader = assemblyLoader;
_dotNetInfo = dotNetInfo;
}

public void Initalize(IConfiguration configuration)
Expand All @@ -102,8 +105,7 @@ public void Initalize(IConfiguration configuration)
_packageDependencyChecker = new PackageDependencyChecker(_loggerFactory, _eventEmitter, _dotNetCli, _options);
_loader = new ProjectLoader(_options, _environment.TargetDirectory, _propertyOverrides, _loggerFactory, _sdksPathResolver);

var dotNetInfo = GetDotNetInfo();
_manager = new ProjectManager(_loggerFactory, _options, _eventEmitter, _fileSystemWatcher, _metadataFileReferenceCache, _packageDependencyChecker, _loader, _workspace, _assemblyLoader, _eventSinks, dotNetInfo);
_manager = new ProjectManager(_loggerFactory, _options, _eventEmitter, _fileSystemWatcher, _metadataFileReferenceCache, _packageDependencyChecker, _loader, _workspace, _assemblyLoader, _eventSinks, _dotNetInfo);
Initialized = true;

if (_options.LoadProjectsOnDemand)
Expand All @@ -126,15 +128,6 @@ public void Initalize(IConfiguration configuration)
}
}

private DotNetInfo GetDotNetInfo()
{
var workingDirectory = string.IsNullOrEmpty(_environment.SolutionFilePath)
? _environment.TargetDirectory
: Path.GetDirectoryName(_environment.SolutionFilePath);

return _dotNetCli.GetInfo(workingDirectory);
}

private IEnumerable<(string, ProjectIdInfo)> GetInitialProjectPathsAndIds()
{
// If a solution was provided, use it.
Expand Down
3 changes: 2 additions & 1 deletion tests/TestUtility/OmniSharpTestHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ public static OmniSharpTestHost Create(
IEnumerable<ExportDescriptorProvider> additionalExports = null,
[CallerMemberName] string callerName = "")
{
var environment = serviceProvider.GetRequiredService<IOmniSharpEnvironment>();
var compositionHost = new CompositionHostBuilder(serviceProvider, s_lazyAssemblies.Value, additionalExports)
.Build(workingDirectory: null);
.Build(environment.TargetDirectory);

WorkspaceInitializer.Initialize(serviceProvider, compositionHost);

Expand Down
50 changes: 25 additions & 25 deletions tools/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
<packages>
<package id="Cake" version="0.37.0" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.1" />
<package id="Microsoft.Build" version="16.8.0-preview-20417-01" />
<package id="Microsoft.Build.Framework" version="16.8.0-preview-20417-01" />
<package id="Microsoft.Build.Runtime" version="16.8.0-preview-20417-01" />
<package id="Microsoft.Build.Tasks.Core" version="16.8.0-preview-20417-01" />
<package id="Microsoft.Build.Utilities.Core" version="16.8.0-preview-20417-01" />
<package id="Microsoft.Net.Compilers.Toolset" version="3.8.0-2.20413.3" />
<package id="Microsoft.DotNet.MSBuildSdkResolver" version="5.0.100-preview.8.20362.2" />
<package id="Microsoft.Build.NuGetSdkResolver" version="5.8.0-preview.2.6776" />
<package id="Microsoft.Build" version="16.8.0-preview-20429-01" />
<package id="Microsoft.Build.Framework" version="16.8.0-preview-20429-01" />
<package id="Microsoft.Build.Runtime" version="16.8.0-preview-20429-01" />
<package id="Microsoft.Build.Tasks.Core" version="16.8.0-preview-20429-01" />
<package id="Microsoft.Build.Utilities.Core" version="16.8.0-preview-20429-01" />
<package id="Microsoft.Net.Compilers.Toolset" version="3.8.0-3.20451.2" />
<package id="Microsoft.DotNet.MSBuildSdkResolver" version="5.0.100-rc.1.20431.8" />
<package id="Microsoft.Build.NuGetSdkResolver" version="5.8.0-preview.3.6783" />
<package id="Newtonsoft.Json" version="12.0.2" />
<package id="NuGet.Build.Tasks" version="5.8.0-preview.2.6776" />
<package id="NuGet.Commands" version="5.8.0-preview.2.6776" />
<package id="NuGet.Common" version="5.8.0-preview.2.6776" />
<package id="NuGet.Configuration" version="5.8.0-preview.2.6776" />
<package id="NuGet.Credentials" version="5.8.0-preview.2.6776" />
<package id="NuGet.DependencyResolver.Core" version="5.8.0-preview.2.6776" />
<package id="NuGet.Frameworks" version="5.8.0-preview.2.6776" />
<package id="NuGet.LibraryModel" version="5.8.0-preview.2.6776" />
<package id="NuGet.Packaging" version="5.8.0-preview.2.6776" />
<package id="NuGet.ProjectModel" version="5.8.0-preview.2.6776" />
<package id="NuGet.Protocol" version="5.8.0-preview.2.6776" />
<package id="NuGet.Versioning" version="5.8.0-preview.2.6776" />
<package id="runtime.linux-x64.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-preview.8.20361.2" />
<package id="runtime.osx-x64.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-preview.8.20361.2" />
<package id="runtime.win-x64.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-preview.8.20361.2" />
<package id="runtime.win-x86.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-preview.8.20361.2" />
<package id="runtime.win-arm64.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-preview.8.20361.2" />
<package id="NuGet.Build.Tasks" version="5.8.0-preview.3.6783" />
<package id="NuGet.Commands" version="5.8.0-preview.3.6783" />
<package id="NuGet.Common" version="5.8.0-preview.3.6783" />
<package id="NuGet.Configuration" version="5.8.0-preview.3.6783" />
<package id="NuGet.Credentials" version="5.8.0-preview.3.6783" />
<package id="NuGet.DependencyResolver.Core" version="5.8.0-preview.3.6783" />
<package id="NuGet.Frameworks" version="5.8.0-preview.3.6783" />
<package id="NuGet.LibraryModel" version="5.8.0-preview.3.6783" />
<package id="NuGet.Packaging" version="5.8.0-preview.3.6783" />
<package id="NuGet.ProjectModel" version="5.8.0-preview.3.6783" />
<package id="NuGet.Protocol" version="5.8.0-preview.3.6783" />
<package id="NuGet.Versioning" version="5.8.0-preview.3.6783" />
<package id="runtime.linux-x64.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-rc.1.20431.14" />
<package id="runtime.osx-x64.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-rc.1.20431.14" />
<package id="runtime.win-x64.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-rc.1.20431.14" />
<package id="runtime.win-x86.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-rc.1.20431.14" />
<package id="runtime.win-arm64.Microsoft.NETCore.DotNetHostResolver" version="5.0.0-rc.1.20431.14" />
<package id="SQLitePCLRaw.bundle_green" version="1.1.2" />
<package id="SQLitePCLRaw.core" version="1.1.2" />
<package id="SQLitePCLRaw.provider.e_sqlite3.net45" version="1.1.2" />
Expand Down

0 comments on commit ec40651

Please sign in to comment.