-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TargetFramework for Fable #2338
Comments
I think there was a similar discussion somewhere but I cannot find it now. Is it possible to define custom target frameworks? I thought only the ones defined by the dotnet sdk were allowed: netstandard, netcoreapp, net5.0, etc. |
I think there are other target frameworks besides those. It's probably related to some NuGet/ msbuild logic. |
It would be better not to mess around with MSBuild, like requiring users to import some props file. Also, Fable already depends on simplistic XML parsing of the .fsproj files in some situations, and we are already seeing weird dependency bugs like #2326. What do you have in mind to create a custom target framework for Fable? |
Yes, I wonder what's required in order to make it not weird like that. You might be able to package it as a NuGet. |
Samsung uses a custom target framework for Tizen projects, so it's possible. Their custom MSBuild SDK adds implicit package references, some targets and enables some VS tooling, depending on that. It looks like the .NET SDK v5 knows about the Tizen runtime, which is based on Linux, according to |
That's neat, so it might be possible then to do something similar for Fable 😃 |
Well, the "custom MSBuild SDK" part doesn't sound like an easy feat though ;) |
Depends on how much help we can get from people that are familiar with MsBuild. I'm thinking that if you have a minimal targetframework definition (without involving the actual Fable compiler to start with) it might be feasible. |
@wallymathieu The project parsing in Fable is entirely done by the Dotnet.ProjInfo component, so perhaps this issue can be raised there too, to see if custom framework targets can be properly supported. If what you're looking for is just a conditionally different set of assembly dependencies, perhaps a much less-involving solution would be to have a way to add/remove/replace dependencies through the command line, after project parsing. Finally, for completeness, it's worth mentioning that the |
I'm thinking also about how to package existing libs to be compatible with Fable. We probably wan't to add custom implementations around async: fsprojects/FSharpPlus#419 that also depends on Fable libraries for the Fable implementation. It would not make sense to take on a Fable dependency for all targetframeworks. |
I've done some experiments and got this: fable-targetframework-test-main.zip though that's not good enough. |
Just because it hasn't been mentioned in this issue yet. The solution used in general to provide a Fable version of a library or a .Net version of a library right now is simply to publish 2 packages. For example:
If needed, the user or library maintainer can use Just wanted to re-mention this because sometimes the simple solution is enough. As @ncave said, |
Closing for now as dealing with msbuild is not on the roadmap atm, please reopen if someone is willing to give it a try or there's another question. |
Description
In order to specify dependencies that only makes sense when compiling an F# project against Fable it would make sense to have a separate TargetFramework intended for use with Fable.
Repro code
The repro code would be some library code that works on both .net and Fable but requires some additional Fable specific JavaScript to work (say timer and async logic).
An example would be Fuchu where the async code could have slightly different implementation. For Fuchu it wouldn't make sense to try to take on a dependency on Fuchu for netstandard2.0, but it would make sense to take it on for fuchu3 for instance.
Related information
The text was updated successfully, but these errors were encountered: