-
Notifications
You must be signed in to change notification settings - Fork 689
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
Improvements for nuget.exe install #1634
Conversation
@emgarten not so great if it doesn't build!! :P |
@mishra14 I assume that's why it's a WIP :P |
e434394
to
6d5bed7
Compare
6d5bed7
to
406dc88
Compare
Tests are passing on teamcity |
CultureInfo.CurrentCulture, | ||
LocalizedResourceManager.GetString("RestoreCommandPackageRestoreOptOutMessage"), | ||
NuGetResources.PackageRestoreConsentCheckBoxText.Replace("&", "")); | ||
Console.WriteLine(message); | ||
} | ||
|
||
return PerformV2Restore(configFilePath, installPath); | ||
return PerformV2RestoreAsync(configFilePath, installPath); |
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.
why not await here?
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.
it returns the task and is awaited higher up
} | ||
else | ||
{ | ||
var packageId = Arguments[0]; | ||
var version = Version != null ? new NuGetVersion(Version) : null; | ||
return InstallPackage(packageId, version, installPath); | ||
return InstallPackageAsync(packageId, version, installPath); |
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.
same
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.
also returning the task
@@ -45,6 +45,11 @@ public ICollection<string> Source | |||
[Option(typeof(NuGetCommand), "CommandPackageSaveMode")] | |||
public string PackageSaveMode { get; set; } | |||
|
|||
/// <summary> | |||
/// If true the global packages folder will be added as a source. |
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.
If true the global packages folder will not be added as a source
@@ -117,7 +122,7 @@ protected IReadOnlyCollection<Configuration.PackageSource> GetPackageSources(Con | |||
var availableSources = SourceProvider.LoadPackageSources().Where(source => source.IsEnabled); | |||
var packageSources = new List<Configuration.PackageSource>(); | |||
|
|||
if (!NoCache) | |||
if (!NoCache && !ExcludeCacheAsSource) |
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.
Is "NoCache" also used in other place? why can't just use "NoCache" to exclude cache
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.
ExcludeCacheAsSource is a subset of NoCache
var packageReference = installedPackagesList.Where(p => p.PackageIdentity.Equals(packageIdentity)).FirstOrDefault(); | ||
if (packageReference == null) | ||
{ | ||
// Package does not exit |
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.
exist
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.
how will people realize how ExcludeCacheAsSource work?
@@ -198,6 +207,17 @@ internal string ResolveInstallPath() | |||
{ | |||
GetDownloadResultUtility.CleanUpDirectDownloads(downloadContext); | |||
} | |||
|
|||
if (!result.Restored || failedEvents.Count > 0) |
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.
👍
// Avoid searching for the highest version in the global packages folder, | ||
// it needs to come from the feeds instead. Once found it may come from | ||
// the global packages folder unless NoCache is true. | ||
ExcludeCacheAsSource = true; |
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.
this seems a bit arbitrary. how will people realize what is the resolution logic?
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.
Discussed offline. This is fine as we set ExcludeCacheAsSource only if we see floating versions in the dependency list.
@@ -333,7 +333,7 @@ private void ReadSettings(PackageRestoreInputs packageRestoreInputs) | |||
Settings.Priority.Select(x => Path.Combine(x.Root, x.FileName)), | |||
packageSources.Select(x => x.Source), | |||
installCount, | |||
collectorLogger.Errors.Concat(failedEvents.Select(e => new RestoreLogMessage(LogLevel.Error, e.Exception.Message)))); | |||
collectorLogger.Errors.Concat(failedEvents.Select(e => new RestoreLogMessage(LogLevel.Error, NuGetLogCode.Undefined, e.Exception.Message)))); |
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.
👍
/// <exception cref="ArgumentNullException">Thrown if <paramref name="targetFramework" /> is <c>null</c>.</exception> | ||
public FolderNuGetProject(string root, PackagePathResolver packagePathResolver, NuGetFramework targetFramework) | ||
{ | ||
if (targetFramework == null) |
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.
nit: simplify these just as root
and packagePathResolver
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.
Discussed offline. Looks good
* Allow updating packages when -ExcludeVersion is used * Improved detection of already installed packages when -ExcludeVersion is used * Adding -Framework switch to allow setting the target framework used when resolving dependencies. * Remove NU1000 code from packages.config restore errors. * Avoid unneeded downloads when a version is not given and the package is cached. * Disable parallel for mono * Display errors and return a non-zero exit when install on packages.config fails * Remove old files during upgrades with -ExcludeVersion Fixes NuGet/Home#5743 Fixes NuGet/Home#5737 Fixes NuGet/Home#5736 Fixes NuGet/Home#5741 Fixes NuGet/Home#5017 Fixes NuGet/Home#3957 Fixes NuGet/Home#2405
406dc88
to
8614255
Compare
NuGet/NuGet.Client#1634 introduced a Framework option for the install command.
Improvements for nuget.exe install
Fixes NuGet/Home#5743
Fixes NuGet/Home#5737
Fixes NuGet/Home#5736
Fixes NuGet/Home#5741
Fixes NuGet/Home#5017
Fixes NuGet/Home#3957
Fixes NuGet/Home#2405
Partial fix for NuGet/Home#3244