From bf34addb8b8a76f12a502b93b181a82c5d0cec06 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 11:32:33 -0300 Subject: [PATCH 01/11] Add `NuGetTasks` delete, sign and verify. --- CHANGELOG.md | 5 + Directory.Build.props | 2 +- ricaun.Nuke/Extensions/NuGetExtension.cs | 70 +- ricaun.Nuke/Tools/NuGet/NuGet.Generated.cs | 1635 ++++++++++++++++++++ ricaun.Nuke/Tools/NuGet/NuGet.json | 311 ++++ 5 files changed, 1998 insertions(+), 25 deletions(-) create mode 100644 ricaun.Nuke/Tools/NuGet/NuGet.Generated.cs create mode 100644 ricaun.Nuke/Tools/NuGet/NuGet.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e1c8e8..d1230e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. 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). +## [1.9.2 / 2025-01-19 +### Updated +- Add `NuGetTasks` delete, sign and verify. + ## [1.9.1] / 2025-01-03 ### Updated - Force to uninstall local `Tools` to remove cache when `.exe` is not found. (Fix: #79) @@ -393,6 +397,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - First Release [vNext]: ../../compare/1.0.0...HEAD +[1.9.2]: ../../compare/1.9.1...1.9.2 [1.9.1]: ../../compare/1.9.0...1.9.1 [1.9.0]: ../../compare/1.8.2...1.9.0 [1.8.2]: ../../compare/1.8.1...1.8.2 diff --git a/Directory.Build.props b/Directory.Build.props index dbbf2ae..9bba488 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.9.1 + 1.9.2-alpha \ No newline at end of file diff --git a/ricaun.Nuke/Extensions/NuGetExtension.cs b/ricaun.Nuke/Extensions/NuGetExtension.cs index 2f297da..af1d646 100644 --- a/ricaun.Nuke/Extensions/NuGetExtension.cs +++ b/ricaun.Nuke/Extensions/NuGetExtension.cs @@ -1,6 +1,7 @@ using Nuke.Common.IO; +using Nuke.Common.Tooling; using Nuke.Common.Tools.DotNet; -using Nuke.Common.Tools.NuGet; +using ricaun.Nuke.Tools.NuGet; using System; using System.IO; @@ -117,15 +118,22 @@ public static bool NuGetUnlist(string source, string apiKey, string packageFileN Serilog.Log.Information($"NuGet delete: {packageName} {packageVersion}"); try { - NuGetTasks.NuGet( - $"delete {packageName} {packageVersion}" + - $" -Source {source}" + - $" -ApiKey {apiKey}" + - $" -NonInteractive", - logOutput: false, - logInvocation: false - ); // don't print to std out/err - + //NuGetTasks.NuGet( + // $"delete {packageName} {packageVersion}" + + // $" -Source {source}" + + // $" -ApiKey {apiKey}" + + // $" -NonInteractive", + // logOutput: false, + // logInvocation: false + // ); // don't print to std out/err + NuGetTasks.NuGetDelete(s => s + .SetPackageId(packageFileName) + .SetPackageVersion(packageVersion) + .SetSource(source) + .SetApiKey(apiKey) + .EnableNonInteractive() + .DisableProcessLogInvocation() + ); return true; } catch (Exception ex) @@ -144,11 +152,17 @@ public static bool NuGetVerifySignatures(string packageFileName) { try { - NuGetTasks.NuGet( - $"verify -Signatures \"{packageFileName}\"", - logOutput: false, - logInvocation: false - ); // don't print to std out/err + //NuGetTasks.NuGet( + // $"verify -Signatures \"{packageFileName}\"", + // logOutput: false, + // logInvocation: false + // ); // don't print to std out/err + NuGetTasks.NuGetVerify(s => s + .SetTargetPath(packageFileName) + .DisableProcessLogOutput() + .DisableProcessLogInvocation() + ); + return true; } catch @@ -170,15 +184,23 @@ public static bool NugetSign(string packageFileName, string certPath, string cer try { Serilog.Log.Information($"NuGet sign: {packageFileName}"); - NuGetTasks.NuGet( - $"sign \"{packageFileName}\"" + - $" -CertificatePath {certPath}" + - $" -CertificatePassword {certPassword}" + - $" -Timestamper {timestampServer}" + - $" -NonInteractive", - logOutput: false, - logInvocation: false - ); // don't print to std out/err + //NuGetTasks.NuGet( + // $"sign \"{packageFileName}\"" + + // $" -CertificatePath {certPath}" + + // $" -CertificatePassword {certPassword}" + + // $" -Timestamper {timestampServer}" + + // $" -NonInteractive", + // logOutput: false, + // logInvocation: false + // ); // don't print to std out/err + NuGetTasks.NuGetSign(s => s + .SetTargetPath(packageFileName) + .SetCertificatePath(certPath) + .SetCertificatePassword(certPassword) + .SetTimestamper(timestampServer) + .EnableNonInteractive() + .DisableProcessLogOutput() + ); return true; } catch diff --git a/ricaun.Nuke/Tools/NuGet/NuGet.Generated.cs b/ricaun.Nuke/Tools/NuGet/NuGet.Generated.cs new file mode 100644 index 0000000..dae28d7 --- /dev/null +++ b/ricaun.Nuke/Tools/NuGet/NuGet.Generated.cs @@ -0,0 +1,1635 @@ + +using JetBrains.Annotations; +using Newtonsoft.Json; +using Nuke.Common; +using Nuke.Common.Tooling; +using Nuke.Common.Tools; +using Nuke.Common.Utilities.Collections; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using System.Text; + +namespace ricaun.Nuke.Tools.NuGet; + +/// +///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+///

For more details, visit the official website.

