Skip to content

Commit

Permalink
Add IGenerateTools
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Dec 4, 2024
1 parent 3eb840e commit b15c513
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 6 deletions.
1 change: 1 addition & 0 deletions Build/.nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"Build",
"Clean",
"Compile",
"GenerateTools",
"GitRelease",
"Release",
"Sign",
Expand Down
2 changes: 1 addition & 1 deletion Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using ricaun.Nuke;
using ricaun.Nuke.Components;

class Build : NukeBuild, IPublish, ITest //,IShowNuGetKeyVaultSign
class Build : NukeBuild, IPublish, ITest, IGenerateTools
{
string ITest.TestProjectName => "Nuke.NuGetKeyVaultSignTool";
public static int Main() => Execute<Build>(x => x.From<IPublish>().Build);
Expand Down
1 change: 1 addition & 0 deletions Build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<ItemGroup>
<PackageReference Include="ricaun.Nuke" Version="*" />
<PackageReference Include="Nuke.Tooling.Generator" Version="8.*" />
</ItemGroup>

<ItemGroup>
Expand Down
27 changes: 27 additions & 0 deletions Build/IGenerateTools.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Nuke.Common;
using Nuke.Common.IO;
using Nuke.Common.Utilities.Collections;
using ricaun.Nuke.Components;
using static Nuke.CodeGeneration.CodeGenerator;

using Nuke.Common.Tools.GitHub;

public interface IGenerateTools : IClean, ICompile, IHazMainProject, IHazGitRepository
{
AbsolutePath SpecificationsDirectory => MainProject.Directory / "Tools";
Target GenerateTools => _ => _
.TriggeredBy(Clean)
.Before(Compile)
.Executes(() =>
{
SpecificationsDirectory.GlobFiles("*.json").ForEach(x =>
{
Serilog.Log.Information($"GenerateCode: {x.Name}");
GenerateCode(
x,
namespaceProvider: x => $"Nuke.Common.Tools.{x.Name}",
sourceFileProvider: x => GitRepository.GetGitHubBrowseUrl(x.SpecificationFile)
);
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace Nuke.Common.Tools.NuGetKeyVaultSignTool;

/// <summary>
/// <p>Azure Sign Tool is similar to <c>signtool</c> in the Windows SDK, with the major difference being that it uses Azure Key Vault for performing the signing process. The usage is like <c>signtool</c>, except with a limited set of options for signing and options for authenticating to Azure Key Vault.</p>
/// <p>NuGet Key Vault Sign Tool is similar to <c>nuget sign</c>, with the major difference being that it uses Azure Key Vault for performing the signing process. Similar usage configuration like <c>AzureSignTool</c>, except is used to sign nuget package.</p>
/// <p>For more details, visit the <a href="https://github.com/novotnyllc/NuGetKeyVaultSignTool">official website</a>.</p>
/// </summary>
[PublicAPI]
Expand All @@ -36,7 +36,7 @@ public partial class NuGetKeyVaultSignToolTasks
public static Action<OutputType, string> NuGetKeyVaultSignToolLogger { get; set; } = ProcessTasks.DefaultLogger;
public static Action<ToolSettings, IProcess> NuGetKeyVaultSignToolExitHandler { get; set; } = ProcessTasks.DefaultExitHandler;
/// <summary>
/// <p>Azure Sign Tool is similar to <c>signtool</c> in the Windows SDK, with the major difference being that it uses Azure Key Vault for performing the signing process. The usage is like <c>signtool</c>, except with a limited set of options for signing and options for authenticating to Azure Key Vault.</p>
/// <p>NuGet Key Vault Sign Tool is similar to <c>nuget sign</c>, with the major difference being that it uses Azure Key Vault for performing the signing process. Similar usage configuration like <c>AzureSignTool</c>, except is used to sign nuget package.</p>
/// <p>For more details, visit the <a href="https://github.com/novotnyllc/NuGetKeyVaultSignTool">official website</a>.</p>
/// </summary>
public static IReadOnlyCollection<Output> NuGetKeyVaultSignTool(ArgumentStringHandler arguments, string workingDirectory = null, IReadOnlyDictionary<string, string> environmentVariables = null, int? timeout = null, bool? logOutput = null, bool? logInvocation = null, Action<OutputType, string> logger = null, Action<IProcess> exitHandler = null)
Expand All @@ -46,7 +46,7 @@ public static IReadOnlyCollection<Output> NuGetKeyVaultSignTool(ArgumentStringHa
return process.Output;
}
/// <summary>
/// <p>Azure Sign Tool is similar to <c>signtool</c> in the Windows SDK, with the major difference being that it uses Azure Key Vault for performing the signing process. The usage is like <c>signtool</c>, except with a limited set of options for signing and options for authenticating to Azure Key Vault.</p>
/// <p>NuGet Key Vault Sign Tool is similar to <c>nuget sign</c>, with the major difference being that it uses Azure Key Vault for performing the signing process. Similar usage configuration like <c>AzureSignTool</c>, except is used to sign nuget package.</p>
/// <p>For more details, visit the <a href="https://github.com/novotnyllc/NuGetKeyVaultSignTool">official website</a>.</p>
/// </summary>
/// <remarks>
Expand Down Expand Up @@ -75,7 +75,7 @@ public static IReadOnlyCollection<Output> NuGetKeyVaultSignTool(NuGetKeyVaultSig
return process.Output;
}
/// <summary>
/// <p>Azure Sign Tool is similar to <c>signtool</c> in the Windows SDK, with the major difference being that it uses Azure Key Vault for performing the signing process. The usage is like <c>signtool</c>, except with a limited set of options for signing and options for authenticating to Azure Key Vault.</p>
/// <p>NuGet Key Vault Sign Tool is similar to <c>nuget sign</c>, with the major difference being that it uses Azure Key Vault for performing the signing process. Similar usage configuration like <c>AzureSignTool</c>, except is used to sign nuget package.</p>
/// <p>For more details, visit the <a href="https://github.com/novotnyllc/NuGetKeyVaultSignTool">official website</a>.</p>
/// </summary>
/// <remarks>
Expand All @@ -101,7 +101,7 @@ public static IReadOnlyCollection<Output> NuGetKeyVaultSignTool(Configure<NuGetK
return NuGetKeyVaultSignTool(configurator(new NuGetKeyVaultSignToolSettings()));
}
/// <summary>
/// <p>Azure Sign Tool is similar to <c>signtool</c> in the Windows SDK, with the major difference being that it uses Azure Key Vault for performing the signing process. The usage is like <c>signtool</c>, except with a limited set of options for signing and options for authenticating to Azure Key Vault.</p>
/// <p>NuGet Key Vault Sign Tool is similar to <c>nuget sign</c>, with the major difference being that it uses Azure Key Vault for performing the signing process. Similar usage configuration like <c>AzureSignTool</c>, except is used to sign nuget package.</p>
/// <p>For more details, visit the <a href="https://github.com/novotnyllc/NuGetKeyVaultSignTool">official website</a>.</p>
/// </summary>
/// <remarks>
Expand Down
5 changes: 5 additions & 0 deletions Nuke.NuGetKeyVaultSignTool/Tools/NuGetKeyVaultSignTool.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
"name": "KeyVaultUrl",
"type": "string",
"format": "--azure-key-vault-url {value}",
"secret": false,
"help": "A fully qualified URL of the key vault with the certificate that will be used for signing. An example value might be <c>https://my-vault.vault.azure.net</c>."
},
{
"name": "KeyVaultClientId",
"type": "string",
"format": "--azure-key-vault-client-id {value}",
"secret": false,
"help": "This is the client ID used to authenticate to Azure, which will be used to generate an access token. This parameter is not required if an access token is supplied directly with the <c>--azure-key-vault-accesstoken</c> option. If this parameter is supplied, <c>--azure-key-vault-client-secret</c> and <c>--azure-key-vault-tenant-id</c> must be supplied as well."
},
{
Expand All @@ -39,12 +41,14 @@
"name": "KeyVaultTenantId",
"type": "string",
"format": "--azure-key-vault-tenant-id {value}",
"secret": false,
"help": "This is the tenant id used to authenticate to Azure, which will be used to generate an access token. This parameter is not required if an access token is supplied directly with the <c>--azure-key-vault-accesstoken</c> option or when using managed identities with <c>--azure-key-vault-managed-identity</c>. If this parameter is supplied, <c>--azure-key-vault-client-id</c> and <c>--azure-key-vault-client-secret</c> must be supplied as well."
},
{
"name": "KeyVaultCertificateName",
"type": "string",
"format": "--azure-key-vault-certificate {value}",
"secret": false,
"help": "The name of the certificate used to perform the signing operation."
},
{
Expand All @@ -58,6 +62,7 @@
"name": "KeyVaultManagedIdentity",
"type": "bool",
"format": "--azure-key-vault-managed-identity",
"secret": false,
"help": "Use the ambient Managed Identity to authenticate to Azure. This can be used instead of the <c>--azure-key-vault-accesstoken</c>, <c>--azure-key-vault-client-id</c> and <c>--azure-key-vault-client-secret</c> options. This is useful if NuGetKeyVaultSignTool is being used on a VM/service/CLI that is configured for managed identities to Azure."
},
{
Expand Down

0 comments on commit b15c513

Please sign in to comment.