Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#3591) Remove no7zip build tasks #3634

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 1 addition & 154 deletions recipe.cake
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,6 @@ Func<List<ILMergeConfig>> getILMergeConfigs = () =>
PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.dll",
AssemblyPaths = assembliesToILMerge });

if (DirectoryExists(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/"))
{
var no7zAssembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/*.{exe|dll}")
- GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/choco.exe")
- GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/System.Management.Automation.dll")
- GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/chocolatey.tests*.dll")
- GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/{Moq|nunit.framework|Should}.dll");

Information("The following assemblies have been selected to be ILMerged for choco.exe No7zip Version...");
foreach (var assemblyToILMerge in no7zAssembliesToILMerge)
{
Information(assemblyToILMerge.FullPath);
}

mergeConfigs.Add(new ILMergeConfig() {
KeyFile = BuildParameters.StrongNameKeyPath,
LogFile = BuildParameters.Paths.Directories.Build + "/ilmerge-chocono7zipexe.log",
TargetPlatform = targetPlatform,
Target = "exe",
Internalize = BuildParameters.RootDirectoryPath + "/src/chocolatey.console/ilmerge.internalize.ignore.txt",
Output = BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip_merged/choco.exe",
PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/choco.exe",
AssemblyPaths = no7zAssembliesToILMerge });
}

return mergeConfigs;
};

Expand All @@ -93,11 +68,6 @@ Func<FilePathCollection> getScriptsToVerify = () =>
GetFiles(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/**/*.{ps1|psm1|psd1}") +
GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/**/*.{ps1|psm1|psd1}");

if (DirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip"))
{
scriptsToVerify += GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/**/*.{ps1|psm1|psd1}");
}

Information("The following PowerShell scripts have been selected to be verified...");
foreach (var scriptToVerify in scriptsToVerify)
{
Expand Down Expand Up @@ -128,13 +98,6 @@ Func<FilePathCollection> getFilesToSign = () =>
+ GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/tools/{checksum|shimgen}.exe")
+ GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects/*.exe");

if (DirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip"))
{
filesToSign += GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/choco.exe")
+ GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/tools/{checksum|shimgen}.exe")
+ GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/redirects/*.exe");
}

Information("The following assemblies have been selected to be signed...");
foreach (var fileToSign in filesToSign)
{
Expand Down Expand Up @@ -185,122 +148,6 @@ Task("Prepare-Chocolatey-Packages")
}
});

Task("Build-ChocolateyNo7zip")
.WithCriteria(() => BuildParameters.Configuration == "ReleaseOfficial", "Skipping No7zip because this isn't an official release")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependeeOf("Run-ILMerge")
.Does<BuildData>(data => RequireTool(ToolSettings.MSBuildExtensionPackTool, () =>
{
Information("Building {0} with No7zip", BuildParameters.SolutionFilePath);

CleanDirectory(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/");

var no7zLogPath = BuildParameters.Paths.Files.BuildLogFilePath.ToString().Replace("\\.(\\S+)$", "-no7zip.${1}");

if (BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows)
{
var msbuildSettings = new MSBuildSettings
{
ToolPath = ToolSettings.MSBuildToolPath
}
.SetPlatformTarget(ToolSettings.BuildPlatformTarget)
.UseToolVersion(ToolSettings.BuildMSBuildToolVersion)
.WithProperty("OutputPath", MakeAbsolute(new DirectoryPath(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/")).FullPath)
.WithProperty("TreatWarningsAsErrors", BuildParameters.TreatWarningsAsErrors.ToString())
.WithTarget("Build")
.SetMaxCpuCount(ToolSettings.MaxCpuCount)
.SetConfiguration("ReleaseOfficialNo7zip")
.WithLogger(
Context.Tools.Resolve("MSBuild.ExtensionPack.Loggers.dll").FullPath,
"XmlFileLogger",
string.Format(
"logfile=\"{0}\";invalidCharReplacement=_;verbosity=Detailed;encoding=UTF-8",
no7zLogPath
)
);

MSBuild(BuildParameters.SolutionFilePath, msbuildSettings);
}

if (FileExists(no7zLogPath))
{
BuildParameters.BuildProvider.UploadArtifact(no7zLogPath);
}
}));

Task("Prepare-ChocolateyNo7zip-Package")
.WithCriteria(() => BuildParameters.Configuration == "ReleaseOfficial", "Skipping No7zip because this isn't an official release")
.WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows")
.WithCriteria(() => BuildParameters.ShouldRunChocolatey, "Skipping because execution of Chocolatey has been disabled")
.IsDependentOn("Build-ChocolateyNo7zip")
.IsDependeeOf("Sign-Assemblies")
.IsDependeeOf("Verify-PowerShellScripts")
.IsDependeeOf("Create-ChocolateyNo7zip-Package")
.Does(() =>
{
var nuspecDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip";
// Copy the Nuget/Chocolatey directory from Root Folder to temp/nuspec/chocolatey-no7zip
EnsureDirectoryExists(nuspecDirectory);
CopyFiles(GetFiles("./nuspec/chocolatey/**/*"), nuspecDirectory, true);

// Copy legal documents
CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", nuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt");

// Run Chocolatey Unpackself
CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip_merged/choco.exe", nuspecDirectory + "/tools/chocolateyInstall/choco.exe");

StartProcess(nuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build" });

// Tidy up logs and config folder which are not required
var logsDirectory = nuspecDirectory + "/tools/chocolateyInstall/logs";
var configDirectory = nuspecDirectory + "/tools/chocolateyInstall/config";

if (DirectoryExists(logsDirectory))
{
DeleteDirectory(logsDirectory, new DeleteDirectorySettings {
Recursive = true,
Force = true
});
}

if (DirectoryExists(configDirectory))
{
DeleteDirectory(configDirectory, new DeleteDirectorySettings {
Recursive = true,
Force = true
});
}
});

Task("Create-ChocolateyNo7zip-Package")
.WithCriteria(() => BuildParameters.Configuration == "ReleaseOfficial", "Skipping No7zip because this isn't an official release")
.WithCriteria(() => BuildParameters.ShouldRunChocolatey, "Skipping because execution of Chocolatey has been disabled")
.WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows")
.IsDependentOn("Prepare-ChocolateyNo7zip-Package")
.IsDependeeOf("Package")
.Does(() =>
{
var nuspecDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/";
var nuspecFile = nuspecDirectory + "chocolatey.nuspec";

ChocolateyPack(nuspecFile, new ChocolateyPackSettings {
AllowUnofficial = true,
Version = BuildParameters.Version.PackageVersion,
OutputDirectory = nuspecDirectory,
WorkingDirectory = BuildParameters.Paths.Directories.PublishedApplications
});

MoveFile(
nuspecDirectory + "chocolatey." + BuildParameters.Version.PackageVersion + ".nupkg",
BuildParameters.Paths.Directories.ChocolateyPackages + "/chocolatey-no7zip." + BuildParameters.Version.PackageVersion + ".nupkg"
);

// Due to the fact that we have chosen to ignore the no7zip package via the chocolateyNupkgGlobbingPattern, it will
// no longer be automatically uploaded via Chocolatey.Cake.Recipe, so we need to handle that work here.
BuildParameters.BuildProvider.UploadArtifact(BuildParameters.Paths.Directories.ChocolateyPackages + "/chocolatey-no7zip." + BuildParameters.Version.PackageVersion + ".nupkg");
});

Task("Prepare-NuGet-Packages")
.WithCriteria(() => BuildParameters.ShouldRunNuGet, "Skipping because execution of NuGet has been disabled")
.IsDependeeOf("Create-NuGet-Packages")
Expand Down Expand Up @@ -348,7 +195,7 @@ BuildParameters.SetParameters(context: Context,
shouldRunNuGet: IsRunningOnWindows(),
shouldAuthenticodeSignPowerShellScripts: IsRunningOnWindows(),
shouldPublishAwsLambdas: false,
chocolateyNupkgGlobbingPattern: "/**/chocolatey[!-no7zip]*.nupkg");
chocolateyNupkgGlobbingPattern: "/**/chocolatey*.nupkg");

ToolSettings.SetToolSettings(context: Context,
buildMSBuildToolVersion: MSBuildToolVersion.NET40);
Expand Down
20 changes: 0 additions & 20 deletions src/chocolatey.console/chocolatey.console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,6 @@
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficialNo7zip|x86'">
<OutputPath>bin\x86\ReleaseOfficialNo7zip\</OutputPath>
<DefineConstants>TRACE;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<Optimize>true</Optimize>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficialNo7zip|AnyCPU'">
<OutputPath>bin\ReleaseOfficialNo7zip\</OutputPath>
<DefineConstants>TRACE;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<Optimize>true</Optimize>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="AlphaFS, Version=2.1.0.0, Culture=neutral, PublicKeyToken=4d31a58f7d7ad5c9, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
10 changes: 5 additions & 5 deletions src/chocolatey.resources/chocolatey.resources.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU' or '$(Configuration)|$(Platform)' == 'ReleaseOfficialNo7zip|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU'">
<OutputPath>bin\ReleaseOfficial\</OutputPath>
<DefineConstants>TRACE;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<Optimize>true</Optimize>
Expand Down Expand Up @@ -104,7 +104,7 @@
<EmbeddedResource Include="redirects\cpush.exe" />
<EmbeddedResource Include="redirects\cuninst.exe" />
<EmbeddedResource Include="redirects\cup.exe" />
<EmbeddedResource Include="tools\7zip.license.txt" Condition="'$(Configuration)' != 'ReleaseOfficialNo7zip'" />
<EmbeddedResource Include="tools\7zip.license.txt" />
<EmbeddedResource Include="tools\checksum.exe" />
<EmbeddedResource Include="tools\checksum.license.txt" />
<EmbeddedResource Include="tools\shimgen.exe" />
Expand Down Expand Up @@ -155,15 +155,15 @@
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Get-UninstallRegistryKey.ps1" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' != 'ReleaseOfficialNo7zip'">
<ItemGroup>
<EmbeddedResource Include="tools\7z.dll" />
<EmbeddedResource Include="tools\7z.exe" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' != 'ReleaseOfficialNo7zip'">
<ItemGroup>
<EmbeddedResource Include="tools\7z.exe.ignore" />
<EmbeddedResource Include="tools\7z.exe.manifest" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' != 'ReleaseOfficialNo7zip'">
<ItemGroup>
<EmbeddedResource Include="tools\7z.dll.manifest" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading
Loading