Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consume per-runtime language servers #6264

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ VSIXs can be created using the gulp command `gulp vsix:release:package`. This w

To update the version of the roslyn server used by the extension do the following:
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.
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.
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.
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.
4. Build and test the change (make sure to run `gulp installDependencies` to get the new version!). If everything looks good, submit a PR.
* 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.
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.
5. Build and test the change. If everything looks good, submit a PR.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}
},
"defaults": {
"roslyn": "4.8.0-2.23428.2",
"roslyn": "4.8.0-3.23451.2",
"omniSharp": "1.39.7",
"razor": "7.0.0-preview.23423.3",
"razorOmnisharp": "7.0.0-preview.23363.1"
Expand Down
2 changes: 1 addition & 1 deletion server/ServerDownload.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageDownload Include="Microsoft.CodeAnalysis.LanguageServer" version="[$(MicrosoftCodeAnalysisLanguageServerVersion)]" />
<PackageDownload Include="$(PackageName)" version="[$(PackageVersion)]" />
</ItemGroup>

</Project>
66 changes: 49 additions & 17 deletions tasks/offlinePackagingTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,25 @@ gulp.task('installDependencies', async () => {
}
});

gulp.task(
'updateRoslynVersion',
// Run the fetch of all packages, and then also installDependencies after
gulp.series(async () => {
const packageJSON = getPackageJSON();

// Fetch the neutral package that we don't otherwise have in our platform list
await acquireRoslyn(packageJSON, undefined, true);

// And now fetch each platform specific
for (const p of platformSpecificPackages) {
await acquireRoslyn(packageJSON, p.platformInfo, true);
}
}, 'installDependencies')
);

// Install Tasks
async function installRoslyn(packageJSON: any, platformInfo?: PlatformInformation) {
const roslynVersion = packageJSON.defaults.roslyn;
const packagePath = await acquireNugetPackage('Microsoft.CodeAnalysis.LanguageServer', roslynVersion);

// Find the matching server RID for the current platform.
let serverPlatform: string;
if (platformInfo === undefined) {
serverPlatform = 'neutral';
} else {
serverPlatform = platformSpecificPackages.find(
(p) =>
p.platformInfo.platform === platformInfo.platform &&
p.platformInfo.architecture === platformInfo.architecture
)!.rid;
}
const { packagePath, serverPlatform } = await acquireRoslyn(packageJSON, platformInfo, false);

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

async function acquireRoslyn(
packageJSON: any,
platformInfo: PlatformInformation | undefined,
interactive: boolean
): Promise<{ packagePath: string; serverPlatform: string }> {
const roslynVersion = packageJSON.defaults.roslyn;

// Find the matching server RID for the current platform.
let serverPlatform: string;
if (platformInfo === undefined) {
serverPlatform = 'neutral';
} else {
serverPlatform = platformSpecificPackages.find(
(p) =>
p.platformInfo.platform === platformInfo.platform &&
p.platformInfo.architecture === platformInfo.architecture
)!.rid;
}

const packagePath = await acquireNugetPackage(
`Microsoft.CodeAnalysis.LanguageServer.${serverPlatform}`,
roslynVersion,
interactive
);
return { packagePath, serverPlatform };
}

async function installRazor(packageJSON: any, platformInfo: PlatformInformation) {
return await installPackageJsonDependency('Razor', packageJSON, platformInfo);
}
Expand Down Expand Up @@ -138,7 +168,7 @@ async function installPackageJsonDependency(
}
}

async function acquireNugetPackage(packageName: string, packageVersion: string): Promise<string> {
async function acquireNugetPackage(packageName: string, packageVersion: string, interactive: boolean): Promise<string> {
packageName = packageName.toLocaleLowerCase();
const packageOutputPath = path.join(nugetTempPath, packageName, packageVersion);
if (fs.existsSync(packageOutputPath)) {
Expand All @@ -150,9 +180,11 @@ async function acquireNugetPackage(packageName: string, packageVersion: string):
const dotnetArgs = [
'restore',
path.join(rootPath, 'server'),
`/p:MicrosoftCodeAnalysisLanguageServerVersion=${packageVersion}`,
`/p:PackageName=${packageName}`,
`/p:PackageVersion=${packageVersion}`,
];
if (argv.interactive) {

if (interactive) {
dotnetArgs.push('--interactive');
}

Expand Down
Loading