fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 520 forks source link

Create a function which allows to serialize a FrameworkVersion in nuget syntax #291

Closed forki closed 9 years ago

forki commented 9 years ago

very naive implementation might look like:

type FrameworkVersion (projectFwVersion:string) =
  let nugetFwVersion = projectFwVersion.Replace("v","net")
  member x.NugetFwVersion = nugetFwVersion

also tests...

khellang commented 9 years ago

Basically you want this mapping? (from NuGet.Core)

".NETFramework" -> "net"
".NETMicroFramework" -> "netmf"
"Silverlight" -> "sl"
".NETCore" -> "win"
"Windows" -> "win"
".NETPortable" -> "portable"
"WindowsPhone" -> "wp"
"WindowsPhoneApp" -> "wpa"
"Xamarin.iOS" -> "xamarinios"
"Xamarin.Mac" -> "xamarinmac"
"Xamarin.PlayStation3" -> "xamarinpsthree"
"Xamarin.PlayStation4" -> "xamarinpsfour"
"Xamarin.PlayStationVita" -> "xamarinpsvita"
"Xamarin.Xbox360" -> "xamarinxboxthreesixty"
"Xamarin.XboxOne" -> "xamarinxboxone"
forki commented 9 years ago

not exactly. At the moment wer can understand the folder structure in a package see https://github.com/fsprojects/Paket/blob/master/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs#L26

what we want is to convert this info back into nuget syntax in order to patch nuspecs.

khellang commented 9 years ago

OK, so basically what this method does? (also from NuGet.Core) https://gist.github.com/khellang/af53ef9991e8e31a6cc5

forki commented 9 years ago

not completely sure but I think the inverse. but @Vidarls knows ;-)

khellang commented 9 years ago

It seems a bit crazy to duplicate all this logic. Have you ever considered dragging in NuGet.Core or even cherry-picking these parts from the NuGet codebase?

forki commented 9 years ago

We don't duplicate the logic ;-) But yes we considered to reference NuGet.Core. Very carefully.

And we cherry-pick.

2014-10-23 19:36 GMT+02:00 Kristian Hellang notifications@github.com:

It seems a bit crazy to duplicate all this logic. Have you even considered dragging in NuGet.Core or even cherry-picking these parts from the NuGet codebase?

— Reply to this email directly or view it on GitHub https://github.com/fsprojects/Paket/issues/291#issuecomment-60276988.

Vidarls commented 9 years ago

I have to admit there is a lot I do not yet grok of nuget/nuspec (like yhe fact that nuget have a public Api for utility stuff like this..)

Anyhow, the reason for this conversion is to convert from targey fw found in a proj file to the correct subfolder name in a nuget package lib folder. My current (bnaive) implementation at the top seems to be working, but might have issues with edge cases. Not sure if nuget core has any code for this, but none of @khellang s suggestions seems to fit this use case

khellang commented 9 years ago

You should at least check out NuGet.Core's VersionUtility and NetPortableProfileTable (along with the other classes under the NuGet.Core.NETPortable namespace). They should have methods to go back and forth between different framework version representations.

forki commented 9 years ago

Yes. We did already. And ported some parts.

But I can tell you most of the stuff is not really fitting. We already used in FAKE... On Oct 23, 2014 8:46 PM, "Kristian Hellang" notifications@github.com wrote:

You should at least check out NuGet.Core's VersionUtility http://nuget.codeplex.com/SourceControl/latest#src/Core/Utility/VersionUtility.cs and NetPortableProfileTable http://nuget.codeplex.com/SourceControl/latest#src/Core/NETPortable/NetPortableProfileTable.cs (along with the other classes under the NuGet.Core.NETPortable namespace.

— Reply to this email directly or view it on GitHub https://github.com/fsprojects/Paket/issues/291#issuecomment-60289036.

forki commented 9 years ago

I think I misinterpreted @Vidarls' original code and that part is already covered. Need to go back to the beginning.