-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use MSBuild SDK Resolvers #974
Changes from all commits
cf95332
7a7ccf6
01c83b7
9104d53
c55b9e7
3986f5c
7904f81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,6 +218,27 @@ Task("InstallMonoAssets") | |
Run("chmod", $"+x '{CombinePaths(env.Folders.Mono, "run")}'"); | ||
}); | ||
|
||
void CopyDotNetHostResolver(BuildEnvironment env, string os, string arch, string hostFileName, string targetFolderBase, bool copyToArchSpecificFolder) | ||
{ | ||
var source = CombinePaths( | ||
env.Folders.Tools, | ||
$"runtime.{os}-{arch}.Microsoft.NETCore.DotNetHostResolver", | ||
"runtimes", | ||
$"{os}-{arch}", | ||
"native", | ||
hostFileName); | ||
|
||
var targetFolder = targetFolderBase; | ||
|
||
if (copyToArchSpecificFolder) | ||
{ | ||
targetFolder = CombinePaths(targetFolderBase, arch); | ||
DirectoryHelper.ForceCreate(targetFolder); | ||
} | ||
|
||
FileHelper.Copy(source, CombinePaths(targetFolder, hostFileName)); | ||
} | ||
|
||
/// <summary> | ||
/// Create '.msbuild' folder and copy content to it. | ||
/// </summary> | ||
|
@@ -227,17 +248,43 @@ Task("CreateMSBuildFolder") | |
{ | ||
DirectoryHelper.ForceCreate(env.Folders.MSBuild); | ||
|
||
if (!Platform.Current.IsWindows) | ||
string sdkResolverTFM; | ||
|
||
if (Platform.Current.IsWindows) | ||
{ | ||
Information("Copying Mono MSBuild runtime..."); | ||
DirectoryHelper.Copy(env.Folders.MonoMSBuildRuntime, env.Folders.MSBuild); | ||
Information("Copying MSBuild runtime..."); | ||
var msbuildRuntimeFolder = CombinePaths(env.Folders.Tools, "Microsoft.Build.Runtime", "contentFiles", "any", "net46"); | ||
DirectoryHelper.Copy(msbuildRuntimeFolder, env.Folders.MSBuild); | ||
sdkResolverTFM = "net46"; | ||
} | ||
else | ||
{ | ||
Information("Copying MSBuild runtime..."); | ||
Information("Copying Mono MSBuild runtime..."); | ||
DirectoryHelper.Copy(env.Folders.MonoMSBuildRuntime, env.Folders.MSBuild); | ||
sdkResolverTFM = "netstandard1.5"; | ||
} | ||
|
||
var msbuildRuntimeFolder = CombinePaths(env.Folders.Tools, "Microsoft.Build.Runtime", "contentFiles", "any", "net46"); | ||
DirectoryHelper.Copy(msbuildRuntimeFolder, env.Folders.MSBuild); | ||
// Copy MSBuild SDK Resolver and DotNetHostResolver | ||
Information("Coping MSBuild SDK resolver..."); | ||
var sdkResolverFolder = CombinePaths(env.Folders.Tools, "Microsoft.DotNet.MSBuildSdkResolver", "lib", sdkResolverTFM); | ||
var msbuildSdkResolverFolder = CombinePaths(env.Folders.MSBuild, "SdkResolvers", "Microsoft.DotNet.MSBuildSdkResolver"); | ||
DirectoryHelper.ForceCreate(msbuildSdkResolverFolder); | ||
FileHelper.Copy( | ||
source: CombinePaths(sdkResolverFolder, "Microsoft.DotNet.MSBuildSdkResolver.dll"), | ||
destination: CombinePaths(msbuildSdkResolverFolder, "Microsoft.DotNet.MSBuildSdkResolver.dll")); | ||
|
||
if (Platform.Current.IsWindows) | ||
{ | ||
CopyDotNetHostResolver(env, "win", "x86", "hostfxr.dll", msbuildSdkResolverFolder, copyToArchSpecificFolder: true); | ||
CopyDotNetHostResolver(env, "win", "x64", "hostfxr.dll", msbuildSdkResolverFolder, copyToArchSpecificFolder: true); | ||
} | ||
else if (Platform.Current.IsMacOS) | ||
{ | ||
CopyDotNetHostResolver(env, "osx", "x64", "libhostfxr.dylib", msbuildSdkResolverFolder, copyToArchSpecificFolder: false); | ||
} | ||
else if (Platform.Current.IsLinux) | ||
{ | ||
CopyDotNetHostResolver(env, "linux", "x64", "libhostfxr.so", msbuildSdkResolverFolder, copyToArchSpecificFolder: false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the lack of linux-x86 no longer an issue for you? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realized that it's kind of a non-issue since .NET Core isn't supported on linux-x86 anyway. Since I can't install a .NET Core SDK on linux-x86, I can't see a need to resolve to it on linux-x86. 😄 |
||
} | ||
|
||
// Copy content of Microsoft.Net.Compilers | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("OmniSharp.MSBuild.Tests")] | ||
[assembly: InternalsVisibleTo("OmniSharp.MSBuild.Tests")] | ||
[assembly: InternalsVisibleTo("TestUtility")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, we actually want to terminate the cli-deps feed, since it was actually built to contain all the packages the CLI depends on, but we have moved away from that approach since then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was an old feed from long ago.