Skip to content

Commit

Permalink
Merge pull request #96 from niklaslundberg/develop
Browse files Browse the repository at this point in the history
0.23.0
  • Loading branch information
niklaslundberg authored Jun 27, 2023
2 parents 6528be4 + d702475 commit 4ddc95c
Show file tree
Hide file tree
Showing 21 changed files with 212 additions and 224 deletions.
8 changes: 4 additions & 4 deletions src/Arbor.Tooler.ConsoleClient/ToolerConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static ToolerConsole Create(string[] args, ILogger logger) =>
public static ToolerConsole Create(string[] args, LogEventLevel minLevel = LogEventLevel.Warning)
{
Logger logger = new LoggerConfiguration()
.WriteTo.Console(standardErrorFromLevel: minLevel, outputTemplate: OutputTemplate)
.WriteTo.Console(outputTemplate: OutputTemplate, standardErrorFromLevel: minLevel)
.MinimumLevel.Debug()
.CreateLogger();

Expand All @@ -91,11 +91,11 @@ public async Task<int> RunAsync()
string? source = _args.GetCommandLineValue(CommandExtensions.Source);
string? config = _args.GetCommandLineValue(CommandExtensions.Config);

var packages = await nuGetPackageInstaller.GetAllVersionsAsync(new NuGetPackageId(packageId), maxRows: maxRows, nuGetSource: source, nugetConfig: config);
var packages = await nuGetPackageInstaller.GetAllVersionsAsync(new NuGetPackageId(packageId), nuGetSource: source, nugetConfig: config, maxRows: maxRows);

foreach (var package in packages)
{
Logger.Information(package.ToNormalizedString());
Logger.Information("{Version}", package.ToNormalizedString());
}

exitCode = 0;
Expand All @@ -120,7 +120,7 @@ public async Task<int> RunAsync()
}

NuGetDownloadResult nuGetDownloadResult = await new NuGetDownloadClient().DownloadNuGetAsync(
new NuGetDownloadSettings(downloadDirectory: downloadDirectory, nugetExeVersion: exeVersion, force: force),
new NuGetDownloadSettings(nugetExeVersion: exeVersion, downloadDirectory: downloadDirectory, force: force),
Logger).ConfigureAwait(false);

