|
8 | 8 | using Microsoft.NET.TestFramework.Commands;
|
9 | 9 | using Xunit;
|
10 | 10 | using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
|
| 11 | +using System.Xml.Linq; |
| 12 | +using System.Linq; |
| 13 | +using FluentAssertions; |
11 | 14 |
|
12 | 15 | namespace Microsoft.NET.Build.Tests
|
13 | 16 | {
|
@@ -79,5 +82,55 @@ public void It_builds_desktop_library_successfully_on_windows()
|
79 | 82 | "netstandard1.5/DesktopAndNetStandard.deps.json"
|
80 | 83 | });
|
81 | 84 | }
|
| 85 | + |
| 86 | + [Theory] |
| 87 | + [InlineData("1", "win7-x86", "win7-x86;win7-x64", "win10-arm", "win7-x86;linux;WIN7-X86;unix", "osx-10.12", "win8-arm;win8-arm-aot", |
| 88 | + "win7-x86;win7-x64;win10-arm;linux;unix;osx-10.12;win8-arm;win8-arm-aot")] |
| 89 | + public void It_combines_inner_rids_for_restore( |
| 90 | + string identifier, |
| 91 | + string outerRid, |
| 92 | + string outerRids, |
| 93 | + string firstFrameworkRid, |
| 94 | + string firstFrameworkRids, |
| 95 | + string secondFrameworkRid, |
| 96 | + string secondFrameworkRids, |
| 97 | + string expectedCombination) |
| 98 | + { |
| 99 | + |
| 100 | + if (UsingFullFrameworkMSBuild) |
| 101 | + { |
| 102 | + // Remove when Jenkins has desktop msbuild without import of Microsoft.NuGet.targets |
| 103 | + // https://github.com/dotnet/sdk/issues/874 |
| 104 | + expectedCombination += ";win;win-x86;win-x64"; |
| 105 | + } |
| 106 | + |
| 107 | + var testAsset = _testAssetsManager |
| 108 | + .CopyTestAsset(Path.Combine("CrossTargeting", "NetStandardAndNetCoreApp"), identifier: identifier) |
| 109 | + .WithSource() |
| 110 | + .WithProjectChanges(project => |
| 111 | + { |
| 112 | + var ns = project.Root.Name.Namespace; |
| 113 | + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); |
| 114 | + |
| 115 | + propertyGroup.Add( |
| 116 | + new XElement(ns + "RuntimeIdentifier", outerRid), |
| 117 | + new XElement(ns + "RuntimeIdentifiers", outerRids)); |
| 118 | + |
| 119 | + propertyGroup.AddAfterSelf( |
| 120 | + new XElement(ns + "PropertyGroup", |
| 121 | + new XAttribute(ns + "Condition", "'$(TargetFramework)' == 'netstandard1.5'"), |
| 122 | + new XElement(ns + "RuntimeIdentifier", firstFrameworkRid), |
| 123 | + new XElement(ns + "RuntimeIdentifiers", firstFrameworkRids)), |
| 124 | + new XElement(ns + "PropertyGroup", |
| 125 | + new XAttribute(ns + "Condition", "'$(TargetFramework)' == 'netcoreapp1.0'"), |
| 126 | + new XElement(ns + "RuntimeIdentifier", secondFrameworkRid), |
| 127 | + new XElement(ns + "RuntimeIdentifiers", secondFrameworkRids))); |
| 128 | + }); |
| 129 | + |
| 130 | + var command = new GetValuesCommand(Stage0MSBuild, testAsset.TestRoot, "", valueName: "RuntimeIdentifiers"); |
| 131 | + command.DependsOnTargets = "GetAllRuntimeIdentifiers"; |
| 132 | + command.Execute().Should().Pass(); |
| 133 | + command.GetValues().Should().BeEquivalentTo(expectedCombination.Split(';')); |
| 134 | + } |
82 | 135 | }
|
83 | 136 | }
|
0 commit comments