Skip to content

Commit c83668a

Browse files
authored
[automated] Merge branch 'release/9.0.2xx' => 'main' (#45587)
2 parents bc05780 + 67fe7c4 commit c83668a

File tree

9 files changed

+81
-100
lines changed

9 files changed

+81
-100
lines changed

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@
8787
<Sha>8d395fd2729ad43428252f37656eb5c97a180987</Sha>
8888
<SourceBuild RepoName="msbuild" ManagedOnly="true" />
8989
</Dependency>
90-
<Dependency Name="Microsoft.FSharp.Compiler" Version="13.9.200-beta.24617.1">
90+
<Dependency Name="Microsoft.FSharp.Compiler" Version="13.9.200-beta.25056.5">
9191
<Uri>https://github.com/dotnet/fsharp</Uri>
92-
<Sha>5af96504f10836eca6ce804ab3cdd28c042fa35a</Sha>
92+
<Sha>63a09289745da5c256e7baf5f4194a750b1ec878</Sha>
9393
</Dependency>
9494
<!-- Intermediate is necessary for source build. -->
95-
<Dependency Name="Microsoft.SourceBuild.Intermediate.fsharp" Version="9.0.200-beta.24617.1">
95+
<Dependency Name="Microsoft.SourceBuild.Intermediate.fsharp" Version="9.0.200-beta.25056.5">
9696
<Uri>https://github.com/dotnet/fsharp</Uri>
97-
<Sha>5af96504f10836eca6ce804ab3cdd28c042fa35a</Sha>
97+
<Sha>63a09289745da5c256e7baf5f4194a750b1ec878</Sha>
9898
<SourceBuild RepoName="fsharp" ManagedOnly="true" />
9999
</Dependency>
100100
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-3.25055.1">

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
</PropertyGroup>
206206
<PropertyGroup>
207207
<!-- Dependencies from https://github.com/Microsoft/visualfsharp -->
208-
<MicrosoftFSharpCompilerPackageVersion>13.9.200-beta.24617.1</MicrosoftFSharpCompilerPackageVersion>
208+
<MicrosoftFSharpCompilerPackageVersion>13.9.200-beta.25056.5</MicrosoftFSharpCompilerPackageVersion>
209209
</PropertyGroup>
210210
<PropertyGroup>
211211
<!-- Dependencies from https://github.com/dotnet/roslyn -->

src/Cli/dotnet/commands/dotnet-help/HelpCommand.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
using Microsoft.DotNet.Cli.Utils;
88
using Microsoft.TemplateEngine.Cli.Commands;
99

10+
using NuGetDocumentedCommand = NuGet.CommandLine.XPlat.Commands.DocumentedCommand;
11+
1012
namespace Microsoft.DotNet.Tools.Help
1113
{
1214
public class HelpCommand(string[] helpArgs)
@@ -107,6 +109,11 @@ private bool TryGetDocsLink(string[] command, out string docsLink)
107109
docsLink = dc.DocsLink;
108110
return true;
109111
}
112+
else if (parsedCommand?.CommandResult?.Command is NuGetDocumentedCommand ndc)
113+
{
114+
docsLink = ndc.HelpUrl;
115+
return true;
116+
}
110117
docsLink = null;
111118
return false;
112119
}

src/Cli/dotnet/commands/dotnet-nuget/NuGetCommandParser.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private static CliCommand ConstructCommand()
3636
command.Subcommands.Add(GetVerifyCommand());
3737
command.Subcommands.Add(GetTrustCommand());
3838
command.Subcommands.Add(GetSignCommand());
39-
command.Subcommands.Add(GetWhyCommand());
39+
NuGet.CommandLine.XPlat.Commands.Why.WhyCommand.GetWhyCommand(command);
4040

4141
command.SetAction(NuGetCommand.Run);
4242

@@ -218,19 +218,5 @@ private static CliCommand GetSignCommand()
218218

219219
return signCommand;
220220
}
221-
222-
private static CliCommand GetWhyCommand()
223-
{
224-
DocumentedCommand whyCommand = new("why", "https://learn.microsoft.com/dotnet/core/tools/dotnet-nuget-why");
225-
whyCommand.Arguments.Add(new CliArgument<string>("PROJECT|SOLUTION") { Arity = ArgumentArity.ExactlyOne });
226-
whyCommand.Arguments.Add(new CliArgument<string>("PACKAGE") { Arity = ArgumentArity.ExactlyOne });
227-
228-
whyCommand.Options.Add(new ForwardedOption<IEnumerable<string>>("--framework", "-f") { Arity = ArgumentArity.ZeroOrMore }
229-
.ForwardAsManyArgumentsEachPrefixedByOption("--framework")
230-
.AllowSingleArgPerToken());
231-
232-
whyCommand.SetAction(NuGetCommand.Run);
233-
return whyCommand;
234-
}
235221
}
236222
}