if (nuGetDownloadResult.Succeeded)
Expand Down
104 changes: 52 additions & 52 deletions src/Arbor.Tooler.ConsoleClient/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,60 +23,60 @@
},
"Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
"contentHash": "R2pZ3B0UjeyHShm9vG+Tu0EBb2lC8b0dFzV9gVn50ofHXh9Smjk6kTn7A/FdAsC8B5cKib1OnGYOXxRBz5XQDg=="
"resolved": "13.0.3",
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
},
"NuGet.Common": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "u5V3R9FzGHB57bcKhCjKdaaB3m+zzOIp7pXvcCVYa2fnXYUQVEoY7XE+nLKJwJqN6PXzQP9/ztUUSFl9uslNJw==",
"resolved": "6.6.1",
"contentHash": "hW5NtShErO3qbdkyv7doCRsFNK9Rlcc7mVjYM+hg1sOAWheTh/oo95DzNbsZthiqyHZfaioopfWtzmoxNw9h4g==",
"dependencies": {
"NuGet.Frameworks": "6.5.0"
"NuGet.Frameworks": "6.6.1"
}
},
"NuGet.Configuration": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "rodANSrSBCV84Go7JlwJjaNtAjfYwZlBdwFWIoiSvtU8HQ/cnXi3r2AL8OxLdkLpS+/FmmU/vftCcKucmhkDaA==",
"resolved": "6.6.1",
"contentHash": "9WbK8wgwPfRpSwuG+ZhMshE48qUYvPIw7VNLCncrq/in4vE6SGsuawPSxPJkkLBtcKTGbPMez5JDvUf6vEBgKg==",
"dependencies": {
"NuGet.Common": "6.5.0",
"NuGet.Common": "6.6.1",
"System.Security.Cryptography.ProtectedData": "4.4.0"
}
},
"NuGet.Frameworks": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "QWINE2x3MbTODsWT1Gh71GaGb5icBz4chS8VYvTgsBnsi8esgN6wtHhydd7fvToWECYGq7T4cgBBDiKD/363fg=="
"resolved": "6.6.1",
"contentHash": "iRtDhL0zPqVw037fHEK9bQljTKPuOHhfIkz86/IH2P8eetr910HTTe5G8lJTuzZHh592Ze/sYhh173HIFjPSfg=="
},
"NuGet.Packaging": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "n02Hqnw0Bz/936pmK/vxT2u3QtC1bgmw0Opm8N4sqdwWs41kHiKeJkudmBYRUZMDzsJIMn6Ub9JopWk7A7MjYQ==",
"resolved": "6.6.1",
"contentHash": "GwhFi2Ep4YzAGQFYz1OsMVNfiJ1M46nyCgHQ7xjJSMvxDYFgodR1RqVugWFMbIUUq6I8iYASwp5lpHXvITeuIQ==",
"dependencies": {
"Newtonsoft.Json": "13.0.1",
"NuGet.Configuration": "6.5.0",
"NuGet.Versioning": "6.5.0",
"NuGet.Configuration": "6.6.1",
"NuGet.Versioning": "6.6.1",
"System.Security.Cryptography.Cng": "5.0.0",
"System.Security.Cryptography.Pkcs": "5.0.0"
}
},
"NuGet.Protocol": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "CXDvu2mZga3qDAGvXTt6QTdpPZ5qNjpjZK2g7lU0MjamE3Eyi3dkN/GSr5QIyupcuCeOM8XHiNHRag6IF63Aqw==",
"resolved": "6.6.1",
"contentHash": "HhKLsK6Q0NNp6qb0T26GLR5gCTRZu+gzqDVK4xqXHZmsolaDVIdIYpn44b2etaVYLzNJCvgRkw+I422u2bIvMw==",
"dependencies": {
"NuGet.Packaging": "6.5.0"
"NuGet.Packaging": "6.6.1"
}
},
"NuGet.Versioning": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "a2j4bDoSBVagDZ+Q61kAmxs/kY8q16cgNDdZuo867j5ip2F4yInjy1v8Ec9LslbP7QBtMzGDWw7rfBlFt6qofg=="
"resolved": "6.6.1",
"contentHash": "Wm/AOFICTIrCgbVxv9dNWusraTzcggbo5W4ao7hD8NNVq911an9TGwW+uNuYc8I5PkpTeMuSXneV2u6hbi1P4w=="
},
"Serilog": {
"type": "Transitive",
"resolved": "2.12.0",
"contentHash": "xaiJLIdu6rYMKfQMYUZgTy8YK7SMZjB4Yk50C/u//Z4OsvxkUfSPJy4nknfvwAC34yr13q7kcyh4grbwhSxyZg=="
"resolved": "3.0.1",
"contentHash": "E4UmOQ++eNJax1laE+lws7E3zbhKgHsGJbO7ra0yE5smUh+5FfUPIKKBxM3MO1tK4sgpQke6/pLReDxIc/ggNw=="
},
"System.Formats.Asn1": {
"type": "Transitive",
Expand Down Expand Up @@ -110,11 +110,11 @@
"dependencies": {
"Arbor.Processing": "[0.6.0, )",
"JetBrains.Annotations": "[2022.3.1, )",
"NewtonSoft.Json": "[13.0.2, )",
"NuGet.Configuration": "[6.5.0, )",
"NuGet.Protocol": "[6.5.0, )",
"NuGet.Versioning": "[6.5.0, )",
"Serilog": "[2.12.0, )"
"NewtonSoft.Json": "[13.0.3, )",
"NuGet.Configuration": "[6.6.1, )",
"NuGet.Protocol": "[6.6.1, )",
"NuGet.Versioning": "[6.6.1, )",
"Serilog": "[3.0.1, )"
}
}
},
Expand All @@ -140,60 +140,60 @@
},
"Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
"contentHash": "R2pZ3B0UjeyHShm9vG+Tu0EBb2lC8b0dFzV9gVn50ofHXh9Smjk6kTn7A/FdAsC8B5cKib1OnGYOXxRBz5XQDg=="
"resolved": "13.0.3",
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
},
"NuGet.Common": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "u5V3R9FzGHB57bcKhCjKdaaB3m+zzOIp7pXvcCVYa2fnXYUQVEoY7XE+nLKJwJqN6PXzQP9/ztUUSFl9uslNJw==",
"resolved": "6.6.1",
"contentHash": "hW5NtShErO3qbdkyv7doCRsFNK9Rlcc7mVjYM+hg1sOAWheTh/oo95DzNbsZthiqyHZfaioopfWtzmoxNw9h4g==",
"dependencies": {
"NuGet.Frameworks": "6.5.0"
"NuGet.Frameworks": "6.6.1"
}
},
"NuGet.Configuration": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "rodANSrSBCV84Go7JlwJjaNtAjfYwZlBdwFWIoiSvtU8HQ/cnXi3r2AL8OxLdkLpS+/FmmU/vftCcKucmhkDaA==",
"resolved": "6.6.1",
"contentHash": "9WbK8wgwPfRpSwuG+ZhMshE48qUYvPIw7VNLCncrq/in4vE6SGsuawPSxPJkkLBtcKTGbPMez5JDvUf6vEBgKg==",
"dependencies": {
"NuGet.Common": "6.5.0",
"NuGet.Common": "6.6.1",
"System.Security.Cryptography.ProtectedData": "4.4.0"
}
},
"NuGet.Frameworks": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "QWINE2x3MbTODsWT1Gh71GaGb5icBz4chS8VYvTgsBnsi8esgN6wtHhydd7fvToWECYGq7T4cgBBDiKD/363fg=="
"resolved": "6.6.1",
"contentHash": "iRtDhL0zPqVw037fHEK9bQljTKPuOHhfIkz86/IH2P8eetr910HTTe5G8lJTuzZHh592Ze/sYhh173HIFjPSfg=="
},
"NuGet.Packaging": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "n02Hqnw0Bz/936pmK/vxT2u3QtC1bgmw0Opm8N4sqdwWs41kHiKeJkudmBYRUZMDzsJIMn6Ub9JopWk7A7MjYQ==",
"resolved": "6.6.1",
"contentHash": "GwhFi2Ep4YzAGQFYz1OsMVNfiJ1M46nyCgHQ7xjJSMvxDYFgodR1RqVugWFMbIUUq6I8iYASwp5lpHXvITeuIQ==",
"dependencies": {
"Newtonsoft.Json": "13.0.1",
"NuGet.Configuration": "6.5.0",
"NuGet.Versioning": "6.5.0",
"NuGet.Configuration": "6.6.1",
"NuGet.Versioning": "6.6.1",
"System.Security.Cryptography.Cng": "5.0.0",
"System.Security.Cryptography.Pkcs": "5.0.0"
}
},
"NuGet.Protocol": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "CXDvu2mZga3qDAGvXTt6QTdpPZ5qNjpjZK2g7lU0MjamE3Eyi3dkN/GSr5QIyupcuCeOM8XHiNHRag6IF63Aqw==",
"resolved": "6.6.1",
"contentHash": "HhKLsK6Q0NNp6qb0T26GLR5gCTRZu+gzqDVK4xqXHZmsolaDVIdIYpn44b2etaVYLzNJCvgRkw+I422u2bIvMw==",
"dependencies": {
"NuGet.Packaging": "6.5.0"
"NuGet.Packaging": "6.6.1"
}
},
"NuGet.Versioning": {
"type": "Transitive",
"resolved": "6.5.0",
"contentHash": "a2j4bDoSBVagDZ+Q61kAmxs/kY8q16cgNDdZuo867j5ip2F4yInjy1v8Ec9LslbP7QBtMzGDWw7rfBlFt6qofg=="
"resolved": "6.6.1",
"contentHash": "Wm/AOFICTIrCgbVxv9dNWusraTzcggbo5W4ao7hD8NNVq911an9TGwW+uNuYc8I5PkpTeMuSXneV2u6hbi1P4w=="
},
"Serilog": {
"type": "Transitive",
"resolved": "2.12.0",
"contentHash": "xaiJLIdu6rYMKfQMYUZgTy8YK7SMZjB4Yk50C/u//Z4OsvxkUfSPJy4nknfvwAC34yr13q7kcyh4grbwhSxyZg=="
"resolved": "3.0.1",
"contentHash": "E4UmOQ++eNJax1laE+lws7E3zbhKgHsGJbO7ra0yE5smUh+5FfUPIKKBxM3MO1tK4sgpQke6/pLReDxIc/ggNw=="
},
"System.Formats.Asn1": {
"type": "Transitive",
Expand Down Expand Up @@ -227,11 +227,11 @@
"dependencies": {
"Arbor.Processing": "[0.6.0, )",
"JetBrains.Annotations": "[2022.3.1, )",
"NewtonSoft.Json": "[13.0.2, )",
"NuGet.Configuration": "[6.5.0, )",
"NuGet.Protocol": "[6.5.0, )",
"NuGet.Versioning": "[6.5.0, )",
"Serilog": "[2.12.0, )"
"NewtonSoft.Json": "[13.0.3, )",
"NuGet.Configuration": "[6.6.1, )",
"NuGet.Protocol": "[6.6.1, )",
"NuGet.Versioning": "[6.6.1, )",
"Serilog": "[3.0.1, )"
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions src/Arbor.Tooler/Arbor.Tooler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Arbor.Processing" Version="0.6.0" />
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
<PackageReference Include="NewtonSoft.Json" Version="13.0.2" />
<PackageReference Include="NuGet.Configuration" Version="6.5.0" />
<PackageReference Include="NuGet.Protocol" Version="6.5.0" />
<PackageReference Include="NuGet.Versioning" Version="6.5.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="NewtonSoft.Json" Version="13.0.3" />
<PackageReference Include="NuGet.Configuration" Version="6.6.1" />
<PackageReference Include="NuGet.Protocol" Version="6.6.1" />
<PackageReference Include="NuGet.Versioning" Version="6.6.1" />
<PackageReference Include="Serilog" Version="3.0.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Arbor.Tooler/Arbor.Tooler.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<dependency id="NuGet.Versioning" version="[6.0.0,7.0.0)" />
<dependency id="NuGet.Protocol" version="[6.0.0,7.0.0)" />
<dependency id="NuGet.Configuration" version="[6.0.0,7.0.0)" />
<dependency id="Serilog" version="[2.8.0,3.0.0)" />
<dependency id="Serilog" version="[3.0.0,4.0.0)" />
<dependency id="Arbor.Processing" version="0.6.0" />
<dependency id="NewtonSoft.Json" version="[13.0.0,)" />
</dependencies>
Expand Down
13 changes: 3 additions & 10 deletions src/Arbor.Tooler/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
using System.Collections.Generic;
using System.Linq;

namespace Arbor.Tooler
{
internal static class EnumerableExtensions
{
public static IEnumerable<T> NotNull<T>(this IEnumerable<T?> items) where T :class
{
foreach (var item in items)
{
if (item is {})
{
yield return item;
}
}
}
public static IEnumerable<T> NotNull<T>(this IEnumerable<T?> items) where T :class =>
items.Where(item => item is { }).Cast<T>();
}
}
3 changes: 1 addition & 2 deletions src/Arbor.Tooler/NuGetCliSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ namespace Arbor.Tooler
{
public class NuGetCliSettings
{
private static readonly Lazy<NuGetCliSettings> DefaultSettings =
new Lazy<NuGetCliSettings>(() => new NuGetCliSettings());
private static readonly Lazy<NuGetCliSettings> DefaultSettings = new(() => new NuGetCliSettings());

public NuGetCliSettings(
string? nugetSourceName = null,
Expand Down
6 changes: 3 additions & 3 deletions src/Arbor.Tooler/NuGetDownloadClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private static async Task<NuGetDownloadResult> DownloadAsync(
}

await using Stream downloadStream =
await httpResponseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false);
await httpResponseMessage.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
const int defaultBufferSize = 8192;
await downloadStream.CopyToAsync(nugetExeFileStream,
defaultBufferSize,
Expand Down Expand Up @@ -146,9 +146,9 @@ void ToolAction(string message, string category)
output.Add(message);
},
standardErrorAction: StandardErrorAction,
debugAction: DebugAction,
verboseAction: VerboseAction,
toolAction: ToolAction,
verboseAction: VerboseAction,
debugAction: DebugAction,
cancellationToken: cancellationToken).ConfigureAwait(false);

if (!exitCode.IsSuccess)
Expand Down
21 changes: 9 additions & 12 deletions src/Arbor.Tooler/NuGetDownloadResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ namespace Arbor.Tooler
{
public sealed class NuGetDownloadResult
{
public static readonly NuGetDownloadResult Disabled = new NuGetDownloadResult(nameof(Disabled));
public static readonly NuGetDownloadResult Disabled = new(nameof(Disabled));

public static readonly NuGetDownloadResult MissingNuGetDownloadUriFormat =
new NuGetDownloadResult(nameof(MissingNuGetDownloadUriFormat));
new(nameof(MissingNuGetDownloadUriFormat));

public static readonly NuGetDownloadResult MissingDownloadDirectory =
new NuGetDownloadResult(nameof(MissingDownloadDirectory));
public static readonly NuGetDownloadResult MissingDownloadDirectory = new(nameof(MissingDownloadDirectory));

public static readonly NuGetDownloadResult MissingNuGetExeVersion =
new NuGetDownloadResult(nameof(MissingNuGetExeVersion));
public static readonly NuGetDownloadResult MissingNuGetExeVersion = new(nameof(MissingNuGetExeVersion));

private NuGetDownloadResult(string result, bool succeeded = false)
{
Expand All @@ -36,18 +34,17 @@ private NuGetDownloadResult(string result, bool succeeded = false)

public Exception? Exception { get; }

public static NuGetDownloadResult FromException(Exception exception) => new NuGetDownloadResult(exception);
public static NuGetDownloadResult FromException(Exception exception) => new(exception);

public static NuGetDownloadResult InvalidDownloadUri(string downloadUri) =>
new NuGetDownloadResult($"Invalid download URI {downloadUri}");
new($"Invalid download URI {downloadUri}");

public static NuGetDownloadResult Success(string targetFilePath) =>
new NuGetDownloadResult(targetFilePath, true);
public static NuGetDownloadResult Success(string targetFilePath) => new(targetFilePath, true);

public override string ToString() =>
$"{nameof(NuGetExePath)}: {NuGetExePath}, {nameof(Result)}: {Result}, {nameof(Succeeded)}: {Succeeded}, {nameof(Exception)}: {Exception}";

public static NuGetDownloadResult DownloadFailed(HttpStatusCode statusCode) => new NuGetDownloadResult($"Http download status code was {(int)statusCode}", succeeded: false);
public static NuGetDownloadResult DownloadFailed(string message) => new NuGetDownloadResult(message, succeeded: false);
public static NuGetDownloadResult DownloadFailed(HttpStatusCode statusCode) => new($"Http download status code was {(int)statusCode}", succeeded: false);
public static NuGetDownloadResult DownloadFailed(string message) => new(message, succeeded: false);
}
}
3 changes: 1 addition & 2 deletions src/Arbor.Tooler/NuGetDownloadSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ public class NuGetDownloadSettings
public const string DefaultNuGetExeDownloadUriFormat =
"https://dist.nuget.org/win-x86-commandline/{0}/nuget.exe";

private static readonly Lazy<NuGetDownloadSettings> DefaultSettings =
new Lazy<NuGetDownloadSettings>(() => new NuGetDownloadSettings());
private static readonly Lazy<NuGetDownloadSettings> DefaultSettings = new(() => new NuGetDownloadSettings());

public NuGetDownloadSettings(
bool? nugetDownloadEnabled = null,
Expand Down
2 changes: 1 addition & 1 deletion src/Arbor.Tooler/NuGetPackageId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Arbor.Tooler
{
public class NuGetPackageId : IEquatable<NuGetPackageId>
public sealed class NuGetPackageId : IEquatable<NuGetPackageId>
{
public bool Equals(NuGetPackageId? other)
{
Expand Down
Loading

0 comments on commit 4ddc95c

Please sign in to comment.