Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/PowerShell/PowerShell.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-10-14 20:37:30 +0300
committerGitHub <noreply@github.com>2022-10-14 20:37:30 +0300
commit525be7602a4e5fea68a3163555f458fb17b525db (patch)
tree5e1027949c307efa794d33aa68313ab4952f8ef2
parente19b173efaf99caab7b2704d2848180e8138a15d (diff)
[release/v7.3.0-rc.1] Remove unnecessary native dependencies from the package (#18297)
* Change the PDB type for release builds are portable * Remove unnecessary dependencies from the package * Update PowerShell.Common.props * Update PowerShell.Common.props * Fix wix files * Get the correct file name for the platform * Address CR feedback * Re-add PresentationNative_cor3.dll * Fix wix Co-authored-by: Aditya Patwardhan <adityap@microsoft.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
-rw-r--r--PowerShell.Common.props16
-rw-r--r--assets/wix/files.wxs16
-rw-r--r--build.psm167
3 files changed, 72 insertions, 27 deletions
diff --git a/PowerShell.Common.props b/PowerShell.Common.props
index 99b5341804..5e7e41f147 100644
--- a/PowerShell.Common.props
+++ b/PowerShell.Common.props
@@ -172,17 +172,12 @@
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>
<Optimize>true</Optimize>
+ <DebugType>portable</DebugType>
</PropertyGroup>
<!-- Define all OS, release configuration properties -->
<PropertyGroup Condition=" '$(Configuration)' == 'StaticAnalysis' ">
<Optimize>true</Optimize>
- <DebugType>full</DebugType>
- </PropertyGroup>
-
- <!-- Define windows, release configuration properties -->
- <PropertyGroup Condition=" '$(Configuration)' == 'Release' And '$(IsWindows)' == 'true' ">
- <Optimize>true</Optimize>
<!-- This is required to be full for compliance tools !-->
<DebugType>full</DebugType>
</PropertyGroup>
@@ -193,15 +188,6 @@
Debugging the issues resolves the problem
-->
<Optimize>false</Optimize>
- <DebugType>portable</DebugType>
- </PropertyGroup>
-
- <!-- Define all OS, CodeCoverage configuration properties -->
- <PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
- <!-- This is required to be portable to Coverlet tool !-->
- <PublishReadyToRun Condition=" '$(Configuration)' != 'Debug' ">true</PublishReadyToRun>
- <PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>
- <DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup>
diff --git a/assets/wix/files.wxs b/assets/wix/files.wxs
index 4a9c36ad3d..c0ca7d624d 100644
--- a/assets/wix/files.wxs
+++ b/assets/wix/files.wxs
@@ -2936,9 +2936,6 @@
<Component Id="cmpF2634E50875D4698921081E3C6B1D5DC">
<File Id="fil5A54754B01054DB590032470CE5F1EBD" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationCore.dll" />
</Component>
- <Component Id="cmpBFAC308E2D8645278D61C126C0FC2C61">
- <File Id="fil2954DD50127543F991A9F0A539E80FA4" KeyPath="yes" Source="$(var.ProductSourcePath)\PenImc_cor3.dll" />
- </Component>
<Component Id="cmp8F0E2CF1B76B4D5185CB6A8DB9236F93">
<File Id="fil91831C8BEFBB49AE8A4FDE50300CA3E8" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationFramework-SystemXml.dll" />
</Component>
@@ -3023,9 +3020,6 @@
<Component Id="cmp930F2D2320B94F6397ECD91862AF7A90">
<File Id="fil0B2E8182CDEC485F8364AB82F5EA2D35" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationFramework.Luna.dll" />
</Component>
- <Component Id="cmp5C8827EF42BE4C098EF08EBD4011DA47">
- <File Id="fil15D3E880E8AD4F9A970422D79FADDBAF" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationNative_cor3.dll" />
- </Component>
<Component Id="cmp6C0567CC32E4457A8F2D03C6E7F5897E">
<File Id="filB46C0C9BDA404C51ACB0F93E5ADACDE5" KeyPath="yes" Source="$(var.ProductSourcePath)\WindowsFormsIntegration.dll" />
</Component>
@@ -3089,9 +3083,6 @@
<Component Id="cmp0BD7D15E0377407FA4C43BFE89F0C12E">
<File Id="fil6EF5C2AED8674A32B0F3CCEE9CBEED71" KeyPath="yes" Source="$(var.ProductSourcePath)\System.Formats.Asn1.dll" />
</Component>
- <Component Id="cmpC0FFB3F4FB30438082D2DC0F4E4BF12D">
- <File Id="fil8FEEEB3B27DF40148EB85CE6AE1A420B" KeyPath="yes" Source="$(var.ProductSourcePath)\Microsoft.DiaSymReader.Native.$(var.FileArchitecture).dll" />
- </Component>
<Component Id="cmpB92B70CEFC2F438386F97264FB436CDD">
<File Id="fil824D1A506096432888ABC2FDFAFABEE5" KeyPath="yes" Source="$(var.ProductSourcePath)\System.Diagnostics.EventLog.Messages.dll" />
</Component>
@@ -3153,6 +3144,9 @@
<Component Id="cmp76EB2749D0464D41AD1D2BA2C51CF4C9">
<File Id="filDC81A93ACA6045E4A22C108F59D69083" KeyPath="yes" Source="$(var.ProductSourcePath)\mscordaccore_$(var.FileArchitecture)_$(var.FileArchitecture)_7.0.22.42610.dll" />
</Component>
+ <Component Id="cmp6986F8B66C514347A25E03DD3096B5AE">
+ <File Id="fil9276D1BDBF8B4C91B90761633720A419" KeyPath="yes" Source="$(var.ProductSourcePath)\PresentationNative_cor3.dll" />
+ </Component>
</DirectoryRef>
</Fragment>
<Fragment>
@@ -4052,7 +4046,6 @@
<ComponentRef Id="cmp30126C60BD784974B74EA45AE9B04032" />
<ComponentRef Id="cmp9EC1507780D247E095EA92A7715B4BAC" />
<ComponentRef Id="cmpF2634E50875D4698921081E3C6B1D5DC" />
- <ComponentRef Id="cmpBFAC308E2D8645278D61C126C0FC2C61" />
<ComponentRef Id="cmp8F0E2CF1B76B4D5185CB6A8DB9236F93" />
<ComponentRef Id="cmp14EA1CB2EC4E4B1DB7F7968B5B3D8E16" />
<ComponentRef Id="cmpF543DDEF59CB4ACB85CBC9A106BD853D" />
@@ -4081,7 +4074,6 @@
<ComponentRef Id="cmpDEE7C0BADEA14B9A9AFFD4C9BF4E7702" />
<ComponentRef Id="cmp10ABC7FB464B42FCA1EDEC7015AFEDCF" />
<ComponentRef Id="cmp930F2D2320B94F6397ECD91862AF7A90" />
- <ComponentRef Id="cmp5C8827EF42BE4C098EF08EBD4011DA47" />
<ComponentRef Id="cmp6C0567CC32E4457A8F2D03C6E7F5897E" />
<ComponentRef Id="cmp18A181D71C894FBE96F4A3563213DC57" />
<ComponentRef Id="cmp1C666476BE6044B4B8C74450F1F32E67" />
@@ -4103,7 +4095,6 @@
<ComponentRef Id="cmpE9599A00802144DF98F5792E029C8875" />
<ComponentRef Id="cmp0989343D60B74AF082291F612F0E6FA6" />
<ComponentRef Id="cmp0BD7D15E0377407FA4C43BFE89F0C12E" />
- <ComponentRef Id="cmpC0FFB3F4FB30438082D2DC0F4E4BF12D" />
<ComponentRef Id="cmpB92B70CEFC2F438386F97264FB436CDD" />
<ComponentRef Id="cmp8635213A03B04AAE8E1BFB7EA85E0DB2" />
<ComponentRef Id="cmp834F3E0C83664E92B0D115A39A8FAACB" />
@@ -4166,6 +4157,7 @@
<ComponentRef Id="cmp76EB2749D0464D41AD1D2BA2C51CF4C9" />
<ComponentRef Id="cmpF5FD2E392BD94BCD957480F128A38E10" />
<ComponentRef Id="cmp28DEAACC47FD4B04A95521A375761643" />
+ <ComponentRef Id="cmp6986F8B66C514347A25E03DD3096B5AE" />
</ComponentGroup>
</Fragment>
</Wix>
diff --git a/build.psm1 b/build.psm1
index 41a9fe928e..0fab7f37b8 100644
--- a/build.psm1
+++ b/build.psm1
@@ -674,6 +674,8 @@ Fix steps:
Restore-PSPester -Destination (Join-Path $publishPath "Modules")
}
+ Clear-NativeDependencies -PublishFolder $publishPath
+
if ($PSOptionsPath) {
$resolvedPSOptionsPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($PSOptionsPath)
$parent = Split-Path -Path $resolvedPSOptionsPath
@@ -3357,3 +3359,68 @@ function Find-AzCopy {
$azCopy = Get-Command -Name azCopy -ErrorAction Stop | Select-Object -First 1
return $azCopy.Path
}
+
+function Clear-NativeDependencies
+{
+ param(
+ [Parameter(Mandatory=$true)] [string] $PublishFolder
+ )
+
+ $diasymFileNamePattern = 'microsoft.diasymreader.native.{0}.dll'
+
+ switch -regex ($($script:Options.Runtime)) {
+ '.*-x64' {
+ $diasymFileName = $diasymFileNamePattern -f 'amd64'
+ }
+ '.*-x86' {
+ $diasymFileName = $diasymFileNamePattern -f 'x86'
+ }
+ '.*-arm' {
+ $diasymFileName = $diasymFileNamePattern -f 'arm'
+ }
+ '.*-arm64' {
+ $diasymFileName = $diasymFileNamePattern -f 'arm64'
+ }
+ 'fxdependent.*' {
+ Write-Verbose -Message "$($script:Options.Runtime) is a fxdependent runtime, skipping diasymreader removal" -Verbose
+ $diasymFileName = $null
+ }
+ Default {
+ throw "Unknown runtime $($script:Options.Runtime)"
+ }
+ }
+
+ $filesToDeleteCore = @($diasymFileName)
+
+ $filesToDeleteWinDesktop = @('penimc_cor3.dll')
+
+ $deps = Get-Content "$PublishFolder/pwsh.deps.json" -Raw | ConvertFrom-Json -Depth 20
+ $targetRuntime = ".NETCoreApp,Version=v7.0/$($script:Options.Runtime)"
+
+ $runtimePackNetCore = $deps.targets.${targetRuntime}.PSObject.Properties.Name -like 'runtimepack.Microsoft.NETCore.App.Runtime*'
+ $runtimePackWinDesktop = $deps.targets.${targetRuntime}.PSObject.Properties.Name -like 'runtimepack.Microsoft.WindowsDesktop.App.Runtime*'
+
+ if ($runtimePackNetCore)
+ {
+ $filesToDeleteCore | ForEach-Object {
+ Write-Verbose "Removing $_ from pwsh.deps.json" -Verbose
+ $deps.targets.${targetRuntime}.${runtimePackNetCore}.native.PSObject.Properties.Remove($_)
+ if (Test-Path $PublishFolder/$_) {
+ Remove-Item -Path $PublishFolder/$_ -Force -Verbose
+ }
+ }
+ }
+
+ if ($runtimePackWinDesktop)
+ {
+ $filesToDeleteWinDesktop | ForEach-Object {
+ Write-Verbose "Removing $_ from pwsh.deps.json" -Verbose
+ $deps.targets.${targetRuntime}.${runtimePackWinDesktop}.native.PSObject.Properties.Remove($_)
+ if (Test-Path $PublishFolder/$_) {
+ Remove-Item -Path $PublishFolder/$_ -Force -Verbose
+ }
+ }
+ }
+
+ $deps | ConvertTo-Json -Depth 20 | Set-Content "$PublishFolder/pwsh.deps.json" -Force
+}