Skip to content

Commit

Permalink
(chocolatey#3427) Remove use of -unpackself from the build
Browse files Browse the repository at this point in the history
This command is deprecated, so we need to remove it from our build
to give ourselves the ability to actually remove that functionality in
future.
  • Loading branch information
vexx32 committed Oct 25, 2024
1 parent 8fc766e commit 5f5b019
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 66 deletions.
32 changes: 26 additions & 6 deletions recipe.cake
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,21 @@ Task("Prepare-Chocolatey-Packages")
{
// Copy legal documents
CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt");
CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco/LICENSE.txt", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/LICENSE.txt");

// Run Chocolatey Unpackself
CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe");
// Copy choco.exe.manifest
CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco/choco.exe.manifest", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe.manifest");

// Copy external file resources
EnsureDirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers");
CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/helpers/**/*"), BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers", true);
EnsureDirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects");
CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/redirects/**/*"), BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects", true);
EnsureDirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/tools");
CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/tools/**/*"), BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/tools", true);

StartProcess(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build --run-actual" });
// Copy merged choco.exe
CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe");

// Copy Chocolatey.PowerShell.dll and its help.xml file
CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll");
Expand Down Expand Up @@ -264,11 +274,21 @@ Task("Prepare-ChocolateyNo7zip-Package")

// Copy legal documents
CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", nuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt");
CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/LICENSE.txt", nuspecDirectory + "/tools/chocolateyInstall/LICENSE.txt");

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

// Copy external file resources
EnsureDirectoryExists(nuspecDirectory + "/tools/chocolateyInstall/helpers");
CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/helpers/**/*"), nuspecDirectory + "/tools/chocolateyInstall/helpers", true);
EnsureDirectoryExists(nuspecDirectory + "/tools/chocolateyInstall/redirects");
CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/redirects/**/*"), nuspecDirectory + "/tools/chocolateyInstall/redirects", true);
EnsureDirectoryExists(nuspecDirectory + "/tools/chocolateyInstall/tools");
CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/tools/**/*"), nuspecDirectory + "/tools/chocolateyInstall/tools", true);

