5
5
6
6
# Requires -Modules @ {ModuleName = " InvokeBuild" ;ModuleVersion = " 3.2.1" }
7
7
8
- # AppVeyor causes trouble with the build platform, fix that
9
- # by setting the environment variable that MSBuild picks up
10
- $script :BuildPlatform = " Any CPU"
11
8
if ($env: APPVEYOR -ne $null ) {
12
- # $env:Platform = "AnyCPU"
9
+ dotnet -- info
13
10
}
14
11
15
12
task SetupDotNet - Before Clean , Build, BuildHost, Test, TestPowerShellApi {
@@ -64,23 +61,30 @@ task SetupDotNet -Before Clean, Build, BuildHost, Test, TestPowerShellApi {
64
61
Write-Host " `n ### Using dotnet at path $script :dotnetExe `n " - ForegroundColor Green
65
62
}
66
63
64
+ task Restore {
65
+ exec { & dotnet restore - v:m .\PowerShellEditorServices.sln }
66
+ }
67
+
67
68
task Clean {
68
- # exec { & dotnet clean .\PowerShellEditorServices.sln -- /p:Platform="$script:BuildPlatform" }
69
- exec { & dotnet clean - v:diag .\src\PowerShellEditorServices\PowerShellEditorServices.csproj }
69
+ exec { & dotnet clean .\PowerShellEditorServices.sln }
70
70
}
71
71
72
72
function BuildForPowerShellVersion ($version ) {
73
- exec { & dotnet restore .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -- / p:PowerShellVersion= $version / p:Platform= " $script :BuildPlatform " }
73
+ # Restore packages for the specified version
74
+ exec { & dotnet restore .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -- / p:PowerShellVersion= $version }
74
75
75
76
Write-Host - ForegroundColor Green " `n ### Testing API usage for PowerShell $version ...`n "
76
- exec { & dotnet build -f net451 .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -- / p:PowerShellVersion= $version / p:Platform = " $ script :BuildPlatform " }
77
+ exec { & dotnet build -f net451 .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -- / p:PowerShellVersion= $version }
77
78
}
78
79
79
80
task TestPowerShellApi {
80
81
BuildForPowerShellVersion v3
81
82
BuildForPowerShellVersion v4
82
83
BuildForPowerShellVersion v5r1
83
84
BuildForPowerShellVersion v5r2
85
+
86
+ # Do a final restore to put everything back to normal
87
+ exec { & dotnet restore .\src\PowerShellEditorServices\PowerShellEditorServices.csproj }
84
88
}
85
89
86
90
task BuildHost {
@@ -89,8 +93,7 @@ task BuildHost {
89
93
}
90
94
91
95
task Build {
92
- exec { & dotnet restore - v:m .\PowerShellEditorServices.sln -- / p:Platform= " $script :BuildPlatform " }
93
- exec { & dotnet build - c $Configuration .\PowerShellEditorServices.sln -- / p:Platform= " $script :BuildPlatform " }
96
+ exec { & dotnet build - c $Configuration .\PowerShellEditorServices.sln }
94
97
}
95
98
96
99
task Test {
@@ -99,9 +102,9 @@ task Test {
99
102
$testParams = @ {" l" = " appveyor" }
100
103
}
101
104
102
- exec { & dotnet test - c $Configuration @testParams .\test\PowerShellEditorServices.Test\PowerShellEditorServices.Test.csproj -- / p:Platform = " $ script :BuildPlatform " }
103
- exec { & dotnet test - c $Configuration @testParams .\test\PowerShellEditorServices.Test.Protocol\PowerShellEditorServices.Test.Protocol.csproj -- / p:Platform = " $ script :BuildPlatform " }
104
- exec { & dotnet test - c $Configuration @testParams .\test\PowerShellEditorServices.Test.Host\PowerShellEditorServices.Test.Host.csproj -- / p:Platform = " $ script :BuildPlatform " }
105
+ exec { & dotnet test - c $Configuration @testParams .\test\PowerShellEditorServices.Test\PowerShellEditorServices.Test.csproj }
106
+ exec { & dotnet test - c $Configuration @testParams .\test\PowerShellEditorServices.Test.Protocol\PowerShellEditorServices.Test.Protocol.csproj }
107
+ exec { & dotnet test - c $Configuration @testParams .\test\PowerShellEditorServices.Test.Host\PowerShellEditorServices.Test.Host.csproj }
105
108
}
106
109
107
110
task LayoutModule - After Build, BuildHost {
@@ -114,4 +117,5 @@ task LayoutModule -After Build, BuildHost {
114
117
Copy-Item - Force - Path $PSScriptRoot \src\PowerShellEditorServices.Host\bin\$Configuration \netstandard1.6 \* - Filter Microsoft.PowerShell.EditorServices* .dll - Destination $PSScriptRoot \module\PowerShellEditorServices\bin\Core\
115
118
}
116
119
117
- task . Clean , Build, Test, TestPowerShellApi
120
+ # The default task is to run the entire CI build
121
+ task . Restore, Clean , Build, Test, TestPowerShellApi
0 commit comments