Skip to content

Commit 655eb27

Browse files
Merge pull request #6264 from jasonmalinowski/consume-separate-language-servers-per-rid
2 parents 77c8b39 + 4ea6193 commit 655eb27

File tree

4 files changed

+54
-22
lines changed

4 files changed

+54
-22
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ VSIXs can be created using the gulp command `gulp vsix:release:package`. This w
4949

5050
To update the version of the roslyn server used by the extension do the following:
5151
1. Find the the Roslyn signed build you want from [here](https://dnceng.visualstudio.com/internal/_build?definitionId=327&_a=summary). Typically the latest successful build of main is fine.
52-
2. In the official build stage, look for the `Publish Assets` step. In there you will see it publishing the `Microsoft.CodeAnalysis.LanguageServer` package with some version, e.g. `4.6.0-3.23158.4`. Take note of that version number.
52+
2. In the official build stage, look for the `Publish Assets` step. In there you will see it publishing the `Microsoft.CodeAnalysis.LanguageServer.neutral` package with some version, e.g. `4.6.0-3.23158.4`. Take note of that version number.
5353
3. In the [package.json](package.json) inside the `defaults` section update the `roslyn` key to point to the version number you found above in step 2.
54-
4. Build and test the change (make sure to run `gulp installDependencies` to get the new version!). If everything looks good, submit a PR.
55-
* Adding new package versions might require authentication, run with the `--interactive` flag to login. You may need to install [azure artifacts nuget credential provider](https://github.com/microsoft/artifacts-credprovider#installation-on-windows) to run interactive authentication.
54+
4. Ensure that version of the package is in the proper feeds by running `gulp updateRoslynVersion`. Note: you may need to install the [Azure Artifacts NuGet Credential Provider](https://github.com/microsoft/artifacts-credprovider#installation-on-windows) to run interactive authentication.
55+
5. Build and test the change. If everything looks good, submit a PR.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838
},
3939
"defaults": {
40-
"roslyn": "4.8.0-2.23428.2",
40+
"roslyn": "4.8.0-3.23451.2",
4141
"omniSharp": "1.39.7",
4242
"razor": "7.0.0-preview.23423.3",
4343
"razorOmnisharp": "7.0.0-preview.23363.1"

server/ServerDownload.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</PropertyGroup>
2121

2222
<ItemGroup>
23-
<PackageDownload Include="Microsoft.CodeAnalysis.LanguageServer" version="[$(MicrosoftCodeAnalysisLanguageServerVersion)]" />
23+
<PackageDownload Include="$(PackageName)" version="[$(PackageVersion)]" />
2424
</ItemGroup>
2525

2626
</Project>

tasks/offlinePackagingTasks.ts

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,25 @@ gulp.task('installDependencies', async () => {
7373
}
7474
});
7575

76+
gulp.task(
77+
'updateRoslynVersion',
78+
// Run the fetch of all packages, and then also installDependencies after
79+
gulp.series(async () => {
80+
const packageJSON = getPackageJSON();
81+
82+
// Fetch the neutral package that we don't otherwise have in our platform list
83+
await acquireRoslyn(packageJSON, undefined, true);
84+
85+
// And now fetch each platform specific
86+
for (const p of platformSpecificPackages) {
87+
await acquireRoslyn(packageJSON, p.platformInfo, true);
88+
}
89+
}, 'installDependencies')
90+
);
91+
7692
// Install Tasks
7793
async function installRoslyn(packageJSON: any, platformInfo?: PlatformInformation) {
78-
const roslynVersion = packageJSON.defaults.roslyn;
79-
const packagePath = await acquireNugetPackage('Microsoft.CodeAnalysis.LanguageServer', roslynVersion);
80-
81-
// Find the matching server RID for the current platform.
82-
let serverPlatform: string;
83-
if (platformInfo === undefined) {
84-
serverPlatform = 'neutral';
85-
} else {
86-
serverPlatform = platformSpecificPackages.find(
87-
(p) =>
88-
p.platformInfo.platform === platformInfo.platform &&
89-
p.platformInfo.architecture === platformInfo.architecture
90-
)!.rid;
91-
}
94+
const { packagePath, serverPlatform } = await acquireRoslyn(packageJSON, platformInfo, false);
9295

9396
// Get the directory containing the server executable for the current platform.
9497
const serverExecutableDirectory = path.join(packagePath, 'content', 'LanguageServer', serverPlatform);
@@ -107,6 +110,33 @@ async function installRoslyn(packageJSON: any, platformInfo?: PlatformInformatio
107110
}
108111
}
109112

113+
async function acquireRoslyn(
114+
packageJSON: any,
115+
platformInfo: PlatformInformation | undefined,
116+
interactive: boolean
117+
): Promise<{ packagePath: string; serverPlatform: string }> {
118+
const roslynVersion = packageJSON.defaults.roslyn;
119+
120+
// Find the matching server RID for the current platform.
121+
let serverPlatform: string;
122+
if (platformInfo === undefined) {
123+
serverPlatform = 'neutral';
124+
} else {
125+
serverPlatform = platformSpecificPackages.find(
126+
(p) =>
127+
p.platformInfo.platform === platformInfo.platform &&
128+
p.platformInfo.architecture === platformInfo.architecture
129+
)!.rid;
130+
}
131+
132+
const packagePath = await acquireNugetPackage(
133+
`Microsoft.CodeAnalysis.LanguageServer.${serverPlatform}`,
134+
roslynVersion,
135+
interactive
136+
);
137+
return { packagePath, serverPlatform };
138+
}
139+
110140
async function installRazor(packageJSON: any, platformInfo: PlatformInformation) {
111141
return await installPackageJsonDependency('Razor', packageJSON, platformInfo);
112142
}
@@ -138,7 +168,7 @@ async function installPackageJsonDependency(
138168
}
139169
}
140170

141-
async function acquireNugetPackage(packageName: string, packageVersion: string): Promise<string> {
171+
async function acquireNugetPackage(packageName: string, packageVersion: string, interactive: boolean): Promise<string> {
142172
packageName = packageName.toLocaleLowerCase();
143173
const packageOutputPath = path.join(nugetTempPath, packageName, packageVersion);
144174
if (fs.existsSync(packageOutputPath)) {
@@ -150,9 +180,11 @@ async function acquireNugetPackage(packageName: string, packageVersion: string):
150180
const dotnetArgs = [
151181
'restore',
152182
path.join(rootPath, 'server'),
153-
`/p:MicrosoftCodeAnalysisLanguageServerVersion=${packageVersion}`,
183+
`/p:PackageName=${packageName}`,
184+
`/p:PackageVersion=${packageVersion}`,
154185
];
155-
if (argv.interactive) {
186+
187+
if (interactive) {
156188
dotnetArgs.push('--interactive');
157189
}
158190

0 commit comments

Comments
 (0)