Skip to content

Commit

Permalink
Update OmniSharp to latest MSBuild
Browse files Browse the repository at this point in the history
This change updates OmniSharp with the latest MSBuild binaries. Recent performance changes for MSBuild now
require NuGet.Build.Tasks, which requires a set of NuGet binaries be included as well. Because the versions of these NuGet binaries might be different (actually, they *are* different) than the binaries that OmniSharp uses, there's a bit of duplication.
  • Loading branch information
DustinCampbell committed Apr 5, 2018
1 parent fdfa303 commit 937a39a
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 24 deletions.
69 changes: 57 additions & 12 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,40 @@ Task("CreateMSBuildFolder")
CopyDotNetHostResolver(env, "linux", "x64", "libhostfxr.so", sdkResolverTargetFolder, copyToArchSpecificFolder: false);
}

// Copy content of NuGet.Build.Tasks
var nugetBuildTasksFolder = CombinePaths(env.Folders.Tools, "NuGet.Build.Tasks");
var nugetBuildTasksBinariesFolder = CombinePaths(nugetBuildTasksFolder, "lib", "net46");
var nugetBuildTasksTargetsFolder = CombinePaths(nugetBuildTasksFolder, "runtimes", "any", "native");

FileHelper.Copy(
source: CombinePaths(nugetBuildTasksBinariesFolder, "NuGet.Build.Tasks.dll"),
destination: CombinePaths(msbuild15BinTargetFolder, "NuGet.Build.Tasks.dll"));

FileHelper.Copy(
source: CombinePaths(nugetBuildTasksTargetsFolder, "NuGet.targets"),
destination: CombinePaths(msbuild15BinTargetFolder, "NuGet.targets"));

// Copy dependencies of NuGet.Build.Tasks
var nugetPackages = new []
{
"NuGet.Commands",
"NuGet.Common",
"NuGet.Configuration",
"NuGet.Frameworks",
"NuGet.ProjectModel",
"NuGet.Protocol",
"NuGet.Versioning"
};

foreach (var nugetPackage in nugetPackages)
{
var binaryName = nugetPackage + ".dll";

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, nugetPackage, "lib", "net46", binaryName),
destination: CombinePaths(msbuild15BinTargetFolder, binaryName));
}

// Copy content of Microsoft.Net.Compilers
Information("Copying Microsoft.Net.Compilers...");
var compilersSourceFolder = CombinePaths(env.Folders.Tools, "Microsoft.Net.Compilers", "tools");
Expand Down Expand Up @@ -632,8 +666,11 @@ Task("Test")
else
{
// Copy the Mono-built Microsoft.Build.* binaries to the test folder.
// This is necessary to work around a Mono bug that is exasperated by xUnit.
DirectoryHelper.Copy($"{env.Folders.MonoMSBuildLib}", instanceFolder);

DeleteUnnecessaryAssemblies(instanceFolder);

var runScript = CombinePaths(env.Folders.Mono, "run");

// By default, the run script launches OmniSharp. To launch our Mono runtime
Expand All @@ -649,6 +686,25 @@ Task("Test")
}
});

/// <summary>
/// Delete assemblies that are included in our Mono package.
/// </summary>
void DeleteUnnecessaryAssemblies(string folder)
{
FileHelper.Delete(CombinePaths(folder, "System.AppContext.dll"));
FileHelper.Delete(CombinePaths(folder, "System.Numerics.Vectors.dll"));
FileHelper.Delete(CombinePaths(folder, "System.Runtime.InteropServices.RuntimeInformation.dll"));
FileHelper.Delete(CombinePaths(folder, "System.ComponentModel.Primitives.dll"));
FileHelper.Delete(CombinePaths(folder, "System.ComponentModel.TypeConverter.dll"));
FileHelper.Delete(CombinePaths(folder, "System.Console.dll"));
FileHelper.Delete(CombinePaths(folder, "System.IO.FileSystem.Primitives.dll"));
FileHelper.Delete(CombinePaths(folder, "System.IO.FileSystem.dll"));
FileHelper.Delete(CombinePaths(folder, "System.Security.Cryptography.Encoding.dll"));
FileHelper.Delete(CombinePaths(folder, "System.Security.Cryptography.Primitives.dll"));
FileHelper.Delete(CombinePaths(folder, "System.Security.Cryptography.X509Certificates.dll"));
FileHelper.Delete(CombinePaths(folder, "System.Threading.Thread.dll"));
}

