Skip to content

Commit 9266c22

Browse files
committed
Add -LocalOmniSharp build flag
To build against project at `../csharp-language-server-protocol`.
1 parent 82c4924 commit 9266c22

File tree

5 files changed

+51
-17
lines changed

5 files changed

+51
-17
lines changed

PowerShellEditorServices.build.ps1

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,36 @@ param(
55
[ValidateSet("Debug", "Release")]
66
[string]$Configuration = "Debug",
77

8+
[switch]$LocalOmniSharp,
9+
810
[string]$PsesSubmodulePath = "$PSScriptRoot/module",
911

1012
[string]$ModulesJsonPath = "$PSScriptRoot/modules.json",
1113

1214
[string]$DefaultModuleRepository = "PSGallery",
1315

14-
[string[]]$VerbosityArgs = @("--verbosity", "quiet", "--nologo"),
16+
[string]$Verbosity = "quiet",
1517

1618
# See: https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests
1719
[string]$TestFilter = '',
1820

1921
# See: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test
20-
[string[]]$TestArgs = $VerbosityArgs + @("--logger", "console;verbosity=normal", "--logger", "trx")
22+
[string[]]$TestArgs = @("--logger", "console;verbosity=normal", "--logger", "trx")
2123
)
2224

2325
#Requires -Modules @{ModuleName="InvokeBuild"; ModuleVersion="5.0.0"}
2426
#Requires -Modules @{ModuleName="platyPS"; ModuleVersion="0.14.0"}
2527

26-
$script:dotnetTestArgs = @(
27-
"test"
28-
$TestArgs
28+
$script:dotnetBuildArgs = @(
29+
"--verbosity"
30+
$Verbosity
31+
"--nologo"
32+
"-c"
33+
$Configuration
34+
if ($LocalOmniSharp) { "-property:LocalOmniSharp=true" }
35+
)
36+
37+
$script:dotnetTestArgs = @("test") + $script:dotnetBuildArgs + $TestArgs + @(
2938
if ($TestFilter) { "--filter", $TestFilter }
3039
"--framework"
3140
)
@@ -79,7 +88,7 @@ Task BinClean {
7988
}
8089

8190
Task Clean FindDotNet, BinClean, {
82-
Exec { & dotnet clean $VerbosityArgs }
91+
Exec { & dotnet clean --verbosity $Verbosity }
8392
Get-ChildItem -Recurse $PSScriptRoot\src\*.nupkg | Remove-Item -Force -ErrorAction Ignore
8493
Get-ChildItem $PSScriptRoot\PowerShellEditorServices*.zip | Remove-Item -Force -ErrorAction Ignore
8594
Get-ChildItem $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US\*-help.xml | Remove-Item -Force -ErrorAction Ignore
@@ -161,15 +170,14 @@ Task SetupHelpForTests {
161170
}
162171

163172
Task Build FindDotNet, CreateBuildInfo, {
164-
Exec { & dotnet restore $VerbosityArgs }
165-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetRuntime.Standard }
166-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS7 }
173+
Exec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetRuntime.Standard }
174+
Exec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS7 }
167175
if (-not $script:IsNix) {
168-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.Desktop }
176+
Exec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.Desktop }
169177
}
170178

171179
# Build PowerShellEditorServices.VSCode module
172-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj -f $script:NetRuntime.Standard }
180+
Exec { & dotnet publish $script:dotnetBuildArgs .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj -f $script:NetRuntime.Standard }
173181
}
174182

175183
Task Test TestServer, TestE2E

src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<ProjectReference Include="..\PowerShellEditorServices\PowerShellEditorServices.csproj" PrivateAssets="all" />
2222
</ItemGroup>
2323

24-
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
24+
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
2525
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
2626

2727
<Compile Remove="Internal/PsesLoadContext.cs" />

src/PowerShellEditorServices/PowerShellEditorServices.csproj

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
3131
<!-- Manually pull in the updated version of Newtonsoft.Json. -->
3232
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
33-
<PackageReference Include="OmniSharp.Extensions.LanguageServer" Version="0.19.6" />
34-
<PackageReference Include="OmniSharp.Extensions.DebugAdapter.Server" Version="0.19.6" />
3533
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1" />
3634
<PackageReference Include="Serilog" Version="2.12.0" />
3735
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
@@ -42,6 +40,22 @@
4240
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
4341
</ItemGroup>
4442

43+
<Choose>
44+
<When Condition=" '$(LocalOmniSharp)' == 'true' ">
45+
<ItemGroup>
46+
<ProjectReference Include="..\..\..\csharp-language-server-protocol\src\Server\Server.csproj" />
47+
<ProjectReference Include="..\..\..\csharp-language-server-protocol\src\Dap.Server\Dap.Server.csproj" />
48+
</ItemGroup>
49+
</When>
50+
<Otherwise>
51+
<ItemGroup>
52+
<PackageReference Include="OmniSharp.Extensions.LanguageServer" Version="0.19.6" />
53+
<PackageReference Include="OmniSharp.Extensions.DebugAdapter.Server" Version="0.19.6" />
54+
</ItemGroup>
55+
</Otherwise>
56+
</Choose>
57+
58+
<!-- TODO: Remove these entirely. -->
4559
<ItemGroup>
4660
<Compile Remove="Extensions\Api\DocumentSymbolService.cs" />
4761
<Compile Remove="Services\Extension\Templating\**" />

test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,26 @@
1010
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
1212
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
13-
<PackageReference Include="OmniSharp.Extensions.LanguageClient" Version="0.19.6" />
14-
<PackageReference Include="OmniSharp.Extensions.DebugAdapter.Client" Version="0.19.6" />
1513
<PackageReference Include="xunit" Version="2.4.2" />
1614
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
1715
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
1816
</ItemGroup>
1917

18+
<Choose>
19+
<When Condition=" '$(LocalOmniSharp)' == 'true' ">
20+
<ItemGroup>
21+
<ProjectReference Include="..\..\..\csharp-language-server-protocol\src\Client\Client.csproj" />
22+
<ProjectReference Include="..\..\..\csharp-language-server-protocol\src\Dap.Client\Dap.client.csproj" />
23+
</ItemGroup>
24+
</When>
25+
<Otherwise>
26+
<ItemGroup>
27+
<PackageReference Include="OmniSharp.Extensions.LanguageClient" Version="0.19.6" />
28+
<PackageReference Include="OmniSharp.Extensions.DebugAdapter.Client" Version="0.19.6" />
29+
</ItemGroup>
30+
</Otherwise>
31+
</Choose>
32+
2033
<ItemGroup>
2134
<ProjectReference Include="..\..\src\PowerShellEditorServices\PowerShellEditorServices.csproj" />
2235
</ItemGroup>

test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<PackageReference Include="xunit" Version="2.4.2" />
3232
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
3333
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
34-
<PackageReference Include="OmniSharp.Extensions.LanguageServer" Version="0.19.6" />
3534
</ItemGroup>
3635

3736
<ItemGroup>

0 commit comments

Comments
 (0)