StartProcess(nuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build" });
// Copy merged choco.exe
CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip_merged/choco.exe", nuspecDirectory + "/tools/chocolateyInstall/choco.exe");

// Copy Chocolatey.PowerShell.dll and help.xml file
CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll", nuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll");
Expand Down
1 change: 1 addition & 0 deletions src/chocolatey.console/chocolatey.console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
<ItemGroup>
<EmbeddedResource Include="choco.exe.manifest">
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<None Include="packages.config" />
</ItemGroup>
Expand Down
228 changes: 168 additions & 60 deletions src/chocolatey.resources/chocolatey.resources.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,98 +64,206 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\chocolateyInstaller.psm1" />
<EmbeddedResource Include="helpers\functions\Format-FileSize.ps1" />
<EmbeddedResource Include="helpers\functions\Get-CheckSumValid.ps1" />
<EmbeddedResource Include="helpers\functions\Get-ChocolateyConfigValue.ps1" />
<EmbeddedResource Include="helpers\functions\Get-ChocolateyPath.ps1" />
<EmbeddedResource Include="helpers\functions\Get-ChocolateyUnzip.ps1" />
<EmbeddedResource Include="helpers\functions\Get-ChocolateyWebFile.ps1" />
<EmbeddedResource Include="helpers\functions\Get-FtpFile.ps1" />
<EmbeddedResource Include="helpers\functions\Get-OSArchitectureWidth.ps1" />
<EmbeddedResource Include="helpers\functions\Get-UACEnabled.ps1" />
<EmbeddedResource Include="helpers\functions\Get-VirusCheckValid.ps1" />
<EmbeddedResource Include="helpers\functions\Get-WebFile.ps1" />
<EmbeddedResource Include="helpers\functions\Get-WebHeaders.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyEnvironmentVariable.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyExplorerMenuItem.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyFileAssociation.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyInstallPackage.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyPackage.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyPinnedTaskBarItem.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyPowershellCommand.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyShortcut.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyVsixPackage.ps1" />
<EmbeddedResource Include="helpers\functions\Install-ChocolateyZipPackage.ps1" />
<EmbeddedResource Include="helpers\functions\Start-ChocolateyProcessAsAdmin.ps1" />
<EmbeddedResource Include="helpers\functions\Uninstall-ChocolateyPackage.ps1" />
<EmbeddedResource Include="helpers\functions\UnInstall-ChocolateyZipPackage.ps1" />
<EmbeddedResource Include="redirects\choco.exe.ignore" />
<EmbeddedResource Include="tools\checksum.exe.ignore" />
<EmbeddedResource Include="tools\shimgen.exe.ignore" />
<EmbeddedResource Include="helpers\chocolateyInstaller.psm1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Format-FileSize.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-CheckSumValid.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-ChocolateyConfigValue.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-ChocolateyPath.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-ChocolateyUnzip.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-ChocolateyWebFile.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-FtpFile.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-OSArchitectureWidth.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-UACEnabled.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-VirusCheckValid.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-WebFile.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Get-WebHeaders.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyEnvironmentVariable.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyExplorerMenuItem.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyFileAssociation.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyInstallPackage.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyPackage.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyPinnedTaskBarItem.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyPowershellCommand.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyShortcut.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyVsixPackage.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Install-ChocolateyZipPackage.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Start-ChocolateyProcessAsAdmin.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Uninstall-ChocolateyPackage.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\UnInstall-ChocolateyZipPackage.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="redirects\choco.exe.ignore">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\checksum.exe.ignore">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\shimgen.exe.ignore">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LICENSE.txt" />
<EmbeddedResource Include="redirects\choco.exe" />
<EmbeddedResource Include="tools\7zip.license.txt" Condition="'$(Configuration)' != 'ReleaseOfficialNo7zip'" />
<EmbeddedResource Include="tools\checksum.exe" />
<EmbeddedResource Include="tools\checksum.license.txt" />
<EmbeddedResource Include="tools\shimgen.exe" />
<EmbeddedResource Include="tools\shimgen.license.txt" />
<EmbeddedResource Include="LICENSE.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="redirects\choco.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\checksum.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\checksum.license.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\shimgen.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\shimgen.license.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="redirects\RefreshEnv.cmd" />
<EmbeddedResource Include="redirects\RefreshEnv.cmd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Install-BinFile.ps1" />
<EmbeddedResource Include="helpers\functions\Uninstall-BinFile.ps1" />
<EmbeddedResource Include="helpers\functions\Install-BinFile.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="helpers\functions\Uninstall-BinFile.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\chocolateyScriptRunner.ps1" />
<EmbeddedResource Include="helpers\chocolateyScriptRunner.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Get-WebFileName.ps1" />
<EmbeddedResource Include="helpers\functions\Get-WebFileName.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Get-ToolsLocation.ps1" />
<EmbeddedResource Include="helpers\functions\Get-ToolsLocation.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\chocolateyProfile.psm1" />
<EmbeddedResource Include="helpers\chocolateyProfile.psm1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\ChocolateyTabExpansion.ps1" />
<EmbeddedResource Include="helpers\ChocolateyTabExpansion.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Set-PowerShellExitCode.ps1" />
<EmbeddedResource Include="helpers\functions\Set-PowerShellExitCode.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Install-Vsix.ps1" />
<EmbeddedResource Include="helpers\functions\Install-Vsix.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Uninstall-ChocolateyEnvironmentVariable.ps1" />
<EmbeddedResource Include="helpers\functions\Uninstall-ChocolateyEnvironmentVariable.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="tools\checksum.exe.config" />
<EmbeddedResource Include="tools\checksum.exe.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Get-UninstallRegistryKey.ps1" />
<EmbeddedResource Include="helpers\functions\Get-UninstallRegistryKey.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' != 'ReleaseOfficialNo7zip'">
<EmbeddedResource Include="tools\7z.dll" />
<EmbeddedResource Include="tools\7z.exe" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' != 'ReleaseOfficialNo7zip'">
<EmbeddedResource Include="tools\7z.exe.ignore" />
<EmbeddedResource Include="tools\7z.exe.manifest" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' != 'ReleaseOfficialNo7zip'">
<EmbeddedResource Include="tools\7z.dll.manifest" />
<EmbeddedResource Include="tools\7z.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\7z.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\7z.exe.ignore">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\7z.exe.manifest">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\7z.dll.manifest">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\7zip.license.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Write-FunctionCallLogMessage.ps1" />
<EmbeddedResource Include="helpers\functions\Write-FunctionCallLogMessage.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="helpers\functions\Get-PackageParameters.ps1" />
<EmbeddedResource Include="helpers\functions\Get-PackageParameters.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down

0 comments on commit 5f5b019

Please sign in to comment.