+///
+[PublicAPI] +[ExcludeFromCodeCoverage] +[NuGetPackageRequirement(NuGetPackageId)] +public partial class NuGetTasks + : IRequireNuGetPackage +{ + /// + /// NuGetPackageId + /// + public const string NuGetPackageId = "NuGet.CommandLine"; + /// + /// Path to the NuGet executable. + /// + public static string NuGetPath => + ToolPathResolver.TryGetEnvironmentExecutable("NUGET_EXE") ?? + NuGetToolPathResolver.GetPackageExecutable("NuGet.CommandLine", "NuGet.exe"); + /// + /// NuGetLogger + /// + public static Action NuGetLogger { get; set; } = ProcessTasks.DefaultLogger; + /// + /// NuGetExitHandler + /// + public static Action NuGetExitHandler { get; set; } = ProcessTasks.DefaultExitHandler; + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ public static IReadOnlyCollection NuGet(ArgumentStringHandler arguments, string workingDirectory = null, IReadOnlyDictionary environmentVariables = null, int? timeout = null, bool? logOutput = null, bool? logInvocation = null, Action logger = null, Action exitHandler = null) + { + using var process = ProcessTasks.StartProcess(NuGetPath, arguments, workingDirectory, environmentVariables, timeout, logOutput, logInvocation, logger ?? NuGetLogger); + (exitHandler ?? (p => NuGetExitHandler.Invoke(null, p))).Invoke(process.AssertWaitForExit()); + return process.Output; + } + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • <packageId> via
  • + ///
  • <packageVersion> via
  • + ///
  • -ApiKey via
  • + ///
  • -ConfigFile via
  • + ///
  • -ForceEnglishOutput via
  • + ///
  • -NonInteractive via
  • + ///
  • -NoPrompt via
  • + ///
  • -Source via
  • + ///
  • -Verbosity via
  • + ///
+ ///
+ public static IReadOnlyCollection NuGetDelete(NuGetDeleteSettings toolSettings = null) + { + toolSettings = toolSettings ?? new NuGetDeleteSettings(); + using var process = ProcessTasks.StartProcess(toolSettings); + toolSettings.ProcessExitHandler.Invoke(toolSettings, process.AssertWaitForExit()); + return process.Output; + } + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • <packageId> via
  • + ///
  • <packageVersion> via
  • + ///
  • -ApiKey via
  • + ///
  • -ConfigFile via
  • + ///
  • -ForceEnglishOutput via
  • + ///
  • -NonInteractive via
  • + ///
  • -NoPrompt via
  • + ///
  • -Source via
  • + ///
  • -Verbosity via
  • + ///
+ ///
+ public static IReadOnlyCollection NuGetDelete(Configure configurator) + { + return NuGetDelete(configurator(new NuGetDeleteSettings())); + } + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • <packageId> via
  • + ///
  • <packageVersion> via
  • + ///
  • -ApiKey via
  • + ///
  • -ConfigFile via
  • + ///
  • -ForceEnglishOutput via
  • + ///
  • -NonInteractive via
  • + ///
  • -NoPrompt via
  • + ///
  • -Source via
  • + ///
  • -Verbosity via
  • + ///
+ ///
+ public static IEnumerable<(NuGetDeleteSettings Settings, IReadOnlyCollection Output)> NuGetDelete(CombinatorialConfigure configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) + { + return configurator.Invoke(NuGetDelete, NuGetLogger, degreeOfParallelism, completeOnFailure); + } + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • <targetPath> via
  • + ///
  • -CertificateFingerprint via
  • + ///
  • -CertificatePassword via
  • + ///
  • -CertificatePath via
  • + ///
  • -CertificateStoreLocation via
  • + ///
  • -CertificateStoreName via
  • + ///
  • -CertificateSubjectName via
  • + ///
  • -ConfigFile via
  • + ///
  • -ForceEnglishOutput via
  • + ///
  • -HashAlgorithm via
  • + ///
  • -NonInteractive via
  • + ///
  • -OutputDirectory via
  • + ///
  • -Overwrite via
  • + ///
  • -Timestamper via
  • + ///
  • -TimestampHashAlgorithm via
  • + ///
  • -Verbosity via
  • + ///
+ ///
+ public static IReadOnlyCollection NuGetSign(NuGetSignSettings toolSettings = null) + { + toolSettings = toolSettings ?? new NuGetSignSettings(); + using var process = ProcessTasks.StartProcess(toolSettings); + toolSettings.ProcessExitHandler.Invoke(toolSettings, process.AssertWaitForExit()); + return process.Output; + } + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • <targetPath> via
  • + ///
  • -CertificateFingerprint via
  • + ///
  • -CertificatePassword via
  • + ///
  • -CertificatePath via
  • + ///
  • -CertificateStoreLocation via
  • + ///
  • -CertificateStoreName via
  • + ///
  • -CertificateSubjectName via
  • + ///
  • -ConfigFile via
  • + ///
  • -ForceEnglishOutput via
  • + ///
  • -HashAlgorithm via
  • + ///
  • -NonInteractive via
  • + ///
  • -OutputDirectory via
  • + ///
  • -Overwrite via
  • + ///
  • -Timestamper via
  • + ///
  • -TimestampHashAlgorithm via
  • + ///
  • -Verbosity via
  • + ///
+ ///
+ public static IReadOnlyCollection NuGetSign(Configure configurator) + { + return NuGetSign(configurator(new NuGetSignSettings())); + } + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • <targetPath> via
  • + ///
  • -CertificateFingerprint via
  • + ///
  • -CertificatePassword via
  • + ///
  • -CertificatePath via
  • + ///
  • -CertificateStoreLocation via
  • + ///
  • -CertificateStoreName via
  • + ///
  • -CertificateSubjectName via
  • + ///
  • -ConfigFile via
  • + ///
  • -ForceEnglishOutput via
  • + ///
  • -HashAlgorithm via
  • + ///
  • -NonInteractive via
  • + ///
  • -OutputDirectory via
  • + ///
  • -Overwrite via
  • + ///
  • -Timestamper via
  • + ///
  • -TimestampHashAlgorithm via
  • + ///
  • -Verbosity via
  • + ///
+ ///
+ public static IEnumerable<(NuGetSignSettings Settings, IReadOnlyCollection Output)> NuGetSign(CombinatorialConfigure configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) + { + return configurator.Invoke(NuGetSign, NuGetLogger, degreeOfParallelism, completeOnFailure); + } + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • -CertificateFingerprint via
  • + ///
  • -ConfigFile via
  • + ///
  • -ForceEnglishOutput via
  • + ///
  • -NonInteractive via
  • + ///
  • -Signatures via
  • + ///
  • -Verbosity via
  • + ///
+ ///
+ public static IReadOnlyCollection NuGetVerify(NuGetVerifySettings toolSettings = null) + { + toolSettings = toolSettings ?? new NuGetVerifySettings(); + using var process = ProcessTasks.StartProcess(toolSettings); + toolSettings.ProcessExitHandler.Invoke(toolSettings, process.AssertWaitForExit()); + return process.Output; + } + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • -CertificateFingerprint via
  • + ///
  • -ConfigFile via
  • + ///
  • -ForceEnglishOutput via
  • + ///
  • -NonInteractive via
  • + ///
  • -Signatures via
  • + ///
  • -Verbosity via
  • + ///
+ ///
+ public static IReadOnlyCollection NuGetVerify(Configure configurator) + { + return NuGetVerify(configurator(new NuGetVerifySettings())); + } + /// + ///

The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • -CertificateFingerprint via
  • + ///
  • -ConfigFile via
  • + ///
  • -ForceEnglishOutput via
  • + ///
  • -NonInteractive via
  • + ///
  • -Signatures via
  • + ///
  • -Verbosity via
  • + ///
+ ///
+ public static IEnumerable<(NuGetVerifySettings Settings, IReadOnlyCollection Output)> NuGetVerify(CombinatorialConfigure configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) + { + return configurator.Invoke(NuGetVerify, NuGetLogger, degreeOfParallelism, completeOnFailure); + } +} +#region NuGetDeleteSettings +/// +/// Used within . +/// +[PublicAPI] +[ExcludeFromCodeCoverage] +[Serializable] +public partial class NuGetDeleteSettings : ToolSettings +{ + /// + /// Path to the NuGet executable. + /// + public override string ProcessToolPath => base.ProcessToolPath ?? NuGetTasks.NuGetPath; + /// + /// ProcessLogger + /// + public override Action ProcessLogger => base.ProcessLogger ?? NuGetTasks.NuGetLogger; + /// + /// ProcessExitHandler + /// + public override Action ProcessExitHandler => base.ProcessExitHandler ?? NuGetTasks.NuGetExitHandler; + /// + /// Package Id to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted. + /// + public virtual string PackageId { get; internal set; } + /// + /// Package Version to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted. + /// + public virtual string PackageVersion { get; internal set; } + /// + /// The API key for the target repository. If not present, the one specified in %AppData%\NuGet\NuGet.Config is used. + /// + public virtual string ApiKey { get; internal set; } + /// + /// The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used. + /// + public virtual string ConfigFile { get; internal set; } + /// + /// (3.5+) Forces nuget.exe to run using an invariant, English-based culture. + /// + public virtual bool? ForceEnglishOutput { get; internal set; } + /// + /// Suppresses prompts for user input or confirmations. + /// + public virtual bool? NonInteractive { get; internal set; } + /// + /// Do not prompt when deleting. + /// + public virtual bool? NoPrompt { get; internal set; } + /// + /// Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. Also, starting with NuGet 3.4.2, this is a mandatory parameter unless the NuGet.Config file specifies a DefaultPushSource value (see Configuring NuGet behavior). + /// + public virtual string Source { get; internal set; } + /// + /// Specifies the amount of detail displayed in the output: normal, quiet, detailed. + /// + public virtual NuGetVerbosity Verbosity { get; internal set; } + /// + /// ConfigureProcessArguments + /// + /// + /// + protected override Arguments ConfigureProcessArguments(Arguments arguments) + { + arguments + .Add("delete") + .Add("{value}", PackageId) + .Add("{value}", PackageVersion) + .Add("-ApiKey {value}", ApiKey, secret: true) + .Add("-ConfigFile {value}", ConfigFile) + .Add("-ForceEnglishOutput", ForceEnglishOutput) + .Add("-NonInteractive", NonInteractive) + .Add("-NoPrompt", NoPrompt) + .Add("-Source {value}", Source) + .Add("-Verbosity {value}", Verbosity); + return base.ConfigureProcessArguments(arguments); + } +} +#endregion +#region NuGetSignSettings +/// +/// Used within . +/// +[PublicAPI] +[ExcludeFromCodeCoverage] +[Serializable] +public partial class NuGetSignSettings : ToolSettings +{ + /// + /// Path to the NuGet executable. + /// + public override string ProcessToolPath => base.ProcessToolPath ?? NuGetTasks.NuGetPath; + /// + /// ProcessLogger + /// + public override Action ProcessLogger => base.ProcessLogger ?? NuGetTasks.NuGetLogger; + /// + /// ProcessExitHandler + /// + public override Action ProcessExitHandler => base.ProcessExitHandler ?? NuGetTasks.NuGetExitHandler; + /// + /// Path of the package to sign. + /// + public virtual string TargetPath { get; internal set; } + /// + /// Specifies the fingerprint to be used to search for the certificate in a local certificate store. + /// + public virtual string CertificateFingerprint { get; internal set; } + /// + /// Specifies the certificate password, if needed. If a certificate is password protected but no password is provided, the command will prompt for a password at run time, unless the -NonInteractive option is passed. + /// + public virtual string CertificatePassword { get; internal set; } + /// + /// Specifies the file path to the certificate to be used in signing the package. + /// + public virtual string CertificatePath { get; internal set; } + /// + /// Specifies the name of the X.509 certificate store use to search for the certificate. Defaults to 'CurrentUser', the X.509 certificate store used by the current user. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options. + /// + public virtual string CertificateStoreLocation { get; internal set; } + /// + /// Specifies the name of the X.509 certificate store to use to search for the certificate. Defaults to 'My', the X.509 certificate store for personal certificates. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options. + /// + public virtual string CertificateStoreName { get; internal set; } + /// + /// Specifies the subject name of the certificate used to search a local certificate store for the certificate. The search is a case-insensitive string comparison using the supplied value, which will find all certificates with the subject name containing that string, regardless of other subject values. The certificate store can be specified by -CertificateStoreName and -CertificateStoreLocation options. + /// + public virtual string CertificateSubjectName { get; internal set; } + /// + /// Hash algorithm to be used to sign the package. Defaults to SHA256. Possible values are SHA256, SHA384, and SHA512. + /// + public virtual NuGetSignHashAlgorithm HashAlgorithm { get; internal set; } + /// + /// Specifies the directory where the signed package should be saved. By default the original package is overwritten by the signed package. + /// + public virtual string OutputDirectory { get; internal set; } + /// + /// Switch to indicate if the current signature should be overwritten. By default the command will fail if the package already has a signature. + /// + public virtual bool? Overwrite { get; internal set; } + /// + /// URL to an RFC 3161 timestamping server. + /// + public virtual string Timestamper { get; internal set; } + /// + /// Hash algorithm to be used by the RFC 3161 timestamp server. Defaults to SHA256. + /// + public virtual NuGetSignHashAlgorithm TimestampHashAlgorithm { get; internal set; } + /// + /// The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used. + /// + public virtual string ConfigFile { get; internal set; } + /// + /// (3.5+) Forces nuget.exe to run using an invariant, English-based culture. + /// + public virtual bool? ForceEnglishOutput { get; internal set; } + /// + /// Suppresses prompts for user input or confirmations. + /// + public virtual bool? NonInteractive { get; internal set; } + /// + /// Specifies the amount of detail displayed in the output: normal, quiet, detailed. + /// + public virtual NuGetVerbosity Verbosity { get; internal set; } + /// + /// ConfigureProcessArguments + /// + /// + /// + protected override Arguments ConfigureProcessArguments(Arguments arguments) + { + arguments + .Add("sign") + .Add("{value}", TargetPath) + .Add("-CertificateFingerprint {value}", CertificateFingerprint) + .Add("-CertificatePassword {value}", CertificatePassword, secret: true) + .Add("-CertificatePath {value}", CertificatePath) + .Add("-CertificateStoreLocation {value}", CertificateStoreLocation) + .Add("-CertificateStoreName {value}", CertificateStoreName) + .Add("-CertificateSubjectName {value}", CertificateSubjectName) + .Add("-HashAlgorithm {value}", HashAlgorithm) + .Add("-OutputDirectory {value}", OutputDirectory) + .Add("-Overwrite", Overwrite) + .Add("-Timestamper {value}", Timestamper) + .Add("-TimestampHashAlgorithm {value}", TimestampHashAlgorithm) + .Add("-ConfigFile {value}", ConfigFile) + .Add("-ForceEnglishOutput", ForceEnglishOutput) + .Add("-NonInteractive", NonInteractive) + .Add("-Verbosity {value}", Verbosity); + return base.ConfigureProcessArguments(arguments); + } +} +#endregion +#region NuGetVerifySettings +/// +/// Used within . +/// +[PublicAPI] +[ExcludeFromCodeCoverage] +[Serializable] +public partial class NuGetVerifySettings : ToolSettings +{ + /// + /// Path to the NuGet executable. + /// + public override string ProcessToolPath => base.ProcessToolPath ?? NuGetTasks.NuGetPath; + /// + /// ProcessLogger + /// + public override Action ProcessLogger => base.ProcessLogger ?? NuGetTasks.NuGetLogger; + /// + /// ProcessExitHandler + /// + public override Action ProcessExitHandler => base.ProcessExitHandler ?? NuGetTasks.NuGetExitHandler; + /// + /// Path of the package to verify Signatures. + /// + public virtual string TargetPath { get; internal set; } + /// + /// Specifies one or more SHA-256 certificate fingerprints of certificates(s) which signed packages must be signed with. A certificate SHA-256 fingerprint is a SHA-256 hash of the certificate. Multiple inputs should be semicolon separated. + /// + public virtual string CertificateFingerprint { get; internal set; } + /// + /// The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used. + /// + public virtual string ConfigFile { get; internal set; } + /// + /// (3.5+) Forces nuget.exe to run using an invariant, English-based culture. + /// + public virtual bool? ForceEnglishOutput { get; internal set; } + /// + /// Suppresses prompts for user input or confirmations. + /// + public virtual bool? NonInteractive { get; internal set; } + /// + /// Specifies the amount of detail displayed in the output: normal, quiet, detailed. + /// + public virtual NuGetVerbosity Verbosity { get; internal set; } + /// + /// ConfigureProcessArguments + /// + /// + /// + protected override Arguments ConfigureProcessArguments(Arguments arguments) + { + arguments + .Add("verify") + .Add("-Signatures {value}", TargetPath) + .Add("-CertificateFingerprint {value}", CertificateFingerprint) + .Add("-ConfigFile {value}", ConfigFile) + .Add("-ForceEnglishOutput", ForceEnglishOutput) + .Add("-NonInteractive", NonInteractive) + .Add("-Verbosity {value}", Verbosity); + return base.ConfigureProcessArguments(arguments); + } +} +#endregion +#region NuGetDeleteSettingsExtensions +/// +/// Used within . +/// +[PublicAPI] +[ExcludeFromCodeCoverage] +public static partial class NuGetDeleteSettingsExtensions +{ + #region PackageId + /// + ///

