Skip to content

Commit c95bc19

Browse files
committed
(#1120) Fix gathering of files for signing
With the introduction of dotnet build, rather than msbuild, the new net48 folder is causing an issue with gathering of files that need to be signed using the Chocolatey authenticode certificate. There are a number of files added to the net48 folder that _need_ to be signed, but these are not being picked up since the globbing pattern doesn't look in this folder. This commit updates the globbing pattern to include this folder, and also adds an assertion about the number of files that are expected to be found from each glob. This should prevent this from happening again, since the updating of the asserted version number should _only_ be done, when the number of expected files has been known to change.
1 parent 56df11c commit c95bc19

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

recipe.cake

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,40 @@ Func<FilePathCollection> getScriptsToVerify = () =>
3232
Information(scriptToVerify.FullPath);
3333
}
3434

35+
var numberOfScriptsToVerify = scriptsToVerify.Count();
36+
37+
if (numberOfScriptsToVerify != 3)
38+
{
39+
throw new Exception(string.Format("Expected to find 3 scripts to verify, but found {0}", numberOfScriptsToVerify));
40+
}
41+
3542
return scriptsToVerify;
3643
};
3744

3845
Func<FilePathCollection> getScriptsToSign = () =>
3946
{
40-
var scriptsToSign = GetFiles("./nuspec/**/*.{ps1|psm1|psd1}");
47+
var scriptsToSign = GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/**/*.{ps1|psm1|psd1}");
4148

4249
Information("The following PowerShell scripts have been selected to be signed...");
4350
foreach (var scriptToSign in scriptsToSign)
4451
{
4552
Information(scriptToSign.FullPath);
4653
}
4754

55+
var numberOfScriptsToSign = scriptsToSign.Count();
56+
57+
if (numberOfScriptsToSign != 3)
58+
{
59+
throw new Exception(string.Format("Expected to find 3 scripts to verify, but found {0}", numberOfScriptsToSign));
60+
}
61+
4862
return scriptsToSign;
4963
};
5064

5165
Func<FilePathCollection> getFilesToSign = () =>
5266
{
53-
var filesToSign = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/^{ChocolateyGui|ChocolateyGuiCli}/{ChocolateyGui|ChocolateyGuiCli}*.{exe|dll}") +
54-
GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/ChocolateyGui*/ChocolateyGui*.dll");
67+
var filesToSign = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/^{ChocolateyGui|ChocolateyGuiCli}/net48/{ChocolateyGui|ChocolateyGuiCli}*.{exe|dll}") +
68+
GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/ChocolateyGui*/net48/ChocolateyGui*.dll");
5569

5670
var platformTarget = ToolSettings.BuildPlatformTarget == PlatformTarget.MSIL ? "AnyCPU" : ToolSettings.BuildPlatformTarget.ToString();
5771
foreach(var project in ParseSolution(BuildParameters.SolutionFilePath).GetProjects())
@@ -88,6 +102,13 @@ Func<FilePathCollection> getFilesToSign = () =>
88102
Information(fileToSign.FullPath);
89103
}
90104

105+
var numberOfFilesToSign = filesToSign.Count();
106+
107+
if (numberOfFilesToSign != 13)
108+
{
109+
throw new Exception(string.Format("Expected to find 13 files to sign, but found {0}", numberOfFilesToSign));
110+
}
111+
91112
return filesToSign;
92113
};
93114

@@ -101,6 +122,13 @@ Func<FilePathCollection> getMsisToSign = () =>
101122
Information(msiToSign.FullPath);
102123
}
103124

125+
var numberOfMsisToSign = msisToSign.Count();
126+
127+
if (numberOfMsisToSign != 1)
128+
{
129+
throw new Exception(string.Format("Expected to find 1 msis to sign, but found {0}", numberOfMsisToSign));
130+
}
131+
104132
return msisToSign;
105133
};
106134

0 commit comments

Comments
 (0)