fable-compiler / Fable

F# to JavaScript, TypeScript, Python, Rust and Dart Compiler
http://fable.io/
MIT License
2.93k stars 301 forks source link

Paket groups are not respected #960

Closed et1975 closed 7 years ago

et1975 commented 7 years ago

Description

Using fable 1.0.4 with paket dependencies I install UI dependencies in UI paket group. When compiling it fails with:

ERROR: Missing packages/Fable.Core/Fable.Core.nuspec

Repro code

Should be able to reproduce by installing Fable depedencies in a separate group.

Expected and actual results

paket.references knows it's dealing with UI group:

group UI FSharp.Core Fable.Core Fable.Aether Fable.Elmish.React Fable.Elmish.Browser Fable.Elmish.Debugger

Restore succeeds, as well as dotnet build. I expect Fable should be able to resolve from the corresponding packages directory: packages/ui/Fable.Core/

Related information

alfonsogarciacaro commented 7 years ago

I don't know well how Paket groups work, would love to have some help here (@forki?), or at least know a bit more about the specifications like:

matthid commented 7 years ago

@alfonsogarciacaro

  • Fable is not looking into paket.references but the .fsproj.references file in the obj folder, is the group also specified there?

We could add it if needed, but on this occasion: Do you need the dependencies in the packages folder? I'd ideally move away from the packages folder if possible. The extracted packages can be found in the nuget cache folder. Paket could print the path somewhere for fable to pick up.

  • Is the subdirectory (corresponding to the group name) in packages always in lower case?

Yes

alfonsogarciacaro commented 7 years ago

I guess we could use the .nuget folder, though I've sometimes noticed problems if Fable library sources are not in the same hierarchy as the node_modules. Why do you recommend not using the packages folder @matthid? is it planned for Paket to use the Nuget cache instead?

matthid commented 7 years ago

Problem is that in netcore world it's just very inefficient to copy all packages into every repository. It's both time consuming and a waste of disk drive. One idea was to make the packages folder opt-out and maybe opt-in in a future version (with a warning in the transition time). But we haven't decided anything jet. It's just that if fable would work with the .nuget folder its one less thing to wory about.

If fable can't work reliably with the .nuget folder that's fine as well. The feature itself will not go anywhere anytime soon because of compat reasons.

alfonsogarciacaro commented 7 years ago

Thanks for the explanation, @matthid! Yes, I also find annoying that cloned repos can take almost 1GB after downloading dependencies (I'm not sure if netstandard2.0 will change this situation), but I think I saw once a discussion saying it was intended to keep the packages folder.

In any case, this probably should be a separate issue. If Paket makes the packages folder and opt-out eventually we can fix that in Fable later. For now let's focus on the Paket groups, would it be possible then to add the group info to the dependencies in the .fsproj.references file?

matthid commented 7 years ago

yes I agree, just wanted to use the opportunity to let you know.

And yes we could add that short term. Maybe the proper long term solution is to use paket.core in fable to be able to use the api to get package folder paths and stuff. Do we need to compile paket with fable for this?

Maybe we should add an issue in paket to track the short term solution