Sets

+ ///

Package Id to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted.

+ ///
+ [Pure] + public static T SetPackageId(this T toolSettings, string packageId) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.PackageId = packageId; + return toolSettings; + } + /// + ///

Resets

+ ///

Package Id to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted.

+ ///
+ [Pure] + public static T ResetPackageId(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.PackageId = null; + return toolSettings; + } + #endregion + #region PackageVersion + /// + ///

Sets

+ ///

Package Version to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted.

+ ///
+ [Pure] + public static T SetPackageVersion(this T toolSettings, string packageVersion) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.PackageVersion = packageVersion; + return toolSettings; + } + /// + ///

Resets

+ ///

Package Version to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted.

+ ///
+ [Pure] + public static T ResetPackageVersion(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.PackageVersion = null; + return toolSettings; + } + #endregion + #region ApiKey + /// + ///

Sets

+ ///

The API key for the target repository. If not present, the one specified in %AppData%\NuGet\NuGet.Config is used.

+ ///
+ [Pure] + public static T SetApiKey(this T toolSettings, [Secret] string apiKey) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ApiKey = apiKey; + return toolSettings; + } + /// + ///

Resets

+ ///

The API key for the target repository. If not present, the one specified in %AppData%\NuGet\NuGet.Config is used.

+ ///
+ [Pure] + public static T ResetApiKey(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ApiKey = null; + return toolSettings; + } + #endregion + #region ConfigFile + /// + ///

Sets

+ ///

The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used.

+ ///
+ [Pure] + public static T SetConfigFile(this T toolSettings, string configFile) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigFile = configFile; + return toolSettings; + } + /// + ///

Resets

+ ///

The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used.

+ ///
+ [Pure] + public static T ResetConfigFile(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigFile = null; + return toolSettings; + } + #endregion + #region ForceEnglishOutput + /// + ///

Sets

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T SetForceEnglishOutput(this T toolSettings, bool? forceEnglishOutput) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = forceEnglishOutput; + return toolSettings; + } + /// + ///

Resets

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T ResetForceEnglishOutput(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = null; + return toolSettings; + } + /// + ///

Enables

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T EnableForceEnglishOutput(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = true; + return toolSettings; + } + /// + ///

Disables

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T DisableForceEnglishOutput(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T ToggleForceEnglishOutput(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = !toolSettings.ForceEnglishOutput; + return toolSettings; + } + #endregion + #region NonInteractive + /// + ///

Sets

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T SetNonInteractive(this T toolSettings, bool? nonInteractive) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = nonInteractive; + return toolSettings; + } + /// + ///

Resets

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T ResetNonInteractive(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = null; + return toolSettings; + } + /// + ///

Enables

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T EnableNonInteractive(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = true; + return toolSettings; + } + /// + ///

Disables

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T DisableNonInteractive(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T ToggleNonInteractive(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = !toolSettings.NonInteractive; + return toolSettings; + } + #endregion + #region NoPrompt + /// + ///

Sets

+ ///

Do not prompt when deleting.

+ ///
+ [Pure] + public static T SetNoPrompt(this T toolSettings, bool? noPrompt) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoPrompt = noPrompt; + return toolSettings; + } + /// + ///

Resets

+ ///

Do not prompt when deleting.

+ ///
+ [Pure] + public static T ResetNoPrompt(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoPrompt = null; + return toolSettings; + } + /// + ///

Enables

+ ///

Do not prompt when deleting.

+ ///
+ [Pure] + public static T EnableNoPrompt(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoPrompt = true; + return toolSettings; + } + /// + ///

Disables

+ ///

Do not prompt when deleting.

