From 0a0ba01c90c29ca57b07aec638e69985b35ccdd5 Mon Sep 17 00:00:00 2001 From: Kevin Bost Date: Tue, 3 Dec 2024 21:43:24 -0800 Subject: [PATCH] Fixing build warnings --- .../Commands/WindowsPackCommandRunner.cs | 14 ++++++++------ .../TrustedSigningTests.cs | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/vpk/Velopack.Packaging.Windows/Commands/WindowsPackCommandRunner.cs b/src/vpk/Velopack.Packaging.Windows/Commands/WindowsPackCommandRunner.cs index 2e4b8110..09730b24 100644 --- a/src/vpk/Velopack.Packaging.Windows/Commands/WindowsPackCommandRunner.cs +++ b/src/vpk/Velopack.Packaging.Windows/Commands/WindowsPackCommandRunner.cs @@ -18,14 +18,16 @@ public class WindowsPackCommandRunner : PackageBuilder { } - protected override async Task CodeSign(Action progress, string packDir) + protected override Task CodeSign(Action progress, string packDir) { var filesToSign = new DirectoryInfo(packDir).GetAllFilesRecursively() .Where(x => Options.SignSkipDll ? PathUtil.PathPartEndsWith(x.Name, ".exe") : PathUtil.FileIsLikelyPEImage(x.Name)) .Select(x => x.FullName) .ToArray(); - await SignFilesImpl(Options, progress, filesToSign); + SignFilesImpl(Options, progress, filesToSign); + + return Task.CompletedTask; } protected override Task PreprocessPackDir(Action progress, string packDir) @@ -193,7 +195,7 @@ public class WindowsPackCommandRunner : PackageBuilder SetupBundle.CreatePackageBundle(targetSetupExe, releasePkg); progress(50); Log.Debug("Signing Setup bundle"); - await SignFilesImpl(Options, CoreUtil.CreateProgressDelegate(progress, 50, 100), targetSetupExe); + SignFilesImpl(Options, CoreUtil.CreateProgressDelegate(progress, 50, 100), targetSetupExe); Log.Debug($"Setup bundle created '{Path.GetFileName(targetSetupExe)}'."); progress(100); } @@ -246,7 +248,7 @@ public class WindowsPackCommandRunner : PackageBuilder } } - private async Task SignFilesImpl(WindowsSigningOptions options, Action progress, params string[] filePaths) + private void SignFilesImpl(WindowsSigningOptions options, Action progress, params string[] filePaths) { var signParams = options.SignParameters; var signTemplate = options.SignTemplate; @@ -269,7 +271,7 @@ public class WindowsPackCommandRunner : PackageBuilder if (!string.IsNullOrEmpty(trustedSignMetadataPath)) { Log.Info($"Use Azure Trusted Signing service for code signing. Metadata file path: {trustedSignMetadataPath}"); - string dlibPath = await GetDlibPath(CancellationToken.None); + string dlibPath = GetDlibPath(CancellationToken.None); signParams = $"/fd SHA256 /tr \"http://timestamp.acs.microsoft.com\" /v /debug /td SHA256 /dlib \"{dlibPath}\" /dmdf \"{trustedSignMetadataPath}\""; helper.Sign(filePaths, signParams, signParallel, progress, false); } else if (!string.IsNullOrEmpty(signParams)) { @@ -278,7 +280,7 @@ public class WindowsPackCommandRunner : PackageBuilder } [SupportedOSPlatform("windows")] - private async Task GetDlibPath(CancellationToken cancellationToken) + private string GetDlibPath(CancellationToken cancellationToken) { // DLib library is required for Azure Trusted Signing. It must be in the same directory as SignTool.exe. // https://learn.microsoft.com/azure/trusted-signing/how-to-signing-integrations#download-and-install-the-trusted-signing-dlib-package diff --git a/test/Velopack.Packaging.Tests/TrustedSigningTests.cs b/test/Velopack.Packaging.Tests/TrustedSigningTests.cs index 39df99d4..c0e3592f 100644 --- a/test/Velopack.Packaging.Tests/TrustedSigningTests.cs +++ b/test/Velopack.Packaging.Tests/TrustedSigningTests.cs @@ -1,4 +1,4 @@ -using Azure.Core; +using Azure.Core; using Azure.Identity; using Velopack.Packaging.Windows; using Velopack.Util; @@ -45,7 +45,7 @@ public class TrustedSigningTests Skip.IfNot(await IsAuthenticatedForCodeSigningAsync(), "Sign in with az login first"); } - using var logger = _output.BuildLoggerFor(); + using var logger = _output.BuildLoggerFor(LogLevel.Debug); using var _ = TempUtil.GetTempDirectory(out var releaseDir); string metadataFile = Path.Combine(releaseDir, "metadata.json");