Skip to content

Commit

Permalink
Cherry-pick #2870: Fix semver comparisons (#2871)
Browse files Browse the repository at this point in the history
* Fix semver comparisons (#2870)

* Update version and changelog
  • Loading branch information
bwateratmsft authored Apr 12, 2021
1 parent 9901566 commit 8040fc4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.12.1 - 12 April 2021
### Fixed
* Fixed C# extension not being recognized when adding Dockerfiles to a .NET project. [#2867](https://github.com/microsoft/vscode-docker/issues/2867)

## 1.12.0 - 12 April 2021
### Added
* The extension now targets Docker Compose commands to files matching the `dockercompose` language ID. This raises the minimum required VS Code version to 1.55.0. [#2761](https://github.com/microsoft/vscode-docker/issues/2761)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscode-docker",
"version": "1.12.0",
"version": "1.12.1",
"publisher": "ms-azuretools",
"displayName": "Docker",
"description": "Makes it easy to create, manage, and debug containerized applications.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,15 @@ export class NetCoreGatherInformationStep extends GatherInformationStep<NetCoreS
}

private async getMinimumCSharpExtensionExports(): Promise<CSharpExtensionExports> {
const minCSharpVersion = new semver.SemVer(minCSharpVersionString);
const cSharpExtension: vscode.Extension<CSharpExtensionExports> | undefined = vscode.extensions.getExtension(cSharpExtensionId);
const cSharpExtensionVersion: semver.SemVer | undefined = cSharpExtension ? new semver.SemVer((<{ version: string }>cSharpExtension.packageJSON).version) : undefined;

if (!cSharpExtension || !cSharpExtensionVersion) {
throw new Error(localize('vscode-docker.scaffold.netCoreGatherInformationStep.noCSharpExtension', 'Cannot generate Dockerfiles for a .NET project unless the C# extension is installed.'));
} else if (cSharpExtensionVersion < minCSharpVersion) {
} else if (semver.lt(cSharpExtensionVersion, minCSharpVersionString)) {
throw new Error(localize('vscode-docker.scaffold.netCoreGatherInformationStep.badVersionCSharpExtension', 'Cannot generate Dockerfiles for a .NET project unless version {0} or higher of the C# extension is installed.', minCSharpVersionString));
}

return cSharpExtension.isActive ? await cSharpExtension.activate() : cSharpExtension.exports;
return await cSharpExtension.activate();
}
}
2 changes: 1 addition & 1 deletion src/tasks/python/PythonExtensionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export namespace PythonExtensionHelper {

const version = new semver.SemVer(pyExt.packageJSON.version);

if (version.compare(minPyExtensionVersion) < 0) {
if (semver.lt(version, minPyExtensionVersion)) {
await vscode.window.showErrorMessage(localize('vscode-docker.tasks.pythonExt.pythonExtensionNotSupported', 'The installed Python extension does not meet the minimum requirements, please update to the latest version and try again.'));
return undefined;
}
Expand Down

0 comments on commit 8040fc4

Please sign in to comment.