-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
Copy pathMicrosoft.CodeAnalysis.LanguageServer.csproj
134 lines (114 loc) · 8.47 KB
/
Microsoft.CodeAnalysis.LanguageServer.csproj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ServerGarbageCollection>true</ServerGarbageCollection>
<!--
Build a nuget package for this project. This is not consumed as a standard NuGet package; it just contains
the server executables that we need to ship inside the extension vsix. The extension will download this and extract the
executables when it builds. NuGet just happens to be a convenient way to share build artifacts.
-->
<IsPackable>true</IsPackable>
<!--
Publish all the platform specific executables before any of the pack related targets run.
This is important to ensure that the content files exist on the project before nuget looks for them.
Note that BeforeTargets="Pack" is not enough, as the determination of what to include in the package runs
before the actual "Pack" target runs.
-->
<BeforePack>PublishAllRids;$(BeforePack)</BeforePack>
<!-- Since this is not a standard nuget package and is only consumed by the extension build, we don't care if the folder structure doesn't match what nuget expects. -->
<NoWarn>NU5100</NoWarn>
<!-- Publishing settings -->
<SelfContained>false</SelfContained>
<PublishDir Condition="'$(RuntimeIdentifier)' != ''">$(ArtifactsDir)/LanguageServer/$(Configuration)/$(TargetFramework)/$(RuntimeIdentifier)</PublishDir>
<PublishDir Condition="'$(RuntimeIdentifier)' == ''">$(ArtifactsDir)/LanguageServer/$(Configuration)/$(TargetFramework)/neutral</PublishDir>
<!--
Set the minimum runtime to a .NET 7 prerelease so that prerelease SDKs will be considered during rollForward.
RollForward values for roslyn are set in eng/config/runtimeconfig.template.json
-->
<RuntimeFrameworkVersion>7.0.0-preview.7.22362.8</RuntimeFrameworkVersion>
<!-- List of runtime identifiers that we want to publish an executable for -->
<RuntimeIdentifiers>win-x64;win-x86;win-arm64;linux-x64;linux-arm64;alpine-x64;alpine-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
<!-- Publish ready to run executables when we're publishing platform specific executables. -->
<PublishReadyToRun Condition="'$(RuntimeIdentifier)' != '' Or '$(RestoreWithR2R)' == 'true'">true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\Workspaces\Core\MSBuild\Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj" />
<ProjectReference Include="..\..\..\Workspaces\Remote\Core\Microsoft.CodeAnalysis.Remote.Workspaces.csproj" />
<ProjectReference Include="..\Protocol\Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj" />
<!-- Dlls we don't directly reference but need to include to build the MEF composition -->
<ProjectReference Include="..\..\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Features.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build" Version="$(RefOnlyMicrosoftBuildVersion)" ExcludeAssets="Runtime" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Locator" Version="$(MicrosoftBuildLocatorVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsoleVersion)" />
<PackageReference Include="Microsoft.ServiceHub.Framework" Version="$(MicrosoftServiceHubFrameworkVersion)" />
<PackageReference Include="Microsoft.TestPlatform.TranslationLayer" Version="$(MicrosoftTestPlatformTranslationLayerVersion)" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="$(MicrosoftTestPlatformObjectModelVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="$(MicrosoftVisualStudioCompositionVersion)" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="$(MicrosoftVisualStudioLanguageServerProtocolVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace" Version="$(MicrosoftAspNetCoreRazorExternalAccessRoslynWorkspaceVersion)" />
<PackageReference Include="NuGet.Frameworks" Version="$(NuGetFrameworksVersion)" />
<PackageReference Include="StreamJsonRpc" Version="$(StreamJsonRpcVersion)" />
<PackageReference Include="System.CommandLine" Version="$(SystemCommandLineVersion)" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.LanguageServer.UnitTests" />
<!--
Only allow C# DevKit to use types from Microsoft.CodeAnalysis.Contracts namespace. The contracts should not introduce breaking changes between versions,
because the versions of C# DevKit and C# Extension might not be aligned.
-->
<RestrictedInternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.DevKit" Namespace="Microsoft.CodeAnalysis.Contracts" />
</ItemGroup>
<ItemGroup>
<RoslynVersionFile Include="$(OutDir)\RoslynVersion.txt" />
<FileWrites Include="@(RoslynVersionFile)" />
</ItemGroup>
<Target Name="WriteRoslynVersion" AfterTargets="Build">
<WriteLinesToFile File="@(RoslynVersionFile)" Lines="$(MicrosoftCodeAnalysisVersion)" Overwrite="true" />
</Target>
<Target Name="PublishRoslynVersion" AfterTargets="Publish">
<Copy SourceFiles="@(RoslynVersionFile)" DestinationFolder="$(PublishDir)" />
</Target>
<!--
This target runs publishing for all of the RIDs that we've specified in the project to create platform specific
executables. It then updates the Content in the project to include the executables we built in the NuGet package.
This is also partially a workaround for lack of support for publishing multiple RIDs directly in a csproj. See https://github.com/dotnet/sdk/issues/9363
Notes:
1. We depend on the "Publish" target to ensure that we include the platform neutral versions of the project.
2. It is important that the Content is added dynamically in this target. If we had it in a normal ItemGroup in the
project, when msbuild evaluation runs the published server artifacts won't exist and so the content will be empty.
-->
<Target Name="PublishAllRids" DependsOnTargets="Publish">
<Message Text="Publishing builds for each runtime identifier..." Importance="High" />
<ItemGroup>
<!-- Transform RuntimeIdentifiers property to item -->
<RuntimeIdentifierForPublish Include="$(RuntimeIdentifiers)" />
<!-- Transform RuntimeIdentifierForPublish items to project items to pass to MSBuild task -->
<ProjectToPublish Include="@(RuntimeIdentifierForPublish->'$(MSBuildProjectFullPath)')">
<AdditionalProperties>RuntimeIdentifier=%(RuntimeIdentifierForPublish.Identity)</AdditionalProperties>
</ProjectToPublish>
</ItemGroup>
<!--
We have to run restore first with the PublishReadyToRun flag set to true to ensure that the correct crossgen packages get restored.
See https://github.com/dotnet/sdk/issues/20701
-->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Restore" Properties="RestoreWithR2R=true" />
<MSBuild Projects="@(ProjectToPublish)" Targets="Publish" BuildInParallel="true" />
<!-- We have to add the content files in a target (and not just defined in a normal item group) since they are produced by the prior step and won't exist at evaluation time. -->
<Message Text="Adding content files for language server artifacts..." Importance="High" />
<ItemGroup>
<Content Include="$(ArtifactsDir)/LanguageServer/$(Configuration)/$(TargetFramework)/**/*.*">
<Pack>true</Pack>
<PackagePath>content\LanguageServer</PackagePath>
<CopyToOutput>false</CopyToOutput>
<BuildAction>None</BuildAction>
</Content>
</ItemGroup>
</Target>
</Project>