@@ -18,9 +18,9 @@ if ($PSVersionTable.PSEdition -ne "Core") {
18
18
Add-Type - Assembly System.IO.Compression.FileSystem
19
19
}
20
20
21
- task SetupDotNet - Before Restore , Clean , Build, TestHost, TestServer, TestProtocol, TestPowerShellApi, PackageNuGet {
21
+ task SetupDotNet - Before Clean , Build, TestHost, TestServer, TestProtocol, TestPowerShellApi, PackageNuGet {
22
22
23
- $requiredSdkVersion = " 1 .0.0"
23
+ $requiredSdkVersion = " 2 .0.0"
24
24
25
25
$dotnetPath = " $PSScriptRoot /.dotnet"
26
26
$dotnetExePath = if ($script :IsUnix ) { " $dotnetPath /dotnet" } else { " $dotnetPath /dotnet.exe" }
@@ -54,7 +54,7 @@ task SetupDotNet -Before Restore, Clean, Build, TestHost, TestServer, TestProtoc
54
54
55
55
# Download the official installation script and run it
56
56
$installScriptPath = " $ ( [System.IO.Path ]::GetTempPath()) dotnet-install.$installScriptExt "
57
- Invoke-WebRequest " https://raw.githubusercontent.com/dotnet/cli/rel/1 .0.0-rc3 /scripts/obtain/dotnet-install.$installScriptExt " - OutFile $installScriptPath
57
+ Invoke-WebRequest " https://raw.githubusercontent.com/dotnet/cli/v2 .0.0/scripts/obtain/dotnet-install.$installScriptExt " - OutFile $installScriptPath
58
58
$env: DOTNET_INSTALL_DIR = " $PSScriptRoot /.dotnet"
59
59
60
60
if (! $script :IsUnix ) {
@@ -81,19 +81,6 @@ task SetupDotNet -Before Restore, Clean, Build, TestHost, TestServer, TestProtoc
81
81
Write-Host " `n ### Using dotnet v$requiredSDKVersion at path $script :dotnetExe `n " - ForegroundColor Green
82
82
}
83
83
84
- function NeedsRestore ($rootPath ) {
85
- # This checks to see if the number of folders under a given
86
- # path (like "src" or "test") is greater than the number of
87
- # obj\project.assets.json files found under that path, implying
88
- # that those folders have not yet been restored.
89
- $projectAssets = (Get-ChildItem " $rootPath \*\obj\project.assets.json" )
90
- return ($projectAssets -eq $null ) -or ((Get-ChildItem $rootPath ).Length -gt $projectAssets.Length )
91
- }
92
-
93
- task Restore - If { " Restore" -in $BuildTask -or (NeedsRestore(" .\src" )) -or (NeedsRestore(" .\test" )) } - Before Clean , Build, Test {
94
- exec { & $script :dotnetExe restore }
95
- }
96
-
97
84
task Clean {
98
85
exec { & $script :dotnetExe clean }
99
86
Remove-Item $PSScriptRoot \module\PowerShellEditorServices\bin - Recurse - Force - ErrorAction Ignore
@@ -126,9 +113,6 @@ task GetProductVersion -Before PackageNuGet, PackageModule, UploadArtifacts {
126
113
}
127
114
128
115
function BuildForPowerShellVersion ($version ) {
129
- # Restore packages for the specified version
130
- exec { & $script :dotnetExe restore .\src\PowerShellEditorServices\PowerShellEditorServices.csproj / p:PowerShellVersion= $version }
131
-
132
116
Write-Host - ForegroundColor Green " `n ### Testing API usage for PowerShell $version ...`n "
133
117
exec { & $script :dotnetExe build -f net451 .\src\PowerShellEditorServices\PowerShellEditorServices.csproj / p:PowerShellVersion= $version }
134
118
}
@@ -168,15 +152,21 @@ function UploadTestLogs {
168
152
task Test TestServer, TestProtocol, TestHost
169
153
170
154
task TestServer - If { ! $script :IsUnix } {
171
- exec { & $script :dotnetExe test - c $Configuration -f net452 .\test\PowerShellEditorServices.Test\PowerShellEditorServices.Test.csproj }
155
+ Set-Location .\test\PowerShellEditorServices.Test\
156
+ exec { & $script :dotnetExe build - c $Configuration -f net452 }
157
+ exec { & $script :dotnetExe xunit - configuration $Configuration - framework net452 - verbose - nobuild }
172
158
}
173
159
174
160
task TestProtocol - If { ! $script :IsUnix } {
175
- exec { & $script :dotnetExe test - c $Configuration -f net452 .\test\PowerShellEditorServices.Test.Protocol\PowerShellEditorServices.Test.Protocol.csproj }
161
+ Set-Location .\test\PowerShellEditorServices.Test.Protocol\
162
+ exec { & $script :dotnetExe build - c $Configuration -f net452 }
163
+ exec { & $script :dotnetExe xunit - configuration $Configuration - framework net452 - verbose - nobuild }
176
164
}
177
165
178
166
task TestHost - If { ! $script :IsUnix } {
179
- exec { & $script :dotnetExe test - c $Configuration -f net452 .\test\PowerShellEditorServices.Test.Host\PowerShellEditorServices.Test.Host.csproj }
167
+ Set-Location .\test\PowerShellEditorServices.Test.Host\
168
+ exec { & $script :dotnetExe build - c $Configuration -f net452 }
169
+ exec { & $script :dotnetExe xunit - configuration $Configuration - framework net452 - verbose - nobuild - x86 }
180
170
}
181
171
182
172
task CITest (job Test - Safe), {
0 commit comments