From cc6911ad1467f3e9118c91addbbbb1a805743ec3 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Wed, 10 Oct 2018 22:33:10 +0200 Subject: [PATCH] Fix --source parameter for DotNetRestore to be collection --- CHANGELOG.md | 3 +- build/specifications/DotNet.json | 4 +- .../Tools/DotNet/DotNet.Generated.cs | 61 ++++++++++++++++--- 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cb682eb5..676fcbfa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [vNext] +- Fixed `--source` parameter for `DotNetRestore` to be collection ## [0.10.4] / 2018-10-10 -- Fixed `GitRepository` when origin url is a ssh url without username. +- Fixed `GitRepository` when origin URL uses SSH without username ## [0.10.3] / 2018-10-05 - Fixed `WinRelativePath` and `UnixRelativePath` to use correct separator diff --git a/build/specifications/DotNet.json b/build/specifications/DotNet.json index 1494c63e4..780214ea3 100644 --- a/build/specifications/DotNet.json +++ b/build/specifications/DotNet.json @@ -258,8 +258,8 @@ "help": "Specifies a runtime for the package restore. This is used to restore packages for runtimes not explicitly listed in the <RuntimeIdentifiers> tag in the .csproj file. For a list of Runtime Identifiers (RIDs), see the RID catalog. Provide multiple RIDs by specifying this option multiple times." }, { - "name": "Source", - "type": "string", + "name": "Sources", + "type": "List", "format": "--source {value}", "help": "Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times." }, diff --git a/source/Nuke.Common/Tools/DotNet/DotNet.Generated.cs b/source/Nuke.Common/Tools/DotNet/DotNet.Generated.cs index d66c67591..e0f1df8b6 100644 --- a/source/Nuke.Common/Tools/DotNet/DotNet.Generated.cs +++ b/source/Nuke.Common/Tools/DotNet/DotNet.Generated.cs @@ -273,7 +273,8 @@ public partial class DotNetRestoreSettings : ToolSettings public virtual IReadOnlyList Runtimes => RuntimesInternal.AsReadOnly(); internal List RuntimesInternal { get; set; } = new List(); ///

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

- public virtual string Source { get; internal set; } + public virtual IReadOnlyList Sources => SourcesInternal.AsReadOnly(); + internal List SourcesInternal { get; set; } = new List(); ///

Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].

public virtual DotNetVerbosity Verbosity { get; internal set; } protected override Arguments ConfigureArguments(Arguments arguments) @@ -289,7 +290,7 @@ protected override Arguments ConfigureArguments(Arguments arguments) .Add("--no-dependencies", NoDependencies) .Add("--packages {value}", PackageDirectory) .Add("--runtime {value}", Runtimes) - .Add("--source {value}", Source) + .Add("--source {value}", Sources) .Add("--verbosity {value}", Verbosity); return base.ConfigureArguments(arguments); } @@ -2192,21 +2193,63 @@ public static DotNetRestoreSettings RemoveRuntimes(this DotNetRestoreSettings to return toolSettings; } #endregion - #region Source - ///

Sets .

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

+ #region Sources + ///

Sets to a new list.

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

[Pure] - public static DotNetRestoreSettings SetSource(this DotNetRestoreSettings toolSettings, string source) + public static DotNetRestoreSettings SetSources(this DotNetRestoreSettings toolSettings, params string[] sources) { toolSettings = toolSettings.NewInstance(); - toolSettings.Source = source; + toolSettings.SourcesInternal = sources.ToList(); return toolSettings; } - ///

Resets .

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

+ ///

Sets to a new list.

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

[Pure] - public static DotNetRestoreSettings ResetSource(this DotNetRestoreSettings toolSettings) + public static DotNetRestoreSettings SetSources(this DotNetRestoreSettings toolSettings, IEnumerable sources) { toolSettings = toolSettings.NewInstance(); - toolSettings.Source = null; + toolSettings.SourcesInternal = sources.ToList(); + return toolSettings; + } + ///

Adds values to .

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

+ [Pure] + public static DotNetRestoreSettings AddSources(this DotNetRestoreSettings toolSettings, params string[] sources) + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SourcesInternal.AddRange(sources); + return toolSettings; + } + ///

Adds values to .

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

+ [Pure] + public static DotNetRestoreSettings AddSources(this DotNetRestoreSettings toolSettings, IEnumerable sources) + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SourcesInternal.AddRange(sources); + return toolSettings; + } + ///

Clears .

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

+ [Pure] + public static DotNetRestoreSettings ClearSources(this DotNetRestoreSettings toolSettings) + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SourcesInternal.Clear(); + return toolSettings; + } + ///

Removes values from .

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

+ [Pure] + public static DotNetRestoreSettings RemoveSources(this DotNetRestoreSettings toolSettings, params string[] sources) + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(sources); + toolSettings.SourcesInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + ///

Removes values from .

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

+ [Pure] + public static DotNetRestoreSettings RemoveSources(this DotNetRestoreSettings toolSettings, IEnumerable sources) + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(sources); + toolSettings.SourcesInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion