Skip to content

Commit 472b5f7

Browse files
authored
Enable full symbols for windows (PowerShell#6853)
The main purpose of this was to enable full symbols for windows release build. Also makes explicit where we are optimizing and where we are not optimizing due to https://github.com/dotnet/corefx/issues/29700
1 parent 0a322dd commit 472b5f7

19 files changed

Lines changed: 54 additions & 226 deletions

File tree

PowerShell.Common.props

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,43 @@
108108
<HighEntropyVA>true</HighEntropyVA>
109109
</PropertyGroup>
110110

111+
<PropertyGroup>
112+
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
113+
<IsWindows Condition="'$(OS)' == 'Windows_NT'">true</IsWindows>
114+
</PropertyGroup>
115+
116+
<!-- Define non-windows, all configuration properties -->
117+
<PropertyGroup Condition=" '$(IsWindows)' != 'true' ">
118+
<DefineConstants>$(DefineConstants);UNIX</DefineConstants>
119+
</PropertyGroup>
120+
121+
<!-- Define all OS, debug configuration properties -->
122+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
123+
<DebugType>portable</DebugType>
124+
</PropertyGroup>
125+
126+
<!-- Define all OS, release configuration properties -->
127+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
128+
<Optimize>true</Optimize>
129+
</PropertyGroup>
130+
131+
<!-- Define windows, release configuration properties -->
132+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' And '$(IsWindows)' == 'true' ">
133+
<Optimize>true</Optimize>
134+
<DebugType>full</DebugType>
135+
</PropertyGroup>
136+
137+
<!-- Define non-windows, release configuration properties -->
138+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' And '$(IsWindows)' != 'true' ">
139+
<!-- Set-Date fails with optimize enabled in NonWindowsSetDate
140+
Debugging the issues resolves the problem
141+
-->
142+
<Optimize>false</Optimize>
143+
<DebugType>portable</DebugType>
144+
</PropertyGroup>
145+
146+
<!-- Define all OS, CodeCoverage configuration properties -->
147+
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
148+
<DebugType>full</DebugType>
149+
</PropertyGroup>
111150
</Project>

build.psm1

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ function Start-PSBuild {
410410
"win-arm64")]
411411
[string]$Runtime,
412412

413-
[ValidateSet('Linux', 'Debug', 'Release', 'CodeCoverage', '')] # We might need "Checked" as well
413+
[ValidateSet('Debug', 'Release', 'CodeCoverage', '')] # We might need "Checked" as well
414414
[string]$Configuration,
415415