src/Cli/dotnet/dotnet.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" />
103103
<PackageReference Include="Microsoft.VisualStudio.SolutionPersistence" />
104104
<PackageReference Include="Newtonsoft.Json" />
105+
<PackageReference Include="NuGet.CommandLine.XPlat" />
105106
<PackageReference Include="Microsoft.ApplicationInsights" />
106107
<PackageReference Include="Microsoft.Build" />
107108
<PackageReference Include="Microsoft.NET.HostModel" />

src/SourceBuild/patches/fsharp/0001-Upgrade-some-runtime-packages.patch

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,8 @@ private ToolPackSupport AddToolPack(
828828
runtimePackToDownload.SetMetadata(MetadataKeys.Version, packVersion);
829829
}
830830

831+
runtimePackItem.SetMetadata(MetadataKeys.RuntimeIdentifier, hostRuntimeIdentifier);
832+
831833
switch (toolPackType)
832834
{
833835
case ToolPackType.Crossgen2:

src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,7 @@ protected override void ExecuteCore()
5252
_runtimePack = GetNETCoreAppRuntimePack();
5353
_targetRuntimeIdentifier = _runtimePack?.GetMetadata(MetadataKeys.RuntimeIdentifier);
5454

55-
// Get the list of runtime identifiers that we support and can target
56-
ITaskItem targetingPack = GetNETCoreAppTargetingPack();
57-
string supportedRuntimeIdentifiers = targetingPack?.GetMetadata(MetadataKeys.RuntimePackRuntimeIdentifiers);
58-
59-
var runtimeGraph = new RuntimeGraphCache(this).GetRuntimeGraph(RuntimeGraphPath);
60-
var supportedRIDsList = supportedRuntimeIdentifiers == null ? Array.Empty<string>() : supportedRuntimeIdentifiers.Split(';');
61-
62-
// Get the best RID for the host machine, which will be used to validate that we can run crossgen for the target platform and architecture
63-
_hostRuntimeIdentifier = NuGetUtils.GetBestMatchingRid(
64-
runtimeGraph,
65-
NETCoreSdkRuntimeIdentifier,
66-
supportedRIDsList,
67-
out _);
68-
69-
if (_hostRuntimeIdentifier == null || _targetRuntimeIdentifier == null)
55+
if (_targetRuntimeIdentifier == null)
7056
{
7157
Log.LogError(Strings.ReadyToRunNoValidRuntimePackageError);
7258
return;
@@ -96,6 +82,13 @@ protected override void ExecuteCore()
9682

9783
private bool ValidateCrossgenSupport()
9884
{
85+
_hostRuntimeIdentifier = GetHostRuntimeIdentifierForCrossgen();
86+
if (_hostRuntimeIdentifier == null)
87+
{
88+
Log.LogError(Strings.ReadyToRunNoValidRuntimePackageError);
89+
return false;
90+
}
91+
9992
_crossgenTool.PackagePath = _runtimePack?.GetMetadata(MetadataKeys.PackageDirectory);
10093
if (_crossgenTool.PackagePath == null)
10194
{
@@ -121,12 +114,39 @@ private bool ValidateCrossgenSupport()
121114
}
122115

123116
return true;
117+
118+
string GetHostRuntimeIdentifierForCrossgen()
119+
{
120+
// Crossgen's host RID comes from the runtime pack that Crossgen will be loaded from.
121+
122+
// Get the list of runtime identifiers that we support and can target
123+
ITaskItem targetingPack = GetNETCoreAppTargetingPack();
124+
string supportedRuntimeIdentifiers = targetingPack?.GetMetadata(MetadataKeys.RuntimePackRuntimeIdentifiers);
125+
126+
var runtimeGraph = new RuntimeGraphCache(this).GetRuntimeGraph(RuntimeGraphPath);
127+
var supportedRIDsList = supportedRuntimeIdentifiers == null ? Array.Empty<string>() : supportedRuntimeIdentifiers.Split(';');
128+
129+
// Get the best RID for the host machine, which will be used to validate that we can run crossgen for the target platform and architecture
130+
return NuGetUtils.GetBestMatchingRid(
131+
runtimeGraph,
132+
NETCoreSdkRuntimeIdentifier,
133+
supportedRIDsList,
134+
out _);
135+
}
124136
}
125137

126138
private bool ValidateCrossgen2Support()
127139
{
128140
ITaskItem crossgen2Pack = Crossgen2Packs?.FirstOrDefault();
129-
_crossgen2Tool.PackagePath = crossgen2Pack?.GetMetadata(MetadataKeys.PackageDirectory);
141+
142+
_hostRuntimeIdentifier = crossgen2Pack?.GetMetadata(MetadataKeys.RuntimeIdentifier);
143+
if (_hostRuntimeIdentifier == null)
144+
{
145+
Log.LogError(Strings.ReadyToRunNoValidRuntimePackageError);
146+
return false;
147+
}
148+
149+
_crossgen2Tool.PackagePath = crossgen2Pack.GetMetadata(MetadataKeys.PackageDirectory);
130150

131151
if (string.IsNullOrEmpty(_crossgen2Tool.PackagePath) ||
132152
!NuGetVersion.TryParse(crossgen2Pack.GetMetadata(MetadataKeys.NuGetPackageVersion), out NuGetVersion crossgen2PackVersion))
@@ -181,42 +201,19 @@ private bool GetCrossgen2TargetOS(out string targetOS)
181201

182202
// Determine targetOS based on target rid.
183203
// Use the runtime graph to support non-portable target rids.
204+
// Use the full target rid instead of just the target OS as the runtime graph
205+
// may only have the full target rid and not an OS-only rid for non-portable target rids
206+
// added by our source-build partners.
184207
var runtimeGraph = new RuntimeGraphCache(this).GetRuntimeGraph(RuntimeGraphPath);
185208
string portablePlatform = NuGetUtils.GetBestMatchingRid(
186209
runtimeGraph,
187-
_targetPlatform,
188-
new[] { "linux", "linux-musl", "osx", "win", "freebsd", "illumos" },
210+
_targetRuntimeIdentifier,
211+
new[] { "linux", "osx", "win", "freebsd", "illumos" },
189212
out _);
190213

191-
// For source-build, allow the bootstrap SDK rid to be unknown to the runtime repo graph.
192-
if (portablePlatform == null && _targetRuntimeIdentifier == _hostRuntimeIdentifier)
193-
{
194-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
195-
{
196-
portablePlatform = "win";
197-
}
198-
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
199-
{
200-
portablePlatform = "linux";
201-
}
202-
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD")))
203-
{
204-
portablePlatform = "freebsd";
205-
}
206-
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ILLUMOS")))
207-
{
208-
portablePlatform = "illumos";
209-
}
210-
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
211-
{
212-
portablePlatform = "osx";
213-
}
214-
}
215-
216214
targetOS = portablePlatform switch
217215
{
218216
"linux" => "linux",
219-
"linux-musl" => "linux",
220217
"osx" => "osx",
221218
"win" => "windows",
222219
"freebsd" => "freebsd",

test/dotnet-nuget.UnitTests/GivenANuGetCommand.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ public GivenANuGetCommand(ITestOutputHelper log) : base(log)
7777
"--interactive",
7878
"--verbosity", "detailed",
7979
"--format", "json"}, 0)]
80-
[InlineData(new[] { "why" }, 0)]
81-
[InlineData(new[] { "why", "C:\\path", "Fake.Package" }, 0)]
82-
[InlineData(new[] { "why", "C:\\path", "Fake.Package", "--framework", "net472", "-f", "netcoreapp5.0" }, 0)]
8380

8481
public void ItPassesCommandIfSupported(string[] inputArgs, int result)
8582
{
@@ -112,5 +109,29 @@ public void ItAcceptsPrefixedOption()
112109
.And
113110
.HaveStdErrContaining("Required argument missing for option: '-ss'.");
114111
}
112+
113+
[Fact]
114+
public void ItHasAWhySubcommand()
115+
{
116+
var testAssetName = "NewtonSoftDependentProject";
117+
var testAsset = _testAssetsManager
118+
.CopyTestAsset(testAssetName)
119+
.WithSource();
120+
var projectDirectory = testAsset.Path;
121+
122+
new RestoreCommand(testAsset)
123+
.Execute()
124+
.Should()
125+
.Pass()
126+
.And.NotHaveStdErr();
127+
128+
new DotnetCommand(Log)
129+
.WithWorkingDirectory(projectDirectory)
130+
.Execute("nuget", "why", "newtonsoft.json")
131+
.Should()
132+
.Pass()
133+
.And.NotHaveStdErr()
134+
.And.HaveStdOutContaining("has the following dependency");
135+
}
115136
}
116137
}

0 commit comments

Comments
 (0)