forked from chocolatey/ChocolateyGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recipe.cake
120 lines (100 loc) · 4.96 KB
/
recipe.cake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#load nuget:?package=Chocolatey.Cake.Recipe&version=0.25.0
///////////////////////////////////////////////////////////////////////////////
// MODULES
///////////////////////////////////////////////////////////////////////////////
#module nuget:?package=Cake.Chocolatey.Module&version=0.3.0
///////////////////////////////////////////////////////////////////////////////
// TOOLS
///////////////////////////////////////////////////////////////////////////////
#tool choco:?package=transifex-cli&version=1.6.5
if (BuildSystem.IsLocalBuild)
{
Environment.SetVariableNames(
gitHubTokenVariable: "CHOCOLATEYGUI_GITHUB_PAT",
transifexApiTokenVariable: "CHOCOLATEYGUI_TRANSIFEX_API_TOKEN"
);
}
else
{
Environment.SetVariableNames();
}
Func<FilePathCollection> getScriptsToSign = () =>
{
var scriptsToSign = GetFiles(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/**/*.ps1") +
GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/**/*.ps1");
Information("The following PowerShell scripts have been selected to be signed...");
foreach (var scriptToSign in scriptsToSign)
{
Information(scriptToSign.FullPath);
}
return scriptsToSign;
};
Func<FilePathCollection> getFilesToSign = () =>
{
var filesToSign = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/^{ChocolateyGui|ChocolateyGuiCli}/{ChocolateyGui|ChocolateyGuiCli}*.{exe|dll}") +
GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/ChocolateyGui*/ChocolateyGui*.dll");
var platformTarget = ToolSettings.BuildPlatformTarget == PlatformTarget.MSIL ? "AnyCPU" : ToolSettings.BuildPlatformTarget.ToString();
foreach(var project in ParseSolution(BuildParameters.SolutionFilePath).GetProjects())
{
var parsedProject = ParseProject(project.Path, BuildParameters.Configuration, platformTarget);
if (parsedProject.RootNameSpace == "ChocolateyGui")
{
filesToSign.Add(parsedProject.OutputPaths.First().FullPath + "/ChocolateyGui.exe");
continue;
}
if (parsedProject.RootNameSpace == "ChocolateyGuiCli")
{
filesToSign.Add(parsedProject.OutputPaths.First().FullPath + "/ChocolateyGuiCli.exe");
continue;
}
if (parsedProject.RootNameSpace == "ChocolateyGui.Common")
{
filesToSign.Add(parsedProject.OutputPaths.First().FullPath + "/ChocolateyGui.Common.dll");
continue;
}
if (parsedProject.RootNameSpace == "ChocolateyGui.Common.Windows")
{
filesToSign.Add(parsedProject.OutputPaths.First().FullPath + "/ChocolateyGui.Common.Windows.dll");
continue;
}
}
Information("The following assemblies have been selected to be signed...");
foreach (var fileToSign in filesToSign)
{
Information(fileToSign.FullPath);
}
return filesToSign;
};
Func<FilePathCollection> getMsisToSign = () =>
{
var msisToSign = GetFiles(BuildParameters.Paths.Directories.Build + "/ChocolateyGUI.msi");
Information("The following msi's have been selected to be signed...");
foreach (var msiToSign in msisToSign)
{
Information(msiToSign.FullPath);
}
return msisToSign;
};
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./Source",
solutionFilePath: "./Source/ChocolateyGui.sln",
solutionDirectoryPath: "./Source/ChocolateyGui",
resharperSettingsFileName: "ChocolateyGui.sln.DotSettings",
title: "Chocolatey GUI",
repositoryOwner: "chocolatey",
repositoryName: "ChocolateyGUI",
shouldDownloadMilestoneReleaseNotes: true,
treatWarningsAsErrors: false,
productName: "Chocolatey GUI",
productDescription: "Chocolatey GUI is a product of Chocolatey Software, Inc. - All Rights Reserved",
productCopyright: "Copyright 2014 - Present Open Source maintainers of Chocolatey GUI, and Chocolatey Software, Inc. - All Rights Reserved.",
useChocolateyGuiStrongNameKey: true,
getScriptsToSign: getScriptsToSign,
getFilesToSign: getFilesToSign,
getMsisToSign: getMsisToSign,
shouldBuildMsi: true,
strongNameDependentAssembliesInputPath: string.Format("{0}{1}", ((FilePath)("./Source")).FullPath, "\\packages\\Splat*"));
ToolSettings.SetToolSettings(context: Context);
BuildParameters.PrintParameters(Context);
Build.Run();