+ ///
+ [Pure] + public static T DisableNoPrompt(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoPrompt = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

Do not prompt when deleting.

+ ///
+ [Pure] + public static T ToggleNoPrompt(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoPrompt = !toolSettings.NoPrompt; + return toolSettings; + } + #endregion + #region Source + /// + ///

Sets

+ ///

Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. Also, starting with NuGet 3.4.2, this is a mandatory parameter unless the NuGet.Config file specifies a DefaultPushSource value (see Configuring NuGet behavior).

+ ///
+ [Pure] + public static T SetSource(this T toolSettings, string source) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Source = source; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. Also, starting with NuGet 3.4.2, this is a mandatory parameter unless the NuGet.Config file specifies a DefaultPushSource value (see Configuring NuGet behavior).

+ ///
+ [Pure] + public static T ResetSource(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Source = null; + return toolSettings; + } + #endregion + #region Verbosity + /// + ///

Sets

+ ///

Specifies the amount of detail displayed in the output: normal, quiet, detailed.

+ ///
+ [Pure] + public static T SetVerbosity(this T toolSettings, NuGetVerbosity verbosity) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Verbosity = verbosity; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the amount of detail displayed in the output: normal, quiet, detailed.

+ ///
+ [Pure] + public static T ResetVerbosity(this T toolSettings) where T : NuGetDeleteSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Verbosity = null; + return toolSettings; + } + #endregion +} +#endregion +#region NuGetSignSettingsExtensions +/// +/// Used within . +/// +[PublicAPI] +[ExcludeFromCodeCoverage] +public static partial class NuGetSignSettingsExtensions +{ + #region TargetPath + /// + ///

Sets

+ ///

Path of the package to sign.

+ ///
+ [Pure] + public static T SetTargetPath(this T toolSettings, string targetPath) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TargetPath = targetPath; + return toolSettings; + } + /// + ///

Resets

+ ///

Path of the package to sign.

+ ///
+ [Pure] + public static T ResetTargetPath(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TargetPath = null; + return toolSettings; + } + #endregion + #region CertificateFingerprint + /// + ///

Sets

+ ///

Specifies the fingerprint to be used to search for the certificate in a local certificate store.

+ ///
+ [Pure] + public static T SetCertificateFingerprint(this T toolSettings, string certificateFingerprint) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateFingerprint = certificateFingerprint; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the fingerprint to be used to search for the certificate in a local certificate store.

+ ///
+ [Pure] + public static T ResetCertificateFingerprint(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateFingerprint = null; + return toolSettings; + } + #endregion + #region CertificatePassword + /// + ///

Sets

+ ///

Specifies the certificate password, if needed. If a certificate is password protected but no password is provided, the command will prompt for a password at run time, unless the -NonInteractive option is passed.

+ ///
+ [Pure] + public static T SetCertificatePassword(this T toolSettings, [Secret] string certificatePassword) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificatePassword = certificatePassword; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the certificate password, if needed. If a certificate is password protected but no password is provided, the command will prompt for a password at run time, unless the -NonInteractive option is passed.

+ ///
+ [Pure] + public static T ResetCertificatePassword(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificatePassword = null; + return toolSettings; + } + #endregion + #region CertificatePath + /// + ///

Sets

+ ///

Specifies the file path to the certificate to be used in signing the package.

+ ///
+ [Pure] + public static T SetCertificatePath(this T toolSettings, string certificatePath) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificatePath = certificatePath; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the file path to the certificate to be used in signing the package.

+ ///
+ [Pure] + public static T ResetCertificatePath(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificatePath = null; + return toolSettings; + } + #endregion + #region CertificateStoreLocation + /// + ///

Sets

+ ///

Specifies the name of the X.509 certificate store use to search for the certificate. Defaults to 'CurrentUser', the X.509 certificate store used by the current user. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options.

+ ///
+ [Pure] + public static T SetCertificateStoreLocation(this T toolSettings, string certificateStoreLocation) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateStoreLocation = certificateStoreLocation; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the name of the X.509 certificate store use to search for the certificate. Defaults to 'CurrentUser', the X.509 certificate store used by the current user. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options.

+ ///
+ [Pure] + public static T ResetCertificateStoreLocation(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateStoreLocation = null; + return toolSettings; + } + #endregion + #region CertificateStoreName + /// + ///

Sets

+ ///

Specifies the name of the X.509 certificate store to use to search for the certificate. Defaults to 'My', the X.509 certificate store for personal certificates. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options.

+ ///
+ [Pure] + public static T SetCertificateStoreName(this T toolSettings, string certificateStoreName) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateStoreName = certificateStoreName; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the name of the X.509 certificate store to use to search for the certificate. Defaults to 'My', the X.509 certificate store for personal certificates. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options.

+ ///
+ [Pure] + public static T ResetCertificateStoreName(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateStoreName = null; + return toolSettings; + } + #endregion + #region CertificateSubjectName + /// + ///

Sets

+ ///

Specifies the subject name of the certificate used to search a local certificate store for the certificate. The search is a case-insensitive string comparison using the supplied value, which will find all certificates with the subject name containing that string, regardless of other subject values. The certificate store can be specified by -CertificateStoreName and -CertificateStoreLocation options.

+ ///
+ [Pure] + public static T SetCertificateSubjectName(this T toolSettings, string certificateSubjectName) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateSubjectName = certificateSubjectName; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the subject name of the certificate used to search a local certificate store for the certificate. The search is a case-insensitive string comparison using the supplied value, which will find all certificates with the subject name containing that string, regardless of other subject values. The certificate store can be specified by -CertificateStoreName and -CertificateStoreLocation options.

+ ///
+ [Pure] + public static T ResetCertificateSubjectName(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateSubjectName = null; + return toolSettings; + } + #endregion + #region HashAlgorithm + /// + ///

Sets

+ ///

Hash algorithm to be used to sign the package. Defaults to SHA256. Possible values are SHA256, SHA384, and SHA512.

+ ///
+ [Pure] + public static T SetHashAlgorithm(this T toolSettings, NuGetSignHashAlgorithm hashAlgorithm) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.HashAlgorithm = hashAlgorithm; + return toolSettings; + } + /// + ///

Resets

+ ///

Hash algorithm to be used to sign the package. Defaults to SHA256. Possible values are SHA256, SHA384, and SHA512.

+ ///
+ [Pure] + public static T ResetHashAlgorithm(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.HashAlgorithm = null; + return toolSettings; + } + #endregion + #region OutputDirectory + /// + ///

Sets

+ ///

Specifies the directory where the signed package should be saved. By default the original package is overwritten by the signed package.

+ ///
+ [Pure] + public static T SetOutputDirectory(this T toolSettings, string outputDirectory) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.OutputDirectory = outputDirectory; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the directory where the signed package should be saved. By default the original package is overwritten by the signed package.

+ ///
+ [Pure] + public static T ResetOutputDirectory(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.OutputDirectory = null; + return toolSettings; + } + #endregion + #region Overwrite + /// + ///

Sets

+ ///

Switch to indicate if the current signature should be overwritten. By default the command will fail if the package already has a signature.

+ ///
+ [Pure] + public static T SetOverwrite(this T toolSettings, bool? overwrite) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Overwrite = overwrite; + return toolSettings; + } + /// + ///

Resets

+ ///

Switch to indicate if the current signature should be overwritten. By default the command will fail if the package already has a signature.

+ ///
+ [Pure] + public static T ResetOverwrite(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Overwrite = null; + return toolSettings; + } + /// + ///

Enables

+ ///

Switch to indicate if the current signature should be overwritten. By default the command will fail if the package already has a signature.

+ ///
+ [Pure] + public static T EnableOverwrite(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Overwrite = true; + return toolSettings; + } + /// + ///

Disables

+ ///

Switch to indicate if the current signature should be overwritten. By default the command will fail if the package already has a signature.

+ ///
+ [Pure] + public static T DisableOverwrite(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Overwrite = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

Switch to indicate if the current signature should be overwritten. By default the command will fail if the package already has a signature.

+ ///
+ [Pure] + public static T ToggleOverwrite(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Overwrite = !toolSettings.Overwrite; + return toolSettings; + } + #endregion + #region Timestamper + /// + ///

Sets

+ ///

URL to an RFC 3161 timestamping server.

+ ///
+ [Pure] + public static T SetTimestamper(this T toolSettings, string timestamper) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Timestamper = timestamper; + return toolSettings; + } + /// + ///

Resets

+ ///

URL to an RFC 3161 timestamping server.

+ ///
+ [Pure] + public static T ResetTimestamper(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Timestamper = null; + return toolSettings; + } + #endregion + #region TimestampHashAlgorithm + /// + ///

Sets

+ ///

Hash algorithm to be used by the RFC 3161 timestamp server. Defaults to SHA256.

+ ///
+ [Pure] + public static T SetTimestampHashAlgorithm(this T toolSettings, NuGetSignHashAlgorithm timestampHashAlgorithm) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TimestampHashAlgorithm = timestampHashAlgorithm; + return toolSettings; + } + /// + ///

Resets

+ ///

Hash algorithm to be used by the RFC 3161 timestamp server. Defaults to SHA256.

+ ///
+ [Pure] + public static T ResetTimestampHashAlgorithm(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TimestampHashAlgorithm = null; + return toolSettings; + } + #endregion + #region ConfigFile + /// + ///

Sets

+ ///

The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used.

+ ///
+ [Pure] + public static T SetConfigFile(this T toolSettings, string configFile) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigFile = configFile; + return toolSettings; + } + /// + ///

Resets

+ ///

The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used.

+ ///
+ [Pure] + public static T ResetConfigFile(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigFile = null; + return toolSettings; + } + #endregion + #region ForceEnglishOutput + /// + ///

Sets

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T SetForceEnglishOutput(this T toolSettings, bool? forceEnglishOutput) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = forceEnglishOutput; + return toolSettings; + } + /// + ///