416416
[switch]$CrossGen,
@@ -704,7 +704,7 @@ function Compress-TestContent {
704704
function New-PSOptions {
705705
[CmdletBinding()]
706706
param(
707-
[ValidateSet("Linux", "Debug", "Release", "CodeCoverage", "")]
707+
[ValidateSet("Debug", "Release", "CodeCoverage", '')]
708708
[string]$Configuration,
709709

710710
[ValidateSet("netcoreapp2.1")]
@@ -736,36 +736,20 @@ function New-PSOptions {
736736

737737
$ConfigWarningMsg = "The passed-in Configuration value '{0}' is not supported on '{1}'. Use '{2}' instead."
738738
if (-not $Configuration) {
739-
$Configuration = if ($Environment.IsLinux -or $Environment.IsMacOS) {
740-
"Linux"
741-
} elseif ($Environment.IsWindows) {
742-
"Debug"
743-
}
739+
$Configuration = 'Debug'
744740
} else {
745741
switch ($Configuration) {
746-
"Linux" {
747-
if ($Environment.IsWindows) {
748-
$Configuration = "Debug"
749-
Write-Warning ($ConfigWarningMsg -f $switch.Current, "Windows", $Configuration)
750-
}
751-
}
752742
"CodeCoverage" {
753743
if(-not $Environment.IsWindows) {
754-
$Configuration = "Linux"
755-
Write-Warning ($ConfigWarningMsg -f $switch.Current, $Environment.LinuxInfo.PRETTY_NAME, $Configuration)
756-
}
757-
}
758-
Default {
759-
if ($Environment.IsLinux -or $Environment.IsMacOS) {
760-
$Configuration = "Linux"
744+
$Configuration = "Debug"
761745
Write-Warning ($ConfigWarningMsg -f $switch.Current, $Environment.LinuxInfo.PRETTY_NAME, $Configuration)
762746
}
763747
}
764748
}
765749
}
766750
Write-Verbose "Using configuration '$Configuration'"
767751

768-
$PowerShellDir = if ($Configuration -eq 'Linux') {
752+
$PowerShellDir = if (!$Environment.IsWindows) {
769753
"powershell-unix"
770754
} else {
771755
"powershell-win-core"
@@ -1460,7 +1444,7 @@ function Start-PSxUnit {
14601444

14611445
if((Test-Path $requiredDependencies) -notcontains $false)
14621446
{
1463-
$options = New-PSOptions
1447+
$options = Get-PSOptions -DefaultToNew
14641448
$Destination = "bin/$($options.configuration)/$($options.framework)"
14651449
New-Item $Destination -ItemType Directory -Force > $null
14661450
Copy-Item -Path $requiredDependencies -Destination $Destination -Force

src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,4 @@
2727
<Compile Remove="gen\GetEventResources.cs" />
2828
</ItemGroup>
2929

30-
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
31-
<DebugType>portable</DebugType>
32-
</PropertyGroup>
33-
34-
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
35-
<DefineConstants>$(DefineConstants);UNIX</DefineConstants>
36-
</PropertyGroup>
37-
38-
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
39-
<DebugType>full</DebugType>
40-
</PropertyGroup>
41-
4230
</Project>

src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,6 @@
5555
<EmbeddedResource Remove="resources\ClipboardResources.resx" />
5656
</ItemGroup>
5757

58-
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
59-
<DebugType>portable</DebugType>
60-
</PropertyGroup>
61-
62-
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
63-
<DefineConstants>$(DefineConstants);UNIX</DefineConstants>
64-
</PropertyGroup>
65-
66-
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
67-
<DebugType>full</DebugType>
68-
</PropertyGroup>
69-
7058
<ItemGroup>
7159
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
7260
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.5.0-rc1-26423-06" />

src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,6 @@
6464
<EmbeddedResource Remove="resources\ImmutableStrings.resx" />
6565
</ItemGroup>
6666

67-
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
68-
<DebugType>portable</DebugType>
69-
</PropertyGroup>
70-
71-
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
72-
<DefineConstants>$(DefineConstants);UNIX</DefineConstants>
73-
</PropertyGroup>
74-
75-
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
76-
<DebugType>full</DebugType>
77-
</PropertyGroup>
78-
7967
<ItemGroup>
8068
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.7.0" />
8169
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="2.7.0" />

src/Microsoft.PowerShell.ConsoleHost/Microsoft.PowerShell.ConsoleHost.csproj

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,4 @@
2424
<EmbeddedResource Remove="resources\HostMshSnapinResources.resx" />
2525
</ItemGroup>
2626

27-
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
28-
<DebugType>portable</DebugType>
29-
</PropertyGroup>
30-
31-
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
32-
<DefineConstants>$(DefineConstants);UNIX</DefineConstants>
33-
</PropertyGroup>
34-
35-
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
36-
<DebugType>full</DebugType>
37-
</PropertyGroup>
38-
3927
</Project>

src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,6 @@
66
<AssemblyName>Microsoft.PowerShell.CoreCLR.Eventing</AssemblyName>
77
</PropertyGroup>
88

9-
<PropertyGroup>
10-
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
11-
</PropertyGroup>
12-
13-
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
14-
<DebugType>portable</DebugType>
15-
</PropertyGroup>
16-
17-
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
18-
<DefineConstants>$(DefineConstants);UNIX</DefineConstants>
19-
</PropertyGroup>
20-
21-
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
22-
<DebugType>full</DebugType>
23-
</PropertyGroup>
24-
259
<ItemGroup>
2610
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
2711
<PackageReference Include="System.Security.Principal.Windows" Version="4.5.0-rc1-26423-06" />

src/Microsoft.PowerShell.LocalAccounts/Microsoft.PowerShell.LocalAccounts.csproj

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,4 @@
1111
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
1212
</ItemGroup>
1313

14-
<PropertyGroup>
15-
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
16-
</PropertyGroup>
17-
18-
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
19-
<DebugType>portable</DebugType>
20-
</PropertyGroup>
21-
22-
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
23-
<DefineConstants>$(DefineConstants);UNIX</DefineConstants>
24-
</PropertyGroup>
25-
26-
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
27-
<DebugType>full</DebugType>
28-
</PropertyGroup>
29-
3014
</Project>

src/Microsoft.PowerShell.PSReadLine/Microsoft.PowerShell.PSReadLine.csproj

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,4 @@
99
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
1010
</ItemGroup>
1111

12-
<PropertyGroup>
13-
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
14-
</PropertyGroup>
15-
16-
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
17-
<DebugType>portable</DebugType>
18-
</PropertyGroup>
19-
20-
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
21-
<DefineConstants>$(DefineConstants);UNIX</DefineConstants>
22-
</PropertyGroup>
23-
24-
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
25-
<DebugType>full</DebugType>
26-
</PropertyGroup>
27-
2812
</Project>

src/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.csproj

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,11 @@
1010
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
1111
</ItemGroup>
1212

13-
<PropertyGroup>
14-
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
15-
</PropertyGroup>
16-
1713
<ItemGroup>
1814
<Compile Remove="singleshell\installer\MshSecurityMshSnapin.cs" />
1915
<Compile Remove="gen\SecurityMshSnapinResources.cs" />
2016

2117
<EmbeddedResource Remove="resources\SecurityMshSnapinResources.resx" />
2218
</ItemGroup>
23-
24-
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
25-
<DebugType>portable</DebugType>
26-
</PropertyGroup>
27-
28-
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
29-
<DefineConstants>$(DefineConstants);UNIX</DefineConstants>
30-
</PropertyGroup>
31-
32-
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
33-
<DebugType>full</DebugType>
34-
</PropertyGroup>
35-
19+
3620
</Project>

0 commit comments

Comments
 (0)