Skip to content

Commit c485f58

Browse files
committed
Changes to break up coreclr build into PS6 and PS7
Since there are language changes in ps7, it seemed reasonable that distinct rules would be created to support these, which are not going to be in ps6
1 parent f389aa4 commit c485f58

File tree

8 files changed

+114
-52
lines changed

8 files changed

+114
-52
lines changed

Engine/Engine.csproj

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<VersionPrefix>1.18.3</VersionPrefix>
5-
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
4+
<VersionPrefix>1.18.4</VersionPrefix>
5+
<TargetFrameworks>netcoreapp3.1;netstandard2.0;net452</TargetFrameworks>
66
<AssemblyName>Microsoft.Windows.PowerShell.ScriptAnalyzer</AssemblyName>
77
<PackageId>Engine</PackageId>
88
<RootNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</RootNamespace> <!-- Namespace needs to match Assembly name for ressource binding -->
@@ -61,7 +61,29 @@
6161
</EmbeddedResource>
6262
</ItemGroup>
6363

64-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
64+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' AND '$(Configuration)' == 'PSV7Debug'">
65+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.0.0-rc.3" />
66+
</ItemGroup>
67+
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' AND '$(Configuration)' == 'PSV7Debug'">
68+
<DefineConstants>$(DefineConstants);PSV7;CORECLR</DefineConstants>
69+
</PropertyGroup>
70+
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' AND '$(Configuration)' == 'PSV6Debug'">
71+
<DefineConstants>$(DefineConstants);PSV6;CORECLR</DefineConstants>
72+
</PropertyGroup>
73+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' AND '$(Configuration)' == 'PSV6Debug'">
74+
<PackageReference Include="System.Management.Automation" Version="6.1.0" />
75+
</ItemGroup>
76+
77+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' AND '$(Configuration)' == 'PSV7Release'">
78+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.0.0-rc.3" />
79+
</ItemGroup>
80+
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' AND '$(Configuration)' == 'PSV7Release'">
81+
<DefineConstants>$(DefineConstants);PSV7;CORECLR</DefineConstants>
82+
</PropertyGroup>
83+
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' AND '$(Configuration)' == 'PSV6Release'">
84+
<DefineConstants>$(DefineConstants);PSV6;CORECLR</DefineConstants>
85+
</PropertyGroup>
86+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' AND '$(Configuration)' == 'PSV6Release'">
6587
<PackageReference Include="System.Management.Automation" Version="6.1.0" />
6688
</ItemGroup>
6789

Engine/PSScriptAnalyzer.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Author = 'Microsoft Corporation'
1111
RootModule = 'PSScriptAnalyzer.psm1'
1212

1313
# Version number of this module.
14-
ModuleVersion = '1.18.3'
14+
ModuleVersion = '1.18.4'
1515

1616
# ID used to uniquely identify this module
1717
GUID = 'd6245802-193d-4068-a631-8863a4342a18'

Engine/PSScriptAnalyzer.psm1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ $PSModuleRoot = $PSModule.ModuleBase
1111
$binaryModuleRoot = $PSModuleRoot
1212

1313

14-
if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -ne 'Desktop')) {
15-
$binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'coreclr'
14+
# if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -ne 'Desktop')) {
15+
if ($PSVersionTable.PSVersion.Major -eq 7 ) {
16+
$binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath "PSv$($PSVersionTable.PSVersion.Major)"
17+
}
18+
elseif ($PSVersionTable.PSVersion.Major -eq 6 ) {
19+
$binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath "PSv$($PSVersionTable.PSVersion.Major)"
1620
# Minimum PowerShell Core version given by PowerShell Core support itself and
1721
# also the version of NewtonSoft.Json implicitly that PSSA ships with,
1822
# which cannot be higher than the one that PowerShell ships with.

Rules/Rules.csproj

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<VersionPrefix>1.18.3</VersionPrefix>
5-
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
4+
<VersionPrefix>1.18.4</VersionPrefix>
5+
<TargetFrameworks>netcoreapp3.1;netstandard2.0;net452</TargetFrameworks>
66
<AssemblyName>Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules</AssemblyName>
77
<PackageId>Rules</PackageId>
88
<RootNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</RootNamespace> <!-- Namespace needs to match Assembly name for ressource binding -->
99
</PropertyGroup>
1010

1111
<ItemGroup>
1212
<ProjectReference Include="..\Engine\Engine.csproj" />
13-
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
14-
<PackageReference Include="Microsoft.Management.Infrastructure" Version="1.0.0" />
13+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
14+
<PackageReference Include="Microsoft.Management.Infrastructure" Version="2.0.0" />
1515
</ItemGroup>
1616

1717
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
@@ -42,7 +42,7 @@
4242
</EmbeddedResource>
4343
</ItemGroup>
4444

45-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
45+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netcoreapp3.1'">
4646
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.5.1" />
4747
<Compile Remove="UseSingularNouns.cs" />
4848
</ItemGroup>
@@ -67,4 +67,30 @@
6767
<DefineConstants>$(DefineConstants);PSV3;PSV4</DefineConstants>
6868
</PropertyGroup>
6969

70+
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' AND '$(Configuration)' == 'PSV7Release'">
71+
<DefineConstants>$(DefineConstants);PSV7;CORECLR</DefineConstants>
72+
</PropertyGroup>
73+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' AND '$(Configuration)' == 'PSV7Release'">
74+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.0.0-rc.3" />
75+
</ItemGroup>
76+
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' AND '$(Configuration)' == 'PSV6Release'">
77+
<DefineConstants>$(DefineConstants);PSV6;CORECLR</DefineConstants>
78+
</PropertyGroup>
79+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' AND '$(Configuration)' == 'PSV6Release'">
80+
<PackageReference Include="System.Management.Automation" Version="6.1.0" />
81+
</ItemGroup>
82+
83+
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' AND '$(Configuration)' == 'PSV7Debug'">
84+
<DefineConstants>$(DefineConstants);PSV7;CORECLR</DefineConstants>
85+
</PropertyGroup>
86+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' AND '$(Configuration)' == 'PSV7Debug'">
87+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.0.0-rc.3" />
88+
</ItemGroup>
89+
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' AND '$(Configuration)' == 'PSV6Debug'">
90+
<DefineConstants>$(DefineConstants);PSV6;CORECLR</DefineConstants>
91+
</PropertyGroup>
92+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' AND '$(Configuration)' == 'PSV6Debug'">
93+
<PackageReference Include="System.Management.Automation" Version="6.1.0" />
94+
</ItemGroup>
95+
7096
</Project>

build.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ param(
3737
[switch] $Bootstrap
3838
)
3939
BEGIN {
40-
if ($PSVersion -gt 6) {
41-
# due to netstandard2.0 we do not need to treat PS version 7 differently
42-
$PSVersion = 6
43-
}
40+
#if ($PSVersion -gt 6) {
41+
# # due to netstandard2.0 we do not need to treat PS version 7 differently
42+
# $PSVersion = 6
43+
#}
4444
}
4545

4646
END {

build.psm1

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ function Start-ScriptAnalyzerBuild
144144
param (
145145
[switch]$All,
146146

147-
# Note that 6 should also be chosen for PowerShell7 as both implement netstandard2.0
148-
# and we do not use features from netstandard2.1
149-
[ValidateRange(3, 6)]
147+
[ValidateRange(3, 7)]
150148
[int]$PSVersion = $PSVersionTable.PSVersion.Major,
151149

152150
[ValidateSet("Debug", "Release")]
@@ -178,7 +176,7 @@ function Start-ScriptAnalyzerBuild
178176
if ( $All )
179177
{
180178
# Build all the versions of the analyzer
181-
foreach($psVersion in 3..6) {
179+
foreach($psVersion in 3..7) {
182180
Start-ScriptAnalyzerBuild -Configuration $Configuration -PSVersion $psVersion
183181
}
184182
return
@@ -191,15 +189,18 @@ function Start-ScriptAnalyzerBuild
191189
Set-Variable -Name profilesCopied -Value $true -Scope 1
192190
}
193191

194-
if ($PSVersion -ge 6) {
192+
if ($PSVersion -eq 7) {
193+
$framework = 'netcoreapp3.1'
194+
}
195+
elseif ($PSVersion -eq 6) {
195196
$framework = 'netstandard2.0'
196197
}
197198
else {
198199
$framework = "net452"
199200
}
200201

201202
# build the appropriate assembly
202-
if ($PSVersion -match "[34]" -and $Framework -eq "core")
203+
if ($PSVersion -match "[34]" -and $Framework -ne "net452")
203204
{
204205
throw ("ScriptAnalyzer for PS version '{0}' is not applicable to {1} framework" -f $PSVersion,$Framework)
205206
}
@@ -231,7 +232,11 @@ function Start-ScriptAnalyzerBuild
231232
}
232233
6
233234
{
234-
$destinationDirBinaries = "$script:destinationDir\coreclr"
235+
$destinationDirBinaries = "$script:destinationDir\PSv6"
236+
}
237+
7
238+
{
239+
$destinationDirBinaries = "$script:destinationDir\PSv7"
235240
}
236241
default
237242
{
@@ -240,7 +245,7 @@ function Start-ScriptAnalyzerBuild
240245
}
241246

242247
$buildConfiguration = $Configuration
243-
if ((3, 4) -contains $PSVersion) {
248+
if ((3, 4, 6, 7) -contains $PSVersion) {
244249
$buildConfiguration = "PSV${PSVersion}${Configuration}"
245250
}
246251

tools/releaseBuild/FileCatalogSigning.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<SignConfigXML>
33
<!-- ****Begin**** BothDual - Dual (Sha256 and Sha1) AuthenticodeDual) and should be StrongName, but we will add this in 6.1.0 ******** -->
44
<job platform="" configuration="" dest="__OUTPATHROOT__\signed" jobname="PowerShell Script Analyzer File Catalog" approvers="vigarg;gstolt">
5-
<file src="__INPATHROOT__\PSScriptAnalyzer\1.18.3\PSScriptAnalyzer.cat" signType="Authenticode" dest="__OUTPATHROOT__\PSScriptAnalyzer\1.18.3\PSScriptAnalyzer.cat" />
5+
<file src="__INPATHROOT__\PSScriptAnalyzer\1.18.4\PSScriptAnalyzer.cat" signType="Authenticode" dest="__OUTPATHROOT__\PSScriptAnalyzer\1.18.4\PSScriptAnalyzer.cat" />
66
</job>
77
<!-- <job platform="" configuration="" dest="__OUTPATHROOT__\signed" jobname="PowerShell Compatibility Analyzer File Catalog" approvers="vigarg;gstolt">
88
<file src="__INPATHROOT__\PSCompatibilityCollector\PSCompatibilityCollector.cat" signType="Authenticode" dest="__OUTPATHROOT__\PSCompatibilityCollector\PSCompatibilityAnalzyer.cat" />

0 commit comments

Comments
 (0)