19
19
[ValidateSet (" Debug" , " Release" )]
20
20
[string ]$Configuration = (property Configuration Release),
21
21
22
- [ValidateSet (" net462 " , " net6.0" )]
23
- [string ]$Framework ,
22
+ [ValidateSet (" net472 " , " net6.0" )]
23
+ [string ]$TestFramework ,
24
24
25
25
[switch ]$CheckHelpContent
26
26
)
@@ -30,71 +30,58 @@ Import-Module "$PSScriptRoot/tools/helper.psm1"
30
30
# Final bits to release go here
31
31
$targetDir = " bin/$Configuration /PSReadLine"
32
32
33
- if (-not $Framework )
34
- {
35
- $Framework = if ($PSVersionTable.PSEdition -eq " Core" ) { " net6.0" } else { " net462" }
33
+ if (-not $TestFramework ) {
34
+ $TestFramework = $IsWindows ? " net472" : " net6.0"
36
35
}
37
36
38
- Write-Verbose " Building for '$Framework '" - Verbose
39
-
40
37
function ConvertTo-CRLF ([string ] $text ) {
41
38
$text.Replace (" `r`n " , " `n " ).Replace(" `n " , " `r`n " )
42
39
}
43
40
44
41
$polyFillerParams = @ {
45
42
Inputs = { Get-ChildItem Polyfill/* .cs, Polyfill/ Polyfill.csproj }
46
- Outputs = " Polyfill/bin/$Configuration /$Framework /Microsoft.PowerShell.PSReadLine.Polyfiller.dll"
43
+ Outputs = " Polyfill/bin/$Configuration /netstandard2.0 /Microsoft.PowerShell.PSReadLine.Polyfiller.dll"
47
44
}
48
45
49
46
$binaryModuleParams = @ {
50
47
Inputs = { Get-ChildItem PSReadLine/* .cs, PSReadLine/ PSReadLine.csproj, PSReadLine/ PSReadLineResources.resx, Polyfill/* .cs, Polyfill/ Polyfill.csproj }
51
- Outputs = " PSReadLine/bin/$Configuration /$Framework /Microsoft.PowerShell.PSReadLine2 .dll"
48
+ Outputs = " PSReadLine/bin/$Configuration /netstandard2.0 /Microsoft.PowerShell.PSReadLine .dll"
52
49
}
53
50
54
51
$xUnitTestParams = @ {
55
52
Inputs = { Get-ChildItem test/* .cs, test/* .json, test/ PSReadLine.Tests.csproj }
56
- Outputs = " test/bin/$Configuration /$Framework /PSReadLine.Tests.dll"
57
- }
58
-
59
- $mockPSConsoleParams = @ {
60
- Inputs = { Get-ChildItem MockPSConsole/* .cs, MockPSConsole/ Program.manifest, MockPSConsole/ MockPSConsole.csproj }
61
- Outputs = " MockPSConsole/bin/$Configuration /$Framework /MockPSConsole.dll"
53
+ Outputs = " test/bin/$Configuration /$TestFramework /PSReadLine.Tests.dll"
62
54
}
63
55
64
56
<#
65
57
Synopsis: Build the Polyfiller assembly
66
58
#>
67
- task BuildPolyfiller @polyFillerParams - If ($Framework -eq " net462" ) {
68
- # # Build both "net462" and "net6.0"
69
- exec { dotnet publish -f " net462" - c $Configuration Polyfill }
70
- exec { dotnet publish -f " net6.0" - c $Configuration Polyfill }
59
+ task BuildPolyfiller @polyFillerParams {
60
+ exec { dotnet publish - c $Configuration -f ' netstandard2.0' Polyfill }
61
+ exec { dotnet publish - c $Configuration -f ' net6.0' Polyfill }
71
62
}
72
63
73
64
<#
74
65
Synopsis: Build main binary module
75
66
#>
76
67
task BuildMainModule @binaryModuleParams {
77
- exec { dotnet publish -f $Framework - c $Configuration PSReadLine }
68
+ exec { dotnet publish - c $Configuration PSReadLine\PSReadLine.csproj }
78
69
}
79
70
80
71
<#
81
72
Synopsis: Build xUnit tests
82
73
#>
83
74
task BuildXUnitTests @xUnitTestParams {
84
- exec { dotnet publish -f $Framework - c $Configuration test }
85
- }
86
-
87
- <#
88
- Synopsis: Build the mock powershell console.
89
- #>
90
- task BuildMockPSConsole @mockPSConsoleParams {
91
- exec { dotnet publish -f $Framework - c $Configuration MockPSConsole }
75
+ exec { dotnet publish -f $TestFramework - c $Configuration test }
92
76
}
93
77
94
78
<#
95
79
Synopsis: Run the unit tests
96
80
#>
97
- task RunTests BuildMainModule, BuildXUnitTests, { Start-TestRun - Configuration $Configuration - Framework $Framework }
81
+ task RunTests BuildMainModule, BuildXUnitTests, {
82
+ Write-Verbose " Run tests targeting '$TestFramework ' ..."
83
+ Start-TestRun - Configuration $Configuration - Framework $TestFramework
84
+ }
98
85
99
86
<#
100
87
Synopsis: Check if the help content is in sync.
@@ -128,35 +115,27 @@ task LayoutModule BuildPolyfiller, BuildMainModule, {
128
115
Set-Content - Path (Join-Path $targetDir (Split-Path $file - Leaf)) - Value (ConvertTo-CRLF $content ) - Force
129
116
}
130
117
131
- if ($Framework -eq " net462" ) {
132
- if (-not (Test-Path " $targetDir /net462" )) {
133
- New-Item " $targetDir /net462" - ItemType Directory - Force > $null
134
- }
135
- if (-not (Test-Path " $targetDir /net6plus" )) {
136
- New-Item " $targetDir /net6plus" - ItemType Directory - Force > $null
137
- }
138
-
139
- Copy-Item " Polyfill/bin/$Configuration /net462/Microsoft.PowerShell.PSReadLine.Polyfiller.dll" " $targetDir /net462" - Force
140
- Copy-Item " Polyfill/bin/$Configuration /net6.0/Microsoft.PowerShell.PSReadLine.Polyfiller.dll" " $targetDir /net6plus" - Force
118
+ if (-not (Test-Path " $targetDir /netstd" )) {
119
+ New-Item " $targetDir /netstd" - ItemType Directory - Force > $null
120
+ }
121
+ if (-not (Test-Path " $targetDir /net6plus" )) {
122
+ New-Item " $targetDir /net6plus" - ItemType Directory - Force > $null
141
123
}
142
124
143
- $binPath = " PSReadLine/bin/$Configuration /$Framework /publish"
144
- Copy-Item $binPath / Microsoft.PowerShell.PSReadLine2.dll $targetDir
125
+ Copy-Item " Polyfill/bin/$Configuration /netstandard2.0/Microsoft.PowerShell.PSReadLine.Polyfiller.dll" " $targetDir /netstd" - Force
126
+ Copy-Item " Polyfill/bin/$Configuration /net6.0/Microsoft.PowerShell.PSReadLine.Polyfiller.dll" " $targetDir /net6plus" - Force
127
+
128
+ $binPath = " PSReadLine/bin/$Configuration /netstandard2.0/publish"
129
+ Copy-Item $binPath / Microsoft.PowerShell.PSReadLine.dll $targetDir
145
130
Copy-Item $binPath / Microsoft.PowerShell.Pager.dll $targetDir
146
131
147
132
if ($Configuration -eq ' Debug' ) {
148
133
Copy-Item $binPath /* .pdb $targetDir
149
134
}
150
135
151
- if (Test-Path $binPath / System.Runtime.InteropServices.RuntimeInformation.dll) {
152
- Copy-Item $binPath / System.Runtime.InteropServices.RuntimeInformation.dll $targetDir
153
- } else {
154
- Write-Warning " Build using $Framework is not sufficient to be downlevel compatible"
155
- }
156
-
157
136
# Copy module manifest, but fix the version to match what we've specified in the binary module.
158
137
$moduleManifestContent = ConvertTo-CRLF (Get-Content - Path ' PSReadLine/PSReadLine.psd1' - Raw)
159
- $versionInfo = (Get-ChildItem - Path $targetDir / Microsoft.PowerShell.PSReadLine2 .dll).VersionInfo
138
+ $versionInfo = (Get-ChildItem - Path $targetDir / Microsoft.PowerShell.PSReadLine .dll).VersionInfo
160
139
$version = $versionInfo.FileVersion
161
140
$semVer = $versionInfo.ProductVersion
162
141
0 commit comments