void CopyMonoBuild(BuildEnvironment env, string sourceFolder, string outputFolder)
{
DirectoryHelper.Copy(sourceFolder, outputFolder, copySubDirectories: false);
Expand All @@ -657,18 +713,7 @@ void CopyMonoBuild(BuildEnvironment env, string sourceFolder, string outputFolde
DirectoryHelper.Copy($"{env.Folders.MSBuild}", CombinePaths(outputFolder, "msbuild"));

// Included in Mono
FileHelper.Delete(CombinePaths(outputFolder, "System.AppContext.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.Numerics.Vectors.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.Runtime.InteropServices.RuntimeInformation.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.ComponentModel.Primitives.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.ComponentModel.TypeConverter.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.Console.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.IO.FileSystem.Primitives.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.IO.FileSystem.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.Security.Cryptography.Encoding.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.Security.Cryptography.Primitives.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.Security.Cryptography.X509Certificates.dll"));
FileHelper.Delete(CombinePaths(outputFolder, "System.Threading.Thread.dll"));
DeleteUnnecessaryAssemblies(outputFolder);
}

string PublishMonoBuild(string project, BuildEnvironment env, BuildPlan plan, string configuration)
Expand Down
4 changes: 2 additions & 2 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"MonoRuntimeLinux32": "mono.linux-x86-5.10.1.20.zip",
"MonoRuntimeLinux64": "mono.linux-x86_64-5.10.1.20.zip",
"MonoFramework": "framework-5.10.1.20.zip",
"MonoMSBuildRuntime": "Microsoft.Build.Runtime.Mono-alpha6.zip",
"MonoMSBuildLib": "Microsoft.Build.Lib.Mono-alpha6.zip",
"MonoMSBuildRuntime": "Microsoft.Build.Runtime.Mono-mono-5.10.1.20.zip",
"MonoMSBuildLib": "Microsoft.Build.Lib.Mono-mono-5.10.1.20.zip",
"HostProjects": [
"OmniSharp.Stdio",
"OmniSharp.Http"
Expand Down
8 changes: 4 additions & 4 deletions build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<MicrosoftAspNetCoreHostingVersion>1.1.0</MicrosoftAspNetCoreHostingVersion>
<MicrosoftAspNetCoreHttpFeaturesVersion>1.1.0</MicrosoftAspNetCoreHttpFeaturesVersion>
<MicrosoftAspNetCoreServerKestrelVersion>1.1.0</MicrosoftAspNetCoreServerKestrelVersion>
<MicrosoftBuildVersion>15.3.409</MicrosoftBuildVersion>
<MicrosoftBuildFrameworkVersion>15.3.409</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildTasksCoreVersion>15.3.409</MicrosoftBuildTasksCoreVersion>
<MicrosoftBuildUtilitiesCoreVersion>15.3.409</MicrosoftBuildUtilitiesCoreVersion>
<MicrosoftBuildVersion>15.6.82</MicrosoftBuildVersion>
<MicrosoftBuildFrameworkVersion>15.6.82</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildTasksCoreVersion>15.6.82</MicrosoftBuildTasksCoreVersion>
<MicrosoftBuildUtilitiesCoreVersion>15.6.82</MicrosoftBuildUtilitiesCoreVersion>
<MicrosoftCodeAnalysisCommonVersion>2.7.0</MicrosoftCodeAnalysisCommonVersion>
<MicrosoftCodeAnalysisCSharpVersion>2.7.0</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisCSharpFeaturesVersion>2.7.0</MicrosoftCodeAnalysisCSharpFeaturesVersion>
Expand Down
20 changes: 14 additions & 6 deletions tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.23" />
<package id="Microsoft.Build" version="15.3.409" />
<package id="Microsoft.Build.Framework" version="15.3.409" />
<package id="Microsoft.Build.Runtime" version="15.3.409" />
<package id="Microsoft.Build.Tasks.Core" version="15.3.409" />
<package id="Microsoft.Build.Utilities.Core" version="15.3.409" />
<package id="Microsoft.Net.Compilers" version="2.3.2" />
<package id="Microsoft.Build" version="15.6.82" />
<package id="Microsoft.Build.Framework" version="15.6.82" />
<package id="Microsoft.Build.Runtime" version="15.6.82" />
<package id="Microsoft.Build.Tasks.Core" version="15.6.82" />
<package id="Microsoft.Build.Utilities.Core" version="15.6.82" />
<package id="Microsoft.Net.Compilers" version="2.7.0" />
<package id="Microsoft.DotNet.MSBuildSdkResolver" version="2.1.300-preview2-008523" />
<package id="NuGet.Build.Tasks" version="4.6.1" />
<package id="NuGet.Commands" version="4.6.1" />
<package id="NuGet.Common" version="4.6.1" />
<package id="NuGet.Configuration" version="4.6.1" />
<package id="NuGet.Frameworks" version="4.6.1" />
<package id="NuGet.ProjectModel" version="4.6.1" />
<package id="NuGet.Protocol" version="4.6.1" />
<package id="NuGet.Versioning" version="4.6.1" />
<package id="runtime.linux-x64.Microsoft.NETCore.DotNetHostResolver" version="2.1.0-preview3-26404-02" />
<package id="runtime.osx-x64.Microsoft.NETCore.DotNetHostResolver" version="2.1.0-preview3-26404-02" />
<package id="runtime.win-x64.Microsoft.NETCore.DotNetHostResolver" version="2.1.0-preview3-26404-02" />
Expand Down

0 comments on commit 937a39a

Please sign in to comment.