refactor WorkspaceContext (#2736)
this removes a regression in ProjectModelServer behavior also added a test to cover target framework change in DTH
This commit is contained in:
parent
2e22c3ac4b
commit
f32683cbab
35 changed files with 821 additions and 635 deletions
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.Tools.Compiler;
|
||||
using Moq;
|
||||
using NuGet.Frameworks;
|
||||
using Xunit;
|
||||
|
@ -20,7 +19,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
private Mock<ICompiler> _nativeCompilerMock;
|
||||
private List<ProjectContext> _contexts;
|
||||
private BuildCommandApp _args;
|
||||
private readonly WorkspaceContext _workspace;
|
||||
private readonly BuildWorkspace _workspace;
|
||||
|
||||
public GivenACompilationDriverController()
|
||||
{
|
||||
|
@ -35,13 +34,13 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
.Compile(It.IsAny<ProjectContext>(), It.IsAny<BuildCommandApp>()))
|
||||
.Returns(true);
|
||||
|
||||
_workspace = WorkspaceContext.Create(ProjectReaderSettings.ReadFromEnvironment(), designTime: false);
|
||||
_workspace = new BuildWorkspace(ProjectReaderSettings.ReadFromEnvironment());
|
||||
_contexts = new List<ProjectContext>
|
||||
{
|
||||
_workspace.GetProjectContext(_projectJson, NuGetFramework.Parse("netcoreapp1.0"))
|
||||
};
|
||||
|
||||
_args = new BuildCommandApp("dotnet compile", ".NET Compiler", "Compiler for the .NET Platform", WorkspaceContext.Create(designTime: false));
|
||||
_args = new BuildCommandApp("dotnet compile", ".NET Compiler", "Compiler for the .NET Platform", _workspace);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
@ -187,7 +187,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
It.IsAny<string>()))
|
||||
.Returns(command.Object);
|
||||
|
||||
var _args = new BuildCommandApp("dotnet compile", ".NET Compiler", "Compiler for the .NET Platform", WorkspaceContext.Create(designTime: false));
|
||||
var _args = new BuildCommandApp("dotnet compile", ".NET Compiler", "Compiler for the .NET Platform", new BuildWorkspace(new ProjectReaderSettings()));
|
||||
_args.ConfigValue = ConfigValue;
|
||||
|
||||
PreCompileScriptVariables = new Dictionary<string, string>();
|
||||
|
@ -218,7 +218,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
rids.Add(rid);
|
||||
}
|
||||
|
||||
var workspace = WorkspaceContext.Create(ProjectReaderSettings.ReadFromEnvironment(), designTime: false);
|
||||
var workspace = new BuildWorkspace(new ProjectReaderSettings());
|
||||
var context = workspace.GetRuntimeContext(workspace.GetProjectContext(projectJson, TestAssetFramework), rids);
|
||||
context = workspace.GetRuntimeContext(context, rids);
|
||||
managedCompiler.Compile(context, _args);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue