Repository navigation
Description
This is a continuation of #277, #261 and #239 to finally get rid of those.
IMHO we should only go down the ILMerge road if we have literally no other option, using ILMerge on libraries will probably increase the pain for library users which happen to have the same dependencies (FCS comes into mind). I think the notes of http://fsharp.github.io/2015/04/18/fsharp-core-notes.html apply basically for all other dependencies as well (TL;DR: libraries should not bundle and should not ILMerge dependencies).
The good thing is there are at least two other solutions:
- Create some kind of wrapper
.exelikeFAKE.exewhich wraps the execution of ourgenerate.fsx. With this we can basically configure our assembly redirects (for that exe) or even consider ILMerge (if we still want to do that for some reason). We could even have our own DSL and ask @forki how he would do it if he would re-do FAKE :). For the start if would probably be good to support existing scripts if possible. - Do what you already did: Fix the versions and additionally bundle
alldependencies. This is probably the lower cost solution.
Note how both options contradict my initial statement (we started contradicting it since bundling RazorEngine). So additionally we should split out our use cases in two seperate NuGet packages
- FSharp.Formatting <- used as it is currently as a build time helper (with one of the above options) with no additional dependency (everything is bundled to "just work" in build scripts; with one of the options from above)
- FSharp.Formatting.Library <- used in case someone wants to use FSharp.Formatting as library, for example the markdown parser (bundles no dependencies but has nuget dependencies). Users of the library need to handle assembly redirection, just like for any other library.
Sidenote (Paket):
We actually "could" get rid of the "FSharp.Formatting" nuget package if Paket would give us a way to install "FSharp.Formatting.Library" and all dependencies (without updating anything) in a separate folder. Something like isolated and separate "Build" dependencies come into mind... This resolution would need to be completely independent from project dependencies. But this is probably far away... This feature would probably help FAKE (which kind of has the same problem -> FAKE could probably get away with not bundling everything) as well. Kind of like fsprojects/Paket#515 but without even the need to specify the dependencies you want to internalize (We always want to internalize everything). With manually specifying "internalize" we have problems like changing paths when noticing we need to internalize another dependency. And IMHO we should even internalize "FSharp.Formatting" itself (so users can use different versions for referencing and building if they want to)
The problem mentioned in #239 with ILMerging RazorEngine still applies (but I'm pretty sure we could workaround that with the latest versions if ILMerging is really what you want)
I think I can come up with a PR for option 2 really quick, if needed/wanted. Maybe @forki can tell us if this "build" dependency stuff (sidenote) is something Paket can and wants to provide, but figuring out the details (and the implementation) will probably take some time anyway. If we go the "Paket" way I'm not sure how to support plain NuGet, but we can deal with that later on.
Tell me what you think and which option you would prefer. Other options to finally fix the dependency hell are appreciated as well :)
Activity
tpetricek commentedon Apr 24, 2015
I think that requiring a fixed version of Visual F# PowerTools and F# Compiler Service is probably a reasonable behavior for now. I guess having a separate "library" package would be nice if there are people who actually use F# Formatting as a library (but then, we might have a separate small-footprint library for Markdown too if people don't want everything with lots of dependencies...).
The error I was getting was happening on Mono when working on the FsLab Journal template - it was failing to load
FSharpVSPowerTools.Core.dllwhen creatingFsiEvaluatorin a Journal call frombuild.fsx.The new release of F# Formatting I did did not actually fix the issue for me (I should investigate further....) and I ended up adding a workaround to copy files as local dependencies, which is not needed on .NET, but looks necessary on Mono (the F# Compiler Service uses different DLL resolution code path on Mono, but I'm not sure what the differences are - cc @dsyme & @latkin for help :-))
matthid commentedon Apr 24, 2015
The problem goes a bit deeper than that, we currently force every (Paket-) user which uses FSF for building the docs to use exactly those versions in their project references (even if their code could/must be build and released on nuget based on higher/lower versions; We can basically break builds of other people with no real reason/need). IMHO this is wrong.
Example situation: Somebody fixes a bug in FCS which results in an incompatible API (I know unlikely but just to prove my point). Currently they cannot really update FCS without breaking the docs, they need to wait for a FSF update or bundle FCS. The same is true for any other dependency we have now or add in the future. We fixed it for RazorEngine by bundling.
Can I reproduce this by basically deleting the "copybinaries" target and running on linux?
tpetricek commentedon Apr 24, 2015
Hmm, I see what you're saying. It is certainly wrong - especially since the typical setup with generating docs is not really a dependency in the same way as ordinary project dependencies (you might even want to have those in a separate folder than standard dependencies in
packages...).I like the plan you outlined:
FSharp.Formatting"tool" package that bundles everything with fixed compatible versionsFSharp.Formatting.Librarypackage with standard dependenciesI guess (2) does not really need to have any fixed version dependencies - I suspect that the breaking change in VF PowerTools was more of an odd case, then something that will happen regularly...
Yes, I think so. The other thing I wanted to test is to try it with "copybinaries" but with F# Formatting 2.9.1 (to see if the copybinaries solves the issue even if there are incompatible versions loaded...)
matthid commentedon Apr 24, 2015
That's exactly what the side-note suggests :) (in a quite concrete fashion), but it's really a long way to go and no immediate solution.
👍 And actually users of the library can take care of such things (if they happen) like any other regular library update.
I can see it, looks interesting. See #305
matthid commentedon Sep 5, 2015
Well, now with paket groups (2.0) we have another interesting solution to parts of this problem: fsprojects/Paket#1018
We can now have a "build" group where FSF locks its dependencies (we actually should recommend to use the "Main" Paket group for this, because build scripts are harder to update than the msbuild files, which are handled by paket automatically). If I understand the help correctly we can now have a single package and recommend to use
for the Build group and
when FSharp.Formatting is used as "normal" library. This will make sure we get the lowest matching version in build scripts and the latest when used as library. @forki can maybe tell if I got this correct...
I will do some testing with my AdvancedBuilding library once paket 2.0 is released.
matthid commentedon Mar 23, 2017
Will probably be solved with netcore and fake.vnext