Skip to content
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

Fix nbgv dependencies #660

Merged
merged 4 commits into from Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 20 additions & 6 deletions src/nbgv/Program.cs
Expand Up @@ -215,9 +215,23 @@ private static Parser BuildCommandLine()
}
}
}, (MiddlewareOrder)(-3000)) // MiddlewareOrderInternal.ExceptionHandler so [parse] directive is accurate.
.UseExceptionHandler((ex, context) => PrintException(ex, context))
.Build();
}

private static void PrintException(Exception ex, InvocationContext context)
{
try
{
Console.Error.WriteLine("Unhandled exception: {0}", ex);
}
catch (Exception ex2)
{
Console.Error.WriteLine("Unhandled exception: {0}", ex.Message);
Console.Error.WriteLine("Unhandled exception while trying to print string version of the above exception: {0}", ex2);
}
}

private static int MainInner(string[] args)
{
try
Expand Down Expand Up @@ -347,16 +361,16 @@ private static int OnInstallCommand(string path, string version, IReadOnlyList<s
return (int)ExitCodes.OK;
}

private static int OnGetVersionCommand(string project, IReadOnlyList<string> metadata, string format, string variable, string commitIsh)
private static int OnGetVersionCommand(string project, IReadOnlyList<string> metadata, string format, string variable, string commitish)
{
if (string.IsNullOrEmpty(format))
{
format = DefaultOutputFormat;
}

if (string.IsNullOrEmpty(commitIsh))
if (string.IsNullOrEmpty(commitish))
{
commitIsh = DefaultRef;
commitish = DefaultRef;
}

string searchPath = GetSpecifiedOrCurrentDirectoryPath(project);
Expand All @@ -368,9 +382,9 @@ private static int OnGetVersionCommand(string project, IReadOnlyList<string> met
return (int)ExitCodes.NoGitRepo;
}

if (!context.TrySelectCommit(commitIsh))
if (!context.TrySelectCommit(commitish))
{
Console.Error.WriteLine("rev-parse produced no commit for {0}", commitIsh);
Console.Error.WriteLine("rev-parse produced no commit for {0}", commitish);
return (int)ExitCodes.BadGitRef;
}

Expand Down Expand Up @@ -759,7 +773,7 @@ private static async Task<string> GetLatestPackageVersionAsync(string packageId,
var providers = new List<Lazy<INuGetResourceProvider>>();
providers.AddRange(Repository.Provider.GetCoreV3()); // Add v3 API support

var sourceRepositoryProvider = new SourceRepositoryProvider(settings, providers);
var sourceRepositoryProvider = new SourceRepositoryProvider(new PackageSourceProvider(settings), providers);

// Select package sources based on NuGet.Config files or given options, as 'nuget.exe restore' command does
// See also 'DownloadCommandBase.GetPackageSources(ISettings)' at https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Clients/NuGet.CommandLine/Commands/DownloadCommandBase.cs
Expand Down
5 changes: 2 additions & 3 deletions src/nbgv/nbgv.csproj
Expand Up @@ -10,12 +10,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NuGet.PackageManagement" Version="4.9.3" NoWarn="NU1701" />
<PackageReference Include="NuGet.Resolver" Version="4.9.3" />
<PackageReference Include="NuGet.PackageManagement" Version="5.11.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
<PackageReference Include="Nerdbank.GitVersioning.LKG" Version="3.4.173-alpha" PrivateAssets="all" />
<PackageReference Include="System.Diagnostics.Tools" Version="4.3.0" />
<PackageReference Include="Microsoft.Build" Version="15.9.20" />
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
</ItemGroup>

<ItemGroup>
Expand Down