From c6f9a14b9b2389f68a60808e8cab30b89824e28a Mon Sep 17 00:00:00 2001 From: Mitchell Valine Date: Fri, 17 Apr 2020 17:03:00 -0700 Subject: [PATCH] fix(jsii-pacmak): invalid dotnet version suffixes (#1568) Removes version suffix from version ranges in `.csproj` files generated by jsii-pacmak. Dotnet doesn't allow version suffixes that start with a number. Version ranges by default don't include prereleases so the resolved version is as intended without the suffix in this case. --- packages/jsii-pacmak/lib/targets/version-utils.ts | 2 +- ...on.JSII.Tests.CalculatorPackageId.BasePackageId.csproj | 2 +- ...zon.JSII.Tests.CalculatorPackageId.LibPackageId.csproj | 4 ++-- .../Amazon.JSII.Tests.CalculatorPackageId.csproj | 6 +++--- packages/jsii-pacmak/test/targets/version-utils.test.ts | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/jsii-pacmak/lib/targets/version-utils.ts b/packages/jsii-pacmak/lib/targets/version-utils.ts index 70d2d632ae..a7a6af1b64 100644 --- a/packages/jsii-pacmak/lib/targets/version-utils.ts +++ b/packages/jsii-pacmak/lib/targets/version-utils.ts @@ -20,7 +20,7 @@ export function toMavenVersionRange(semverRange: string, suffix?: string): strin * @see https://docs.microsoft.com/en-us/nuget/concepts/package-versioning#version-ranges-and-wildcards */ export function toNuGetVersionRange(semverRange: string): string { - return toBracketNotation(semverRange); + return toBracketNotation(semverRange, undefined, { semver: false }); } /** diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId.csproj b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId.csproj index c85c0e3114..6df81f8e66 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId.csproj +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId.csproj @@ -26,7 +26,7 @@ - + 0612,0618 diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId.csproj b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId.csproj index f5350812e2..ab48cbd8c8 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId.csproj +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId.csproj @@ -26,8 +26,8 @@ - - + + 0612,0618 diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon.JSII.Tests.CalculatorPackageId.csproj b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon.JSII.Tests.CalculatorPackageId.csproj index 6a40934b9d..525025ccb2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon.JSII.Tests.CalculatorPackageId.csproj +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon.JSII.Tests.CalculatorPackageId.csproj @@ -28,9 +28,9 @@ - - - + + + 0612,0618 diff --git a/packages/jsii-pacmak/test/targets/version-utils.test.ts b/packages/jsii-pacmak/test/targets/version-utils.test.ts index 99192bcda8..9b227c7303 100644 --- a/packages/jsii-pacmak/test/targets/version-utils.test.ts +++ b/packages/jsii-pacmak/test/targets/version-utils.test.ts @@ -9,12 +9,12 @@ const examples: Record }, '~1.2.3': { maven: '[1.2.3,1.3.0)', - nuget: '[1.2.3,1.3.0-0)', + nuget: '[1.2.3,1.3.0)', python: '>=1.2.3, <1.3.0', }, '^1.2.3': { maven: '[1.2.3,2.0.0)', - nuget: '[1.2.3,2.0.0-0)', + nuget: '[1.2.3,2.0.0)', python: '>=1.2.3, <2.0.0', }, @@ -26,12 +26,12 @@ const examples: Record }, '~0.1.2': { maven: '[0.1.2,0.2.0)', - nuget: '[0.1.2,0.2.0-0)', + nuget: '[0.1.2,0.2.0)', python: '>=0.1.2, <0.2.0', }, '^0.1.2': { maven: '[0.1.2,0.2.0)', - nuget: '[0.1.2,0.2.0-0)', + nuget: '[0.1.2,0.2.0)', python: '>=0.1.2, <0.2.0', },