Skip to content

Commit

Permalink
fix(jsii-pacmak): invalid dotnet version suffixes (aws#1568)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MrArnoldPalmer authored Apr 18, 2020
1 parent 330ec79 commit c6f9a14
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/jsii-pacmak/lib/targets/version-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.JSII.Runtime" Version="[0.0.0,0.0.1)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BaseOfBasePackageId" Version="[0.0.0,0.0.1-0)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BaseOfBasePackageId" Version="[0.0.0,0.0.1)" />
</ItemGroup>
<PropertyGroup>
<NoWarn>0612,0618</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.JSII.Runtime" Version="[0.0.0,0.0.1)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BasePackageId" Version="[0.0.0,0.0.1-0)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BaseOfBasePackageId" Version="[0.0.0,0.0.1-0)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BasePackageId" Version="[0.0.0,0.0.1)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BaseOfBasePackageId" Version="[0.0.0,0.0.1)" />
</ItemGroup>
<PropertyGroup>
<NoWarn>0612,0618</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.JSII.Runtime" Version="[0.0.0,0.0.1)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BasePackageId" Version="[0.0.0,0.0.1-0)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BaseOfBasePackageId" Version="[0.0.0,0.0.1-0)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.LibPackageId" Version="[0.0.0-devpreview,0.0.1-0)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BasePackageId" Version="[0.0.0,0.0.1)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.BaseOfBasePackageId" Version="[0.0.0,0.0.1)" />
<PackageReference Include="Amazon.JSII.Tests.CalculatorPackageId.LibPackageId" Version="[0.0.0-devpreview,0.0.1)" />
</ItemGroup>
<PropertyGroup>
<NoWarn>0612,0618</NoWarn>
Expand Down
8 changes: 4 additions & 4 deletions packages/jsii-pacmak/test/targets/version-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const examples: Record<string, { maven: string, nuget: string, python: string }>
},
'~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',
},

Expand All @@ -26,12 +26,12 @@ const examples: Record<string, { maven: string, nuget: string, python: string }>
},
'~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',
},

Expand Down

0 comments on commit c6f9a14

Please sign in to comment.