Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Remove some unused code and add sensible coverage exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Dec 23, 2023
1 parent 9048dac commit e77504a
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 615 deletions.
2 changes: 2 additions & 0 deletions src/Squirrel.Packaging.Windows/AuthenticodeTools.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;

namespace Squirrel.Packaging.Windows
{
[SupportedOSPlatform("windows")]
[ExcludeFromCodeCoverage]
public static class AuthenticodeTools
{
[DllImport("Wintrust.dll", PreserveSig = true, SetLastError = false)]
Expand Down
24 changes: 0 additions & 24 deletions src/Squirrel.Packaging.Windows/CopStache.cs

This file was deleted.

308 changes: 0 additions & 308 deletions src/Squirrel.Packaging.Windows/DotnetUtil.cs

This file was deleted.

34 changes: 1 addition & 33 deletions src/Squirrel.Packaging.Windows/HelperExe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ public HelperExe(ILogger logger) : base(logger)

public static string StubExecutablePath => FindHelperFile("StubExecutable.exe");

// private so we don't expose paths to internal tools. these should be exposed as a helper function
private static string SignToolPath => FindHelperFile("signtool.exe");
private static string WixTemplatePath => FindHelperFile("template.wxs");

private static string RceditPath => FindHelperFile("rcedit.exe");
private static string WixCandlePath => FindHelperFile("candle.exe");
private static string WixLightPath => FindHelperFile("light.exe");

[SupportedOSPlatform("windows")]
private bool CheckIsAlreadySigned(string filePath)
Expand Down Expand Up @@ -116,35 +113,6 @@ public void SignPEFileWithTemplate(string filePath, string signTemplate)
Log.Info("Sign successful: " + result.StdOutput);
}

[SupportedOSPlatform("windows")]
public string CompileWixTemplateToMsi(Dictionary<string, string> templateData, string workingDir, string appId)
{
var wxsFile = Path.Combine(workingDir, appId + ".wxs");
var objFile = Path.Combine(workingDir, appId + ".wixobj");
var msiFile = Path.Combine(workingDir, appId + "_DeploymentTool.msi");

try {
// apply dictionary to wsx template
var templateText = File.ReadAllText(WixTemplatePath);
var templateResult = CopStache.Render(templateText, templateData);
File.WriteAllText(wxsFile, templateResult, Encoding.UTF8);

// Candle reprocesses and compiles WiX source files into object files (.wixobj).
Log.Info("Compiling WiX Template (candle.exe)");
var candleParams = new string[] { "-nologo", "-ext", "WixNetFxExtension", "-out", objFile, wxsFile };
InvokeAndThrowIfNonZero(WixCandlePath, candleParams, workingDir);

// Light links and binds one or more .wixobj files and creates a Windows Installer database (.msi or .msm).
Log.Info("Linking WiX Template (light.exe)");
var lightParams = new string[] { "-ext", "WixNetFxExtension", "-spdb", "-sval", "-out", msiFile, objFile };
InvokeAndThrowIfNonZero(WixLightPath, lightParams, workingDir);
return msiFile;
} finally {
Utility.DeleteFileOrDirectoryHard(wxsFile, throwOnFailure: false);
Utility.DeleteFileOrDirectoryHard(objFile, throwOnFailure: false);
}
}

[SupportedOSPlatform("windows")]
public void SetExeIcon(string exePath, string iconPath)
{
Expand Down
Loading

0 comments on commit e77504a

Please sign in to comment.