From e1a7044b453b589a82a930af8bbc4603bd262036 Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Tue, 15 Mar 2016 10:42:59 -0700 Subject: [PATCH] add manual merge of RID fallback graph for Windows --- .../SharedFrameworkTargets.cs | 22 ++++++++++++++++++- .../rid-fallbacks/windows.json | 12 ++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/sharedframework/rid-fallbacks/windows.json diff --git a/scripts/dotnet-cli-build/SharedFrameworkTargets.cs b/scripts/dotnet-cli-build/SharedFrameworkTargets.cs index e6bd47a78..2892bc2f2 100644 --- a/scripts/dotnet-cli-build/SharedFrameworkTargets.cs +++ b/scripts/dotnet-cli-build/SharedFrameworkTargets.cs @@ -9,6 +9,8 @@ using Microsoft.DotNet.Cli.Build.Framework; using Microsoft.Extensions.PlatformAbstractions; using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; namespace Microsoft.DotNet.Cli.Build { @@ -65,10 +67,28 @@ namespace Microsoft.DotNet.Cli.Build File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, $"framework{Constants.ExeSuffix}")); File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.dll")); File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.pdb")); + File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.runtimeconfig.json")); // Rename the .deps file + var destinationDeps = Path.Combine(SharedFrameworkNameAndVersionRoot, $"{SharedFrameworkName}.deps.json"); File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.deps"), Path.Combine(SharedFrameworkNameAndVersionRoot, $"{SharedFrameworkName}.deps")); - File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.deps.json"), Path.Combine(SharedFrameworkNameAndVersionRoot, $"{SharedFrameworkName}.deps.json")); + File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.deps.json"), destinationDeps); + + // Merge in the RID fallback graph + var fallbackFileName = PlatformServices.Default.Runtime.OperatingSystemPlatform.ToString().ToLowerInvariant() + ".json"; + var fallbackFile = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "rid-fallbacks", fallbackFileName); + if (File.Exists(fallbackFile)) + { + c.Info($"Merging in RID fallback graph: {fallbackFile}"); + var deps = JObject.Parse(File.ReadAllText(destinationDeps)); + var ridfallback = JObject.Parse(File.ReadAllText(fallbackFile)); + deps["runtimes"] = ridfallback["runtimes"]; + File.WriteAllText(destinationDeps, deps.ToString(Formatting.Indented)); + } + else + { + c.Warn($"RID fallback graph file not found: {fallbackFile}"); + } // corehost will be renamed to dotnet at some point and then we will not need to rename it here. File.Copy( diff --git a/src/sharedframework/rid-fallbacks/windows.json b/src/sharedframework/rid-fallbacks/windows.json new file mode 100644 index 000000000..aff335e39 --- /dev/null +++ b/src/sharedframework/rid-fallbacks/windows.json @@ -0,0 +1,12 @@ +{ + "runtimes": { + "win10-x64": [ "win10", "win81-x64", "win81", "win8-x64", "win8", "win7-x64", "win7", "win-x64", "win", "any", "base" ], + "win10-x86": [ "win10", "win81-x86", "win81", "win8-x86", "win8", "win7-x86", "win7", "win-x86", "win", "any", "base" ], + "win81-x64": [ "win81", "win8-x64", "win8", "win7-x64", "win7", "win-x64", "win", "any", "base" ], + "win81-x86": [ "win81", "win8-x86", "win8", "win7-x86", "win7", "win-x86", "win", "any", "base" ], + "win8-x64": [ "win8", "win7-x64", "win7", "win-x64", "win", "any", "base" ], + "win8-x86": [ "win8", "win7-x86", "win7", "win-x86", "win", "any", "base" ], + "win7-x64": [ "win7", "win-x64", "win", "any", "base" ], + "win7-x86": [ "win7", "win-x86", "win", "any", "base" ] + } +}