-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Paket convert-from-nuget doesn't crash on NuGet v2 syntax - fixes #3151
- Loading branch information
Showing
15 changed files
with
95 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,9 @@ let Read fileName = | |
doc.Load f) | ||
|
||
[for node in doc.SelectNodes("//package") -> | ||
let v = node.Attributes.["version"].Value | ||
{ NugetPackage.Id = node.Attributes.["id"].Value | ||
VersionRange = VersionRange.Specific (SemVer.Parse node.Attributes.["version"].Value) | ||
VersionRequirement = VersionRequirement.Parse v | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
Kind = NugetPackageKind.Package | ||
TargetFramework = | ||
node | ||
|
@@ -28,13 +29,20 @@ let Serialize (packages: NugetPackage seq) = | |
let packages = | ||
packages | ||
|> Seq.choose (fun p -> | ||
match p.VersionRange with | ||
match p.VersionRequirement.Range with | ||
| VersionRange.Specific v -> | ||
let framework = | ||
match p.TargetFramework with | ||
| Some tf -> sprintf "targetFramework=\"%s\" " (tf.Replace(">= ","")) | ||
| _ -> "" | ||
|
||
Some (sprintf """ <package id="%s" version="[%O]" %s/>""" p.Id v framework) | ||
This comment has been minimized.
Sorry, something went wrong.
M0ns1gn0r
|
||
| VersionRange.Minimum v -> | ||
let framework = | ||
match p.TargetFramework with | ||
| Some tf -> sprintf "targetFramework=\"%s\" " (tf.Replace(">= ","")) | ||
| _ -> "" | ||
|
||
Some (sprintf """ <package id="%s" version="%O" %s/>""" p.Id v framework) | ||
| _ -> None) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
tests/Paket.Tests/PackagesConfig/xunit.visualstudio.packages2.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="xunit.runner.visualstudio" version="[2.0.1]" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I think this has changed behavior because
packages.config
will never contain[]
and in particular it has changedconvert-from-nuget
(and some tests).