Resets

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T ResetForceEnglishOutput(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = null; + return toolSettings; + } + /// + ///

Enables

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T EnableForceEnglishOutput(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = true; + return toolSettings; + } + /// + ///

Disables

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T DisableForceEnglishOutput(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T ToggleForceEnglishOutput(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = !toolSettings.ForceEnglishOutput; + return toolSettings; + } + #endregion + #region NonInteractive + /// + ///

Sets

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T SetNonInteractive(this T toolSettings, bool? nonInteractive) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = nonInteractive; + return toolSettings; + } + /// + ///

Resets

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T ResetNonInteractive(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = null; + return toolSettings; + } + /// + ///

Enables

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T EnableNonInteractive(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = true; + return toolSettings; + } + /// + ///

Disables

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T DisableNonInteractive(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T ToggleNonInteractive(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = !toolSettings.NonInteractive; + return toolSettings; + } + #endregion + #region Verbosity + /// + ///

Sets

+ ///

Specifies the amount of detail displayed in the output: normal, quiet, detailed.

+ ///
+ [Pure] + public static T SetVerbosity(this T toolSettings, NuGetVerbosity verbosity) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Verbosity = verbosity; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the amount of detail displayed in the output: normal, quiet, detailed.

+ ///
+ [Pure] + public static T ResetVerbosity(this T toolSettings) where T : NuGetSignSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Verbosity = null; + return toolSettings; + } + #endregion +} +#endregion +#region NuGetVerifySettingsExtensions +/// +/// Used within . +/// +[PublicAPI] +[ExcludeFromCodeCoverage] +public static partial class NuGetVerifySettingsExtensions +{ + #region TargetPath + /// + ///

Sets

+ ///

Path of the package to verify Signatures.

+ ///
+ [Pure] + public static T SetTargetPath(this T toolSettings, string targetPath) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TargetPath = targetPath; + return toolSettings; + } + /// + ///

Resets

+ ///

Path of the package to verify Signatures.

+ ///
+ [Pure] + public static T ResetTargetPath(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TargetPath = null; + return toolSettings; + } + #endregion + #region CertificateFingerprint + /// + ///

Sets

+ ///

Specifies one or more SHA-256 certificate fingerprints of certificates(s) which signed packages must be signed with. A certificate SHA-256 fingerprint is a SHA-256 hash of the certificate. Multiple inputs should be semicolon separated.

+ ///
+ [Pure] + public static T SetCertificateFingerprint(this T toolSettings, string certificateFingerprint) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateFingerprint = certificateFingerprint; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies one or more SHA-256 certificate fingerprints of certificates(s) which signed packages must be signed with. A certificate SHA-256 fingerprint is a SHA-256 hash of the certificate. Multiple inputs should be semicolon separated.

+ ///
+ [Pure] + public static T ResetCertificateFingerprint(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CertificateFingerprint = null; + return toolSettings; + } + #endregion + #region ConfigFile + /// + ///

Sets

+ ///

The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used.

+ ///
+ [Pure] + public static T SetConfigFile(this T toolSettings, string configFile) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigFile = configFile; + return toolSettings; + } + /// + ///

Resets

+ ///

The NuGet configuration file to apply. If not specified, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used.

+ ///
+ [Pure] + public static T ResetConfigFile(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigFile = null; + return toolSettings; + } + #endregion + #region ForceEnglishOutput + /// + ///

Sets

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T SetForceEnglishOutput(this T toolSettings, bool? forceEnglishOutput) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = forceEnglishOutput; + return toolSettings; + } + /// + ///

Resets

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T ResetForceEnglishOutput(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = null; + return toolSettings; + } + /// + ///

Enables

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T EnableForceEnglishOutput(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = true; + return toolSettings; + } + /// + ///

Disables

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T DisableForceEnglishOutput(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

+ ///
+ [Pure] + public static T ToggleForceEnglishOutput(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ForceEnglishOutput = !toolSettings.ForceEnglishOutput; + return toolSettings; + } + #endregion + #region NonInteractive + /// + ///

Sets

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T SetNonInteractive(this T toolSettings, bool? nonInteractive) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = nonInteractive; + return toolSettings; + } + /// + ///

Resets

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T ResetNonInteractive(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = null; + return toolSettings; + } + /// + ///

Enables

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T EnableNonInteractive(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = true; + return toolSettings; + } + /// + ///

Disables

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T DisableNonInteractive(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

Suppresses prompts for user input or confirmations.

+ ///
+ [Pure] + public static T ToggleNonInteractive(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = !toolSettings.NonInteractive; + return toolSettings; + } + #endregion + #region Verbosity + /// + ///

Sets

+ ///

Specifies the amount of detail displayed in the output: normal, quiet, detailed.

+ ///
+ [Pure] + public static T SetVerbosity(this T toolSettings, NuGetVerbosity verbosity) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Verbosity = verbosity; + return toolSettings; + } + /// + ///

Resets

+ ///

Specifies the amount of detail displayed in the output: normal, quiet, detailed.

