-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Build self-contained minimal size package for Guest Config team #14976
Conversation
@daxian-dbw - seems like there are some merge conflicts. please have a look. |
tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1
Outdated
Show resolved
Hide resolved
tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1
Outdated
Show resolved
Hide resolved
tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1
Outdated
Show resolved
Hide resolved
$file = $_.FullName | ||
Write-Verbose "Copying $file to $itemDestination" -Verbose | ||
Copy-Item -Path $file -Destination "$itemDestination\" -Force | ||
$projectAssetsCounter++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this get used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. This was existing code, see below:
PowerShell/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1
Lines 173 to 186 in 877c97f
Write-Verbose "Exporting project.assets files ..." -Verbose | |
$projectAssetsCounter = 1 | |
$projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets' | |
$projectAssetsZip = Join-Path -Path $destination -ChildPath 'windowsProjectAssetssymbols.zip' | |
Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object { | |
$subfolder = $_.FullName.Replace($location,'') | |
$subfolder.Replace('project.assets.json','') | |
$itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $subfolder | |
New-Item -Path $itemDestination -ItemType Directory -Force | |
$file = $_.FullName | |
Write-Verbose "Copying $file to $itemDestination" -Verbose | |
Copy-Item -Path $file -Destination "$itemDestination\" -Force | |
$projectAssetsCounter++ |
@TravisEz13, shall we remove $projectAssetsCounter
?
@@ -1,5 +1,5 @@ | |||
{ | |||
"sdk": { | |||
"version": "6.0.100-preview.1.21104.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not change in this PR right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 21104.4
is not the official .NET 6 preview.1 SDK version. The nuget package versions are all correct, so this is the only place we need to change to make it use the official 6-preview.1 sdk.
tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1
Outdated
Show resolved
Hide resolved
tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1
Outdated
Show resolved
Hide resolved
tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1
Outdated
Show resolved
Hide resolved
Would this PR address this issue #5681 ? |
@kilasuit This is considered to be one step toward that goal, but doesn't resolve that issue. This package is produced mainly for using PowerShell in a service, where startup perf is not a concern (thus no R2R/Crossgen) and GUI won't work (thus no WPF/WinForm). |
@adityapatwardhan and @rjmholt Thanks for the review! I have addressed or replied to your comments, please take another look. Here is the new release build run: https://dev.azure.com/mscodehub/PowerShellCore/_build/results?buildId=175764&view=results |
After that why do you build self-contained application? With shared framework you could significantly reduce a size of the packages. |
This is a requirement from the Azure Guest Configuration service. There is no shared framework available and the service depends on PS package to bring in the .NET runtime. |
@adityapatwardhan please take another look; thank you. |
🎉 Handy links: |
PR Summary
This PR includes changes in
Build.psm1
,packaging.psm1
and the release build template files.For
Build.psm1
,-ForMinimalSize
is added toStart-PSBuild
to build self-contained application for "linux-x64", "win7-x64", or "osx-x64" runtimes. It reduces the size of package by:For
packaging.psm1
,min-size
is added as a new value for-Type
parameter ofStart-PSPackage
.For Windows release build, a new build configuration
minSize
is added, to build and packaging the min-size package.For Linux release build,
-TarMinSize
is added toPowerShellPackage.ps1
as well asbuild.json
to build and package for the min-size package.The min-size package has the
-gc
suffix to indicate that it's for the Guest Config team. In the Azure Blob, the min-size packages are uploaded to the container with the-gc
suffix, not in the main package maintainer (e.g. v7-2-0-preview-4), so that they don't get uploaded to the GitHub release page.Here is the release build run: https://dev.azure.com/mscodehub/PowerShellCore/_build/results?buildId=175764&view=results
The package size is reduced:
PR Context
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.