Skip to content

Commit

Permalink
Fix --source parameter for DotNetRestore to be collection
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Oct 10, 2018
1 parent bb3c3ac commit cc6911a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions build/specifications/DotNet.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <c>&lt;RuntimeIdentifiers&gt;</c> tag in the <em>.csproj</em> file. For a list of Runtime Identifiers (RIDs), see the <a href=\"https://docs.microsoft.com/en-us/dotnet/core/rid-catalog\">RID catalog</a>. Provide multiple RIDs by specifying this option multiple times."
},
{
"name": "Source",
"type": "string",
"name": "Sources",
"type": "List<string>",
"format": "--source {value}",
"help": "Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times."
},
Expand Down
61 changes: 52 additions & 9 deletions source/Nuke.Common/Tools/DotNet/DotNet.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ public partial class DotNetRestoreSettings : ToolSettings
public virtual IReadOnlyList<string> Runtimes => RuntimesInternal.AsReadOnly();
internal List<string> RuntimesInternal { get; set; } = new List<string>();
/// <summary><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
public virtual string Source { get; internal set; }
public virtual IReadOnlyList<string> Sources => SourcesInternal.AsReadOnly();
internal List<string> SourcesInternal { get; set; } = new List<string>();
/// <summary><p>Sets the verbosity level of the command. Allowed values are <c>q[uiet]</c>, <c>m[inimal]</c>, <c>n[ormal]</c>, <c>d[etailed]</c>, and <c>diag[nostic]</c>.</p></summary>
public virtual DotNetVerbosity Verbosity { get; internal set; }
protected override Arguments ConfigureArguments(Arguments arguments)
Expand All @@ -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);
}
Expand Down Expand Up @@ -2192,21 +2193,63 @@ public static DotNetRestoreSettings RemoveRuntimes(this DotNetRestoreSettings to
return toolSettings;
}
#endregion
#region Source
/// <summary><p><em>Sets <see cref="DotNetRestoreSettings.Source"/>.</em></p><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
#region Sources
/// <summary><p><em>Sets <see cref="DotNetRestoreSettings.Sources"/> to a new list.</em></p><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
[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;
}
/// <summary><p><em>Resets <see cref="DotNetRestoreSettings.Source"/>.</em></p><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
/// <summary><p><em>Sets <see cref="DotNetRestoreSettings.Sources"/> to a new list.</em></p><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
[Pure]
public static DotNetRestoreSettings ResetSource(this DotNetRestoreSettings toolSettings)
public static DotNetRestoreSettings SetSources(this DotNetRestoreSettings toolSettings, IEnumerable<string> sources)
{
toolSettings = toolSettings.NewInstance();
toolSettings.Source = null;
toolSettings.SourcesInternal = sources.ToList();
return toolSettings;
}
/// <summary><p><em>Adds values to <see cref="DotNetRestoreSettings.Sources"/>.</em></p><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
[Pure]
public static DotNetRestoreSettings AddSources(this DotNetRestoreSettings toolSettings, params string[] sources)
{
toolSettings = toolSettings.NewInstance();
toolSettings.SourcesInternal.AddRange(sources);
return toolSettings;
}
/// <summary><p><em>Adds values to <see cref="DotNetRestoreSettings.Sources"/>.</em></p><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
[Pure]
public static DotNetRestoreSettings AddSources(this DotNetRestoreSettings toolSettings, IEnumerable<string> sources)
{
toolSettings = toolSettings.NewInstance();
toolSettings.SourcesInternal.AddRange(sources);
return toolSettings;
}
/// <summary><p><em>Clears <see cref="DotNetRestoreSettings.Sources"/>.</em></p><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
[Pure]
public static DotNetRestoreSettings ClearSources(this DotNetRestoreSettings toolSettings)
{
toolSettings = toolSettings.NewInstance();
toolSettings.SourcesInternal.Clear();
return toolSettings;
}
/// <summary><p><em>Removes values from <see cref="DotNetRestoreSettings.Sources"/>.</em></p><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
[Pure]
public static DotNetRestoreSettings RemoveSources(this DotNetRestoreSettings toolSettings, params string[] sources)
{
toolSettings = toolSettings.NewInstance();
var hashSet = new HashSet<string>(sources);
toolSettings.SourcesInternal.RemoveAll(x => hashSet.Contains(x));
return toolSettings;
}
/// <summary><p><em>Removes values from <see cref="DotNetRestoreSettings.Sources"/>.</em></p><p>Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the <em>NuGet.config</em> file(s). Multiple sources can be provided by specifying this option multiple times.</p></summary>
[Pure]
public static DotNetRestoreSettings RemoveSources(this DotNetRestoreSettings toolSettings, IEnumerable<string> sources)
{
toolSettings = toolSettings.NewInstance();
var hashSet = new HashSet<string>(sources);
toolSettings.SourcesInternal.RemoveAll(x => hashSet.Contains(x));
return toolSettings;
}
#endregion
Expand Down

0 comments on commit cc6911a

Please sign in to comment.