1- #load nuget : ? package= Chocolatey . Cake . Recipe & version = 0.28 .4
1+ #load nuget : ? package= Chocolatey . Cake . Recipe & version = 0.29 .0
22#tool nuget: ? package = WiX & version = 3.11 .2
33
44///////////////////////////////////////////////////////////////////////////////
@@ -58,32 +58,6 @@ Func<List<ILMergeConfig>> getILMergeConfigs = () =>
5858 PrimaryAssemblyName = BuildParameters . Paths . Directories . PublishedLibraries + "/chocolatey/chocolatey.dll" ,
5959 AssemblyPaths = assembliesToILMerge } ) ;
6060
61- if ( DirectoryExists ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/" ) )
62- {
63- var no7zAssembliesToILMerge = GetFiles ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/*.{exe|dll}" )
64- - GetFiles ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/choco.exe" )
65- - GetFiles ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/System.Management.Automation.dll" )
66- - GetFiles ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/chocolatey.tests*.dll" )
67- - GetFiles ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/{Moq|nunit|Should|testcentric}*.dll" )
68- - GetFiles ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/Chocolatey.PowerShell.dll" ) ;
69-
70- Information ( "The following assemblies have been selected to be ILMerged for choco.exe No7zip Version..." ) ;
71- foreach ( var assemblyToILMerge in no7zAssembliesToILMerge )
72- {
73- Information ( assemblyToILMerge . FullPath ) ;
74- }
75-
76- mergeConfigs . Add ( new ILMergeConfig ( ) {
77- KeyFile = BuildParameters . StrongNameKeyPath ,
78- LogFile = BuildParameters . Paths . Directories . Build + "/ilmerge-chocono7zipexe.log" ,
79- TargetPlatform = targetPlatform ,
80- Target = "exe" ,
81- Internalize = BuildParameters . RootDirectoryPath + "/src/chocolatey.console/ilmerge.internalize.ignore.txt" ,
82- Output = BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip_merged/choco.exe" ,
83- PrimaryAssemblyName = BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/choco.exe" ,
84- AssemblyPaths = no7zAssembliesToILMerge } ) ;
85- }
86-
8761 return mergeConfigs ;
8862} ;
8963
@@ -93,11 +67,6 @@ Func<FilePathCollection> getScriptsToVerify = () =>
9367 GetFiles ( BuildParameters . Paths . Directories . NuGetNuspecDirectory + "/**/*.{ps1|psm1|psd1}" ) +
9468 GetFiles ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "/**/*.{ps1|psm1|psd1}" ) ;
9569
96- if ( DirectoryExists ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "-no7zip" ) )
97- {
98- scriptsToVerify += GetFiles ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "-no7zip/**/*.{ps1|psm1|psd1}" ) ;
99- }
100-
10170 Information ( "The following PowerShell scripts have been selected to be verified..." ) ;
10271 foreach ( var scriptToVerify in scriptsToVerify )
10372 {
@@ -129,14 +98,6 @@ Func<FilePathCollection> getFilesToSign = () =>
12998 + GetFiles ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects/*.exe" )
13099 + GetFiles ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll" ) ;
131100
132- if ( DirectoryExists ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "-no7zip" ) )
133- {
134- filesToSign += GetFiles ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/choco.exe" )
135- + GetFiles ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/tools/{checksum|shimgen}.exe" )
136- + GetFiles ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/redirects/*.exe" )
137- + GetFiles ( BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll" ) ;
138- }
139-
140101 Information ( "The following assemblies have been selected to be signed..." ) ;
141102 foreach ( var fileToSign in filesToSign )
142103 {
@@ -215,136 +176,6 @@ Task("Prepare-Chocolatey-Packages")
215176 }
216177} ) ;
217178
218- Task( "Build-ChocolateyNo7zip" )
219- . WithCriteria ( ( ) => BuildParameters . Configuration == "ReleaseOfficial" , "Skipping No7zip because this isn't an official release" )
220- . IsDependentOn ( "Build" )
221- . IsDependentOn ( "Test" )
222- . IsDependeeOf ( "Run-ILMerge" )
223- . Does < BuildData > ( data => RequireTool ( ToolSettings . MSBuildExtensionPackTool , ( ) =>
224- {
225- Information ( "Building {0} with No7zip" , BuildParameters . SolutionFilePath ) ;
226-
227- CleanDirectory ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/" ) ;
228-
229- var no7zLogPath = BuildParameters . Paths . Files . BuildLogFilePath . ToString ( ) . Replace ( "\\ .(\\ S+)$" , "-no7zip.${1}" ) ;
230-
231- if ( BuildParameters . BuildAgentOperatingSystem == PlatformFamily . Windows )
232- {
233- var msbuildSettings = new MSBuildSettings ( )
234- {
235- ToolPath = ToolSettings . MSBuildToolPath
236- }
237- . SetPlatformTarget ( ToolSettings . BuildPlatformTarget )
238- . UseToolVersion ( ToolSettings . BuildMSBuildToolVersion )
239- . WithProperty ( "OutputPath" , MakeAbsolute ( new DirectoryPath ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/" ) ) . FullPath )
240- . WithProperty ( "TreatWarningsAsErrors" , BuildParameters . TreatWarningsAsErrors . ToString ( ) )
241- . WithTarget ( "Build" )
242- . SetMaxCpuCount ( ToolSettings . MaxCpuCount )
243- . SetConfiguration ( "ReleaseOfficialNo7zip" )
244- . WithLogger (
245- Context . Tools . Resolve ( "MSBuild.ExtensionPack.Loggers.dll" ) . FullPath ,
246- "XmlFileLogger" ,
247- string . Format (
248- "logfile=\" {0}\" ;invalidCharReplacement=_;verbosity=Detailed;encoding=UTF-8" ,
249- no7zLogPath
250- )
251- ) ;
252-
253- MSBuild ( BuildParameters . SolutionFilePath , msbuildSettings ) ;
254- }
255-
256- if ( FileExists ( no7zLogPath ) )
257- {
258- BuildParameters . BuildProvider . UploadArtifact ( no7zLogPath ) ;
259- }
260- } ) ) ;
261-
262- Task( "Prepare-ChocolateyNo7zip-Package" )
263- . WithCriteria ( ( ) => BuildParameters . Configuration == "ReleaseOfficial" , "Skipping No7zip because this isn't an official release" )
264- . WithCriteria ( ( ) => BuildParameters . BuildAgentOperatingSystem == PlatformFamily . Windows , "Skipping because not running on Windows" )
265- . WithCriteria ( ( ) => BuildParameters . ShouldRunChocolatey , "Skipping because execution of Chocolatey has been disabled" )
266- . IsDependentOn ( "Build-ChocolateyNo7zip" )
267- . IsDependeeOf ( "Sign-Assemblies" )
268- . IsDependeeOf ( "Verify-PowerShellScripts" )
269- . IsDependeeOf ( "Create-ChocolateyNo7zip-Package" )
270- . Does ( ( ) =>
271- {
272- var nuspecDirectory = BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "-no7zip" ;
273- // Copy the Nuget/Chocolatey directory from Root Folder to temp/nuspec/chocolatey-no7zip
274- EnsureDirectoryExists ( nuspecDirectory ) ;
275- CopyFiles ( GetFiles ( "./nuspec/chocolatey/**/*" ) , nuspecDirectory , true ) ;
276-
277- // Copy legal documents
278- CopyFile ( BuildParameters . RootDirectoryPath + "/docs/legal/CREDITS.md" , nuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt" ) ;
279- CopyFile ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/LICENSE.txt" , nuspecDirectory + "/tools/chocolateyInstall/LICENSE.txt" ) ;
280-
281- // Copy choco.exe.manifest
282- CopyFile ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/choco.exe.manifest" , nuspecDirectory + "/tools/chocolateyInstall/choco.exe.manifest" ) ;
283-
284- // Copy external file resources
285- EnsureDirectoryExists ( nuspecDirectory + "/tools/chocolateyInstall/helpers" ) ;
286- CopyFiles ( GetFiles ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/helpers/**/*" ) , nuspecDirectory + "/tools/chocolateyInstall/helpers" , true ) ;
287- EnsureDirectoryExists ( nuspecDirectory + "/tools/chocolateyInstall/redirects" ) ;
288- CopyFiles ( GetFiles ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/redirects/**/*" ) , nuspecDirectory + "/tools/chocolateyInstall/redirects" , true ) ;
289- EnsureDirectoryExists ( nuspecDirectory + "/tools/chocolateyInstall/tools" ) ;
290- CopyFiles ( GetFiles ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip/tools/**/*" ) , nuspecDirectory + "/tools/chocolateyInstall/tools" , true ) ;
291-
292- // Copy merged choco.exe
293- CopyFile ( BuildParameters . Paths . Directories . PublishedApplications + "/choco-no7zip_merged/choco.exe" , nuspecDirectory + "/tools/chocolateyInstall/choco.exe" ) ;
294-
295- // Copy Chocolatey.PowerShell.dll and help.xml file
296- CopyFile ( BuildParameters . Paths . Directories . PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll" , nuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll" ) ;
297- CopyFile ( BuildParameters . Paths . Directories . PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-help.xml" , nuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll-help.xml" ) ;
298-
299- // Tidy up logs and config folder which are not required
300- var logsDirectory = nuspecDirectory + "/tools/chocolateyInstall/logs" ;
301- var configDirectory = nuspecDirectory + "/tools/chocolateyInstall/config" ;
302-
303- if ( DirectoryExists ( logsDirectory ) )
304- {
305- DeleteDirectory ( logsDirectory , new DeleteDirectorySettings {
306- Recursive = true ,
307- Force = true
308- } ) ;
309- }
310-
311- if ( DirectoryExists ( configDirectory ) )
312- {
313- DeleteDirectory ( configDirectory , new DeleteDirectorySettings {
314- Recursive = true ,
315- Force = true
316- } ) ;
317- }
318- } ) ;
319-
320- Task( "Create-ChocolateyNo7zip-Package" )
321- . WithCriteria ( ( ) => BuildParameters . Configuration == "ReleaseOfficial" , "Skipping No7zip because this isn't an official release" )
322- . WithCriteria ( ( ) => BuildParameters . ShouldRunChocolatey , "Skipping because execution of Chocolatey has been disabled" )
323- . WithCriteria ( ( ) => BuildParameters . BuildAgentOperatingSystem == PlatformFamily . Windows , "Skipping because not running on Windows" )
324- . IsDependentOn ( "Prepare-ChocolateyNo7zip-Package" )
325- . IsDependeeOf ( "Package" )
326- . Does ( ( ) =>
327- {
328- var nuspecDirectory = BuildParameters . Paths . Directories . ChocolateyNuspecDirectory + "-no7zip/" ;
329- var nuspecFile = nuspecDirectory + "chocolatey.nuspec" ;
330-
331- ChocolateyPack ( nuspecFile , new ChocolateyPackSettings {
332- AllowUnofficial = true ,
333- Version = BuildParameters . Version . PackageVersion ,
334- OutputDirectory = nuspecDirectory ,
335- WorkingDirectory = BuildParameters . Paths . Directories . PublishedApplications
336- } ) ;
337-
338- MoveFile (
339- nuspecDirectory + "chocolatey." + BuildParameters . Version . PackageVersion + ".nupkg" ,
340- BuildParameters . Paths . Directories . ChocolateyPackages + "/chocolatey-no7zip." + BuildParameters . Version . PackageVersion + ".nupkg"
341- ) ;
342-
343- // Due to the fact that we have chosen to ignore the no7zip package via the chocolateyNupkgGlobbingPattern, it will
344- // no longer be automatically uploaded via Chocolatey.Cake.Recipe, so we need to handle that work here.
345- BuildParameters . BuildProvider . UploadArtifact ( BuildParameters . Paths . Directories . ChocolateyPackages + "/chocolatey-no7zip." + BuildParameters . Version . PackageVersion + ".nupkg" ) ;
346- } ) ;
347-
348179Task( "Prepare-NuGet-Packages" )
349180 . WithCriteria ( ( ) => BuildParameters . ShouldRunNuGet , "Skipping because execution of NuGet has been disabled" )
350181 . IsDependeeOf ( "Create-NuGet-Packages" )
@@ -441,7 +272,7 @@ BuildParameters.SetParameters(context: Context,
441272 shouldRunNuGet : IsRunningOnWindows ( ) ,
442273 shouldAuthenticodeSignPowerShellScripts : IsRunningOnWindows ( ) ,
443274 shouldPublishAwsLambdas : false ,
444- chocolateyNupkgGlobbingPattern : "/**/chocolatey[!-no7zip] *.nupkg" ) ;
275+ chocolateyNupkgGlobbingPattern : "/**/chocolatey*.nupkg" ) ;
445276
446277ToolSettings. SetToolSettings ( context : Context ) ;
447278
0 commit comments