+ ///
+ [Pure] + public static T ResetVerbosity(this T toolSettings) where T : NuGetVerifySettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Verbosity = null; + return toolSettings; + } + #endregion +} +#endregion +#region NuGetVerbosity +/// +/// Used within . +/// +[PublicAPI] +[Serializable] +[ExcludeFromCodeCoverage] +[TypeConverter(typeof(TypeConverter))] +public partial class NuGetVerbosity : Enumeration +{ + /// + /// Normal + /// + public static NuGetVerbosity Normal = (NuGetVerbosity)"Normal"; + /// + /// Quiet + /// + public static NuGetVerbosity Quiet = (NuGetVerbosity)"Quiet"; + /// + /// Detailed + /// + public static NuGetVerbosity Detailed = (NuGetVerbosity)"Detailed"; + /// + /// NuGetVerbosity + /// + /// + public static implicit operator NuGetVerbosity(string value) + { + return new NuGetVerbosity { Value = value }; + } +} +#endregion +#region NuGetSignHashAlgorithm +/// +/// Used within . +/// +[PublicAPI] +[Serializable] +[ExcludeFromCodeCoverage] +[TypeConverter(typeof(TypeConverter))] +public partial class NuGetSignHashAlgorithm : Enumeration +{ + /// + /// sha256 + /// + public static NuGetSignHashAlgorithm sha256 = (NuGetSignHashAlgorithm)"sha256"; + /// + /// sha384 + /// + public static NuGetSignHashAlgorithm sha384 = (NuGetSignHashAlgorithm)"sha384"; + /// + /// sha512 + /// + public static NuGetSignHashAlgorithm sha512 = (NuGetSignHashAlgorithm)"sha512"; + /// + /// NuGetSignHashAlgorithm + /// + /// + public static implicit operator NuGetSignHashAlgorithm(string value) + { + return new NuGetSignHashAlgorithm { Value = value }; + } +} +#endregion diff --git a/ricaun.Nuke/Tools/NuGet/NuGet.json b/ricaun.Nuke/Tools/NuGet/NuGet.json new file mode 100644 index 0000000..30f55f4 --- /dev/null +++ b/ricaun.Nuke/Tools/NuGet/NuGet.json @@ -0,0 +1,311 @@ +{ + "$schema": "https://raw.githubusercontent.com/nuke-build/nuke/master/source/Nuke.Tooling.Generator/schema.json", + "references": [ + "https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/live/docs/tools/cli-ref-pack.md", + "https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/live/docs/tools/cli-ref-push.md", + "https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/live/docs/tools/cli-ref-restore.md", + "https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/live/docs/tools/cli-ref-sources.md", + "https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/master/docs/reference/cli-reference/cli-ref-install.md" + ], + "name": "NuGet", + "officialUrl": "https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference", + "help": "The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.", + "nugetPackageId": "NuGet.CommandLine", + "packageExecutable": "NuGet.exe", + "tasks": [ + { + "postfix": "Delete", + "definiteArgument": "delete", + "settingsClass": { + "properties": [ + { + "name": "PackageId", + "type": "string", + "format": "{value}", + "help": "Package Id to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted." + }, + { + "name": "PackageVersion", + "type": "string", + "format": "{value}", + "help": "Package Version to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted." + }, + { + "name": "ApiKey", + "type": "string", + "format": "-ApiKey {value}", + "secret": true, + "help": "The API key for the target repository. If not present, the one specified in %AppData%\\NuGet\\NuGet.Config is used." + }, + { + "name": "ConfigFile", + "type": "string", + "format": "-ConfigFile {value}", + "help": "The NuGet configuration file to apply. If not specified, %AppData%\\NuGet\\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used." + }, + { + "name": "ForceEnglishOutput", + "type": "bool", + "format": "-ForceEnglishOutput", + "help": "(3.5+) Forces nuget.exe to run using an invariant, English-based culture." + }, + { + "name": "NonInteractive", + "type": "bool", + "format": "-NonInteractive", + "help": "Suppresses prompts for user input or confirmations." + }, + { + "name": "NoPrompt", + "type": "bool", + "format": "-NoPrompt", + "help": "Do not prompt when deleting." + }, + { + "name": "Source", + "type": "string", + "format": "-Source {value}", + "help": "Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. Also, starting with NuGet 3.4.2, this is a mandatory parameter unless the NuGet.Config file specifies a DefaultPushSource value (see Configuring NuGet behavior)." + }, + { + "name": "Verbosity", + "type": "NuGetVerbosity", + "format": "-Verbosity {value}", + "help": "Specifies the amount of detail displayed in the output: normal, quiet, detailed." + } + ] + } + }, + { + "postfix": "Sign", + "definiteArgument": "sign", + "settingsClass": { + "properties": [ + { + "name": "TargetPath", + "type": "string", + "format": "{value}", + "help": "Path of the package to sign." + }, + { + "name": "CertificateFingerprint", + "type": "string", + "format": "-CertificateFingerprint {value}", + "help": "Specifies the fingerprint to be used to search for the certificate in a local certificate store." + }, + { + "name": "CertificatePassword", + "type": "string", + "format": "-CertificatePassword {value}", + "secret": true, + "help": "Specifies the certificate password, if needed. If a certificate is password protected but no password is provided, the command will prompt for a password at run time, unless the -NonInteractive option is passed." + }, + { + "name": "CertificatePath", + "type": "string", + "format": "-CertificatePath {value}", + "help": "Specifies the file path to the certificate to be used in signing the package." + }, + { + "name": "CertificateStoreLocation", + "type": "string", + "format": "-CertificateStoreLocation {value}", + "help": "Specifies the name of the X.509 certificate store use to search for the certificate. Defaults to 'CurrentUser', the X.509 certificate store used by the current user. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options." + }, + { + "name": "CertificateStoreName", + "type": "string", + "format": "-CertificateStoreName {value}", + "help": "Specifies the name of the X.509 certificate store to use to search for the certificate. Defaults to 'My', the X.509 certificate store for personal certificates. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options." + }, + { + "name": "CertificateSubjectName", + "type": "string", + "format": "-CertificateSubjectName {value}", + "help": "Specifies the subject name of the certificate used to search a local certificate store for the certificate. The search is a case-insensitive string comparison using the supplied value, which will find all certificates with the subject name containing that string, regardless of other subject values. The certificate store can be specified by -CertificateStoreName and -CertificateStoreLocation options." + }, + { + "name": "HashAlgorithm", + "type": "NuGetSignHashAlgorithm", + "format": "-HashAlgorithm {value}", + "help": "Hash algorithm to be used to sign the package. Defaults to SHA256. Possible values are SHA256, SHA384, and SHA512." + }, + { + "name": "OutputDirectory", + "type": "string", + "format": "-OutputDirectory {value}", + "help": "Specifies the directory where the signed package should be saved. By default the original package is overwritten by the signed package." + }, + { + "name": "Overwrite", + "type": "bool", + "format": "-Overwrite", + "help": "Switch to indicate if the current signature should be overwritten. By default the command will fail if the package already has a signature." + }, + { + "name": "Timestamper", + "type": "string", + "format": "-Timestamper {value}", + "help": "URL to an RFC 3161 timestamping server." + }, + { + "name": "TimestampHashAlgorithm", + "type": "NuGetSignHashAlgorithm", + "format": "-TimestampHashAlgorithm {value}", + "help": "Hash algorithm to be used by the RFC 3161 timestamp server. Defaults to SHA256." + }, + { + "name": "ConfigFile", + "type": "string", + "format": "-ConfigFile {value}", + "help": "The NuGet configuration file to apply. If not specified, %AppData%\\NuGet\\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used." + }, + { + "name": "ForceEnglishOutput", + "type": "bool", + "format": "-ForceEnglishOutput", + "help": "(3.5+) Forces nuget.exe to run using an invariant, English-based culture." + }, + { + "name": "NonInteractive", + "type": "bool", + "format": "-NonInteractive", + "help": "Suppresses prompts for user input or confirmations." + }, + { + "name": "Verbosity", + "type": "NuGetVerbosity", + "format": "-Verbosity {value}", + "help": "Specifies the amount of detail displayed in the output: normal, quiet, detailed." + } + ] + } + }, + { + "postfix": "Verify", + "definiteArgument": "verify", + "settingsClass": { + "properties": [ + { + "name": "TargetPath", + "type": "string", + "format": "-Signatures {value}", + "help": "Path of the package to verify Signatures." + }, + { + "name": "CertificateFingerprint", + "type": "string", + "format": "-CertificateFingerprint {value}", + "help": "Specifies one or more SHA-256 certificate fingerprints of certificates(s) which signed packages must be signed with. A certificate SHA-256 fingerprint is a SHA-256 hash of the certificate. Multiple inputs should be semicolon separated." + }, + { + "name": "ConfigFile", + "type": "string", + "format": "-ConfigFile {value}", + "help": "The NuGet configuration file to apply. If not specified, %AppData%\\NuGet\\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used." + }, + { + "name": "ForceEnglishOutput", + "type": "bool", + "format": "-ForceEnglishOutput", + "help": "(3.5+) Forces nuget.exe to run using an invariant, English-based culture." + }, + { + "name": "NonInteractive", + "type": "bool", + "format": "-NonInteractive", + "help": "Suppresses prompts for user input or confirmations." + }, + { + "name": "Verbosity", + "type": "NuGetVerbosity", + "format": "-Verbosity {value}", + "help": "Specifies the amount of detail displayed in the output: normal, quiet, detailed." + } + ] + } + } + ], + "commonTaskPropertySets": { + "sources": [ + { + "name": "ConfigFile", + "type": "string", + "format": "-ConfigFile {value}", + "help": "The NuGet configuration file to apply. If not specified, %AppData%\\NuGet\\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux) is used." + }, + { + "name": "ForceEnglishOutput", + "type": "bool", + "format": "-ForceEnglishOutput", + "help": "(3.5+) Forces nuget.exe to run using an invariant, English-based culture." + }, + { + "name": "NonInteractive", + "type": "bool", + "format": "-NonInteractive", + "help": "Suppresses prompts for user input or confirmations." + }, + { + "name": "Verbosity", + "type": "NuGetVerbosity", + "format": "-Verbosity {value}", + "help": "Specifies the amount of detail displayed in the output: normal, quiet, detailed." + } + ], + "sources_single": [ + { + "name": "Name", + "type": "string", + "format": "-Name {value}", + "help": "Name of the source." + } + ], + "sources_add_update": [ + { + "name": "Source", + "type": "string", + "format": "-Source {value}", + "help": "URL of the source." + }, + { + "name": "Password", + "type": "string", + "format": "-Password {value}", + "secret": true, + "help": "Specifies the password for authenticating with the source." + }, + { + "name": "StorePasswordInClearText", + "type": "bool", + "format": "-StorePasswordInClearText", + "secret": false, + "help": "Indicates to store the password in unencrypted text instead of the default behavior of storing an encrypted form." + }, + { + "name": "UserName", + "type": "string", + "format": "-UserName {value}", + "help": "Specifies the user name for authenticating with the source." + } + ] + }, + "enumerations": [ + { + "name": "NuGetVerbosity", + "values": [ + "Normal", + "Quiet", + "Detailed" + ] + }, + { + "name": "NuGetSignHashAlgorithm", + "values": [ + "sha256", + "sha384", + "sha512" + ] + } + ] +} From 2c902c5de5454d9cc6bc75fd19d2d1ffa5a9d9be Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 11:34:22 -0300 Subject: [PATCH 02/11] Fix `HttpAuthTasks` dispose `CreateFormDataContent` --- CHANGELOG.md | 4 +++- ricaun.Nuke/IO/HttpAuthTasks.cs | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1230e3..b4c38d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,11 @@ All notable changes to this project will be documented in this file. 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). -## [1.9.2 / 2025-01-19 +## [1.9.2] / 2025-01-19 ### Updated - Add `NuGetTasks` delete, sign and verify. +### Fixed +- Fix `HttpAuthTasks` dispose `CreateFormDataContent`. ## [1.9.1] / 2025-01-03 ### Updated diff --git a/ricaun.Nuke/IO/HttpAuthTasks.cs b/ricaun.Nuke/IO/HttpAuthTasks.cs index 39d2d41..f1d13fd 100644 --- a/ricaun.Nuke/IO/HttpAuthTasks.cs +++ b/ricaun.Nuke/IO/HttpAuthTasks.cs @@ -36,7 +36,7 @@ public static async Task HttpPostFileAsync( Configure clientConfigurator = null, Action headerConfigurator = null) { - var content = CreateFormDataContent(filePath, formData, fileStreamContentName); + using var content = CreateFormDataContent(filePath, formData, fileStreamContentName); return await HttpPostAsync(uri, content, authorization, clientConfigurator, headerConfigurator); } @@ -162,7 +162,7 @@ public static async Task HttpPutFileAsync( Configure clientConfigurator = null, Action headerConfigurator = null) { - var content = CreateFormDataContent(filePath, formData, fileStreamContentName); + using var content = CreateFormDataContent(filePath, formData, fileStreamContentName); return await HttpPostAsync(uri, content, authorization, clientConfigurator, headerConfigurator); } @@ -286,7 +286,7 @@ public static async Task HttpPatchFileAsync( Configure clientConfigurator = null, Action headerConfigurator = null) { - var content = CreateFormDataContent(filePath, formData, fileStreamContentName); + using var content = CreateFormDataContent(filePath, formData, fileStreamContentName); return await HttpPostAsync(uri, content, authorization, clientConfigurator, headerConfigurator); } From 9dff7656b16c1f7ae1184e33d5ca15b8b91fda85 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 11:37:28 -0300 Subject: [PATCH 03/11] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4c38d1..d34565f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Updated - Add `NuGetTasks` delete, sign and verify. ### Fixed -- Fix `HttpAuthTasks` dispose `CreateFormDataContent`. +- Fix `HttpAuthTasks` dispose file stream in `CreateFormDataContent`. ## [1.9.1] / 2025-01-03 ### Updated From 1b7546bd4203c0d3fa9ae2a8e9013915df65c0ba Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 11:38:13 -0300 Subject: [PATCH 04/11] Remove all NuGet --- ricaun.Nuke/Extensions/NuGetExtension.cs | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/ricaun.Nuke/Extensions/NuGetExtension.cs b/ricaun.Nuke/Extensions/NuGetExtension.cs index af1d646..6ebde30 100644 --- a/ricaun.Nuke/Extensions/NuGetExtension.cs +++ b/ricaun.Nuke/Extensions/NuGetExtension.cs @@ -118,14 +118,6 @@ public static bool NuGetUnlist(string source, string apiKey, string packageFileN Serilog.Log.Information($"NuGet delete: {packageName} {packageVersion}"); try { - //NuGetTasks.NuGet( - // $"delete {packageName} {packageVersion}" + - // $" -Source {source}" + - // $" -ApiKey {apiKey}" + - // $" -NonInteractive", - // logOutput: false, - // logInvocation: false - // ); // don't print to std out/err NuGetTasks.NuGetDelete(s => s .SetPackageId(packageFileName) .SetPackageVersion(packageVersion) @@ -152,11 +144,6 @@ public static bool NuGetVerifySignatures(string packageFileName) { try { - //NuGetTasks.NuGet( - // $"verify -Signatures \"{packageFileName}\"", - // logOutput: false, - // logInvocation: false - // ); // don't print to std out/err NuGetTasks.NuGetVerify(s => s .SetTargetPath(packageFileName) .DisableProcessLogOutput() @@ -184,15 +171,6 @@ public static bool NugetSign(string packageFileName, string certPath, string cer try { Serilog.Log.Information($"NuGet sign: {packageFileName}"); - //NuGetTasks.NuGet( - // $"sign \"{packageFileName}\"" + - // $" -CertificatePath {certPath}" + - // $" -CertificatePassword {certPassword}" + - // $" -Timestamper {timestampServer}" + - // $" -NonInteractive", - // logOutput: false, - // logInvocation: false - // ); // don't print to std out/err NuGetTasks.NuGetSign(s => s .SetTargetPath(packageFileName) .SetCertificatePath(certPath) From 636ed1f1afb1d036114d154c7ccdf2c153f6cee4 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 11:40:30 -0300 Subject: [PATCH 05/11] Rename Nuget to NuGet --- ricaun.Nuke/Extensions/AssemblyExtension.cs | 10 +++++----- ricaun.Nuke/Extensions/NuGetExtension.cs | 22 ++++++++++----------- ricaun.Nuke/Extensions/SignExtension.cs | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ricaun.Nuke/Extensions/AssemblyExtension.cs b/ricaun.Nuke/Extensions/AssemblyExtension.cs index 47310e6..628c76b 100644 --- a/ricaun.Nuke/Extensions/AssemblyExtension.cs +++ b/ricaun.Nuke/Extensions/AssemblyExtension.cs @@ -85,7 +85,7 @@ public static string GetInformationalVersion(this Project project) { return fileVersionInfo?.ProductVersion.Split('+').First(); } - if (project.GetNugetVersionInfo() is NugetVersionInfo nugetVersionInfo) + if (project.GetNuGetVersionInfo() is NuGetVersionInfo nugetVersionInfo) { return nugetVersionInfo?.ProductVersion.Split('+').First(); } @@ -145,19 +145,19 @@ public static FileVersionInfo GetFileVersionInfo(this Project project) } /// - /// Get NugetVersionInfo of the first nupkg file found + /// Get NuGetVersionInfo of the first nupkg file found /// /// /// - public static NugetVersionInfo GetNugetVersionInfo(this Project project) + public static NuGetVersionInfo GetNuGetVersionInfo(this Project project) { var sourceDir = project.Directory; var searchPattern = $"*{project.Name}*.nupkg"; var nupkgFiles = Directory.GetFiles(sourceDir, searchPattern, SearchOption.AllDirectories); foreach (var nupkgFile in nupkgFiles) { - var nugetVersionInfo = NugetVersionInfo.Parse(nupkgFile); - if (nugetVersionInfo is NugetVersionInfo) return nugetVersionInfo; + var nugetVersionInfo = NuGetVersionInfo.Parse(nupkgFile); + if (nugetVersionInfo is NuGetVersionInfo) return nugetVersionInfo; } return null; diff --git a/ricaun.Nuke/Extensions/NuGetExtension.cs b/ricaun.Nuke/Extensions/NuGetExtension.cs index 6ebde30..bc02d30 100644 --- a/ricaun.Nuke/Extensions/NuGetExtension.cs +++ b/ricaun.Nuke/Extensions/NuGetExtension.cs @@ -8,9 +8,9 @@ namespace ricaun.Nuke.Extensions { /// - /// NugetVersionInfo + /// NuGetVersionInfo /// - public class NugetVersionInfo + public class NuGetVersionInfo { /// /// ProductName @@ -22,17 +22,17 @@ public class NugetVersionInfo public string ProductVersion { get; private set; } /// - /// Parse and return a new instance of + /// Parse and return a new instance of /// /// /// - public static NugetVersionInfo Parse(string packageFileName) + public static NuGetVersionInfo Parse(string packageFileName) { string packageName; string packageVersion; if (NuGetExtension.TryGetPackageNameAndVersion(packageFileName, out packageName, out packageVersion)) { - return new NugetVersionInfo + return new NuGetVersionInfo { ProductName = packageName, ProductVersion = packageVersion @@ -88,17 +88,17 @@ public static bool TryGetPackageNameAndVersion(string packageFileName, out strin } /// - /// IsSourceNugetOrg + /// IsSourceNuGetOrg /// /// /// - public static bool IsSourceNugetOrg(string source) + public static bool IsSourceNuGetOrg(string source) { return source.Contains("api.nuget.org"); } /// - /// NugetDelete (Only works with 'api.nuget.org' to unlist package) + /// NuGetDelete (Only works with 'api.nuget.org' to unlist package) /// /// /// @@ -107,7 +107,7 @@ public static bool IsSourceNugetOrg(string source) /// https://learn.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-delete public static bool NuGetUnlist(string source, string apiKey, string packageFileName) { - if (IsSourceNugetOrg(source) == false) + if (IsSourceNuGetOrg(source) == false) return false; Serilog.Log.Information($"NuGetUnlist: {packageFileName}"); @@ -159,14 +159,14 @@ public static bool NuGetVerifySignatures(string packageFileName) } /// - /// NugetSign + /// NuGetSign /// /// /// /// /// /// - public static bool NugetSign(string packageFileName, string certPath, string certPassword, string timestampServer) + public static bool NuGetSign(string packageFileName, string certPath, string certPassword, string timestampServer) { try { diff --git a/ricaun.Nuke/Extensions/SignExtension.cs b/ricaun.Nuke/Extensions/SignExtension.cs index 32a650e..8194b1c 100644 --- a/ricaun.Nuke/Extensions/SignExtension.cs +++ b/ricaun.Nuke/Extensions/SignExtension.cs @@ -78,7 +78,7 @@ public static bool CreateCerFile(string fileNamePfx, string passwordPfx, string /// The path to the certificate file. /// The password for the certificate. /// The path to the file to be signed. - /// NuGet files use . + /// NuGet files use . public static void Sign(string certPath, string certPassword, string filePath) { if (NuGetExtension.IsNuGetFile(filePath)) @@ -155,7 +155,7 @@ public static void SignNuGet(string certPath, string certPassword, string binary foreach (var timestampServer in timestampServers) { - if (NuGetExtension.NugetSign(binaryPath, certPath, certPassword, timestampServer)) + if (NuGetExtension.NuGetSign(binaryPath, certPath, certPassword, timestampServer)) { Serilog.Log.Information($"Signing done with {timestampServer}"); return; From 12104f65cf3166f288fd2c53d96f29f7da3eddb8 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 11:42:07 -0300 Subject: [PATCH 06/11] Rename NuGet parameters --- .github/workflows/Build.yml | 4 ++-- README.md | 6 +++--- ricaun.Nuke/Components/IHazPack.cs | 14 +++++++------- ricaun.Nuke/Components/IPack.cs | 10 +++++----- ricaun.Nuke/Components/IPrePack.cs | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 37e4bf9..146a5bf 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -24,8 +24,8 @@ jobs: env: GitHubToken: ${{ secrets.GITHUB_TOKEN }} - NugetApiUrl: ${{ secrets.NUGET_API_URL }} - NugetApiKey: ${{ secrets.NUGET_API_KEY }} + NuGetApiUrl: ${{ secrets.NUGET_API_URL }} + NuGetApiKey: ${{ secrets.NUGET_API_KEY }} SignFile: ${{ secrets.SIGN_FILE }} SignPassword: ${{ secrets.SIGN_PASSWORD }} \ No newline at end of file diff --git a/README.md b/README.md index f164c83..cd1b607 100644 --- a/README.md +++ b/README.md @@ -102,15 +102,15 @@ The `TimestampUrl` and `TimestampDigest` are optional. The `SIGN_PASSWORD_AZURE` is the `AzureKeyVaultClientSecret` of the `Azure Key Vault` certificate. -### Publish Package Nuget +### Publish Package NuGet ```yml env: GitHubToken: ${{ secrets.GITHUB_TOKEN }} SignFile: ${{ secrets.SIGN_FILE }} SignPassword: ${{ secrets.SIGN_PASSWORD }} - NugetApiUrl: ${{ secrets.NUGET_API_URL }} - NugetApiKey: ${{ secrets.NUGET_API_KEY }} + NuGetApiUrl: ${{ secrets.NUGET_API_URL }} + NuGetApiKey: ${{ secrets.NUGET_API_KEY }} ``` # Build.cs - ITest diff --git a/ricaun.Nuke/Components/IHazPack.cs b/ricaun.Nuke/Components/IHazPack.cs index 7c36a75..ccc8d2e 100644 --- a/ricaun.Nuke/Components/IHazPack.cs +++ b/ricaun.Nuke/Components/IHazPack.cs @@ -11,13 +11,13 @@ namespace ricaun.Nuke.Components public interface IHazPack : IHazGitRepository, INukeBuild { /// - /// NugetApiUrl + /// NuGetApiUrl /// - [Secret][Parameter] public string NugetApiUrl => TryGetValue(() => NugetApiUrl) ?? GetGitRepositoryPackageUrl(); + [Secret][Parameter] public string NuGetApiUrl => TryGetValue(() => NuGetApiUrl) ?? GetGitRepositoryPackageUrl(); /// - /// NugetApiKey + /// NuGetApiKey /// - [Secret][Parameter] public string NugetApiKey => TryGetValue(() => NugetApiKey) ?? GitHubToken; + [Secret][Parameter] public string NuGetApiKey => TryGetValue(() => NuGetApiKey) ?? GitHubToken; /// /// DotNetNuGetPush @@ -25,7 +25,7 @@ public interface IHazPack : IHazGitRepository, INukeBuild /// void DotNetNuGetPush(AbsolutePath packageFilePath) { - NuGetExtension.DotNetNuGetPush(NugetApiUrl, NugetApiKey, packageFilePath); + NuGetExtension.DotNetNuGetPush(NuGetApiUrl, NuGetApiKey, packageFilePath); } /// @@ -35,8 +35,8 @@ void DotNetNuGetPush(AbsolutePath packageFilePath) void DotNetNuGetPrerelease(AbsolutePath packageFilePath) { var packageNameVersion = packageFilePath.Name; - NuGetExtension.DotNetNuGetPush(NugetApiUrl, NugetApiKey, packageFilePath); - NuGetExtension.NuGetUnlist(NugetApiUrl, NugetApiKey, packageNameVersion); + NuGetExtension.DotNetNuGetPush(NuGetApiUrl, NuGetApiKey, packageFilePath); + NuGetExtension.NuGetUnlist(NuGetApiUrl, NuGetApiKey, packageNameVersion); } /// diff --git a/ricaun.Nuke/Components/IPack.cs b/ricaun.Nuke/Components/IPack.cs index f2ab5ba..d3074bb 100644 --- a/ricaun.Nuke/Components/IPack.cs +++ b/ricaun.Nuke/Components/IPack.cs @@ -13,11 +13,11 @@ namespace ricaun.Nuke.Components public interface IPack : IHazPack, IGitRelease { /// - /// UnlistNuget (Default: false) + /// UnlistNuGet (Default: false) /// /// This feature only works on 'api.nuget.org' to unlist package. [Parameter] - bool UnlistNuget => TryGetValue(() => UnlistNuget) ?? false; + bool UnlistNuGet => TryGetValue(() => UnlistNuGet) ?? false; /// /// Target Pack @@ -25,8 +25,8 @@ public interface IPack : IHazPack, IGitRelease Target Pack => _ => _ .TriggeredBy(Release) .After(GitRelease) - .OnlyWhenStatic(() => NugetApiUrl.SkipEmpty()) - .OnlyWhenStatic(() => NugetApiKey.SkipEmpty()) + .OnlyWhenStatic(() => NuGetApiUrl.SkipEmpty()) + .OnlyWhenStatic(() => NuGetApiKey.SkipEmpty()) .OnlyWhenStatic(() => IsServerBuild) .OnlyWhenDynamic(() => GitRepository.IsOnMainOrMasterBranch()) .OnlyWhenDynamic(() => SkipForked()) @@ -35,7 +35,7 @@ public interface IPack : IHazPack, IGitRelease var releaseDirectory = GetReleaseDirectory(MainProject); var packages = Globbing.GlobFiles(releaseDirectory, "**/*.nupkg"); - if (UnlistNuget) + if (UnlistNuGet) { packages.ForEach(DotNetNuGetPrerelease); return; diff --git a/ricaun.Nuke/Components/IPrePack.cs b/ricaun.Nuke/Components/IPrePack.cs index a7b9718..09b9c2c 100644 --- a/ricaun.Nuke/Components/IPrePack.cs +++ b/ricaun.Nuke/Components/IPrePack.cs @@ -20,8 +20,8 @@ public interface IPrePack : IPack, IGitPreRelease .TriggeredBy(Release) .After(Pack) .After(GitPreRelease) - .OnlyWhenStatic(() => NugetApiUrl.SkipEmpty()) - .OnlyWhenStatic(() => NugetApiKey.SkipEmpty()) + .OnlyWhenStatic(() => NuGetApiUrl.SkipEmpty()) + .OnlyWhenStatic(() => NuGetApiKey.SkipEmpty()) .OnlyWhenStatic(() => IsServerBuild) .OnlyWhenDynamic(() => GitRepository.IsOnDevelopBranch()) .OnlyWhenDynamic(() => SkipForked()) From 9af262f46605b0b707fd83331be62fe484d6bcb3 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 11:42:36 -0300 Subject: [PATCH 07/11] prerelease beta --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9bba488..7bb33d1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.9.2-alpha + 1.9.2-beta \ No newline at end of file From dec7b6a47933b8aa12cbe627b6aa779b9c69e531 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 11:45:04 -0300 Subject: [PATCH 08/11] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d34565f..6bc1613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [1.9.2] / 2025-01-19 ### Updated - Add `NuGetTasks` delete, sign and verify. +- Rename `NuGetApiUrl`, `NuGetApiKey` and `UnlistNuGet`. ### Fixed - Fix `HttpAuthTasks` dispose file stream in `CreateFormDataContent`. From 4c43bf4ccdf26a7eadbbaf190de689c7d150ae0b Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 11:51:25 -0300 Subject: [PATCH 09/11] Fix `NuGetDelete` --- Directory.Build.props | 2 +- ricaun.Nuke/Extensions/NuGetExtension.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7bb33d1..9c437e5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.9.2-beta + 1.9.2-beta.1 \ No newline at end of file diff --git a/ricaun.Nuke/Extensions/NuGetExtension.cs b/ricaun.Nuke/Extensions/NuGetExtension.cs index bc02d30..6c83dc2 100644 --- a/ricaun.Nuke/Extensions/NuGetExtension.cs +++ b/ricaun.Nuke/Extensions/NuGetExtension.cs @@ -119,7 +119,7 @@ public static bool NuGetUnlist(string source, string apiKey, string packageFileN try { NuGetTasks.NuGetDelete(s => s - .SetPackageId(packageFileName) + .SetPackageId(packageName) .SetPackageVersion(packageVersion) .SetSource(source) .SetApiKey(apiKey) From bbb7ba7dbe0fd62a57869804a80862586d8f2d5b Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 13:02:37 -0300 Subject: [PATCH 10/11] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd1b607..70d2f6d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This package is to simplify the build automation system using [Nuke.Common](https://www.nuget.org/packages/Nuke.Common/). -[![Visual Studio 2022](https://img.shields.io/badge/Visual%20Studio-2022-blue)](../..) +[![Visual Studio 2022](https://img.shields.io/badge/Visual%20Studio-2022-blue)](https://github.com/ricaun-io/ricaun.Nuke) [![Nuke](https://img.shields.io/badge/Nuke-Build-blue)](https://nuke.build/) [![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Build](https://github.com/ricaun-io/ricaun.Nuke/actions/workflows/Build.yml/badge.svg)](https://github.com/ricaun-io/ricaun.Nuke/actions) From cd185def8194018d97d1b5e16fe9d2ce33c66397 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sun, 19 Jan 2025 13:02:52 -0300 Subject: [PATCH 11/11] Version 1.9.2 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9c437e5..33dd450 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.9.2-beta.1 + 1.9.2 \ No newline at end of file