-
Notifications
You must be signed in to change notification settings - Fork 131
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
First class support for alternate backends #355
Comments
Hi @andyarvanitis! There has been no discussion about this yet, but so far the trend is that if there are commonly used compiler flags we try to take care of the more general use-case at the spago level rather than just passing them through (because the passthrough is not the best UX-wise and it introduces problems, e.g. see #353 or #216) In this case I would be interested in investigating if we can have first-class support for alternate backends in spago, so e.g. in order to get the whole alternative build running you'd only have to add something like |
That sounds fine to me, and would make it even easier for people to use the alternate backends. The Go backend would probably be a better candidate (than C++) to start with, since its tooling is simpler. I'm still making some adjustments, but I can let you know how it works and what the requirements would be. |
@andyarvanitis thanks, looking forward to it! I'll rename this issue to track support for alternate backends then 🙂 |
Following up on my previous comment, I think I have the golang tooling tweaking done (for now, at least). In the end, the only thing you currently need to do a go-backend build (typical case) involves one more step than what I showed in this issue earlier, namely: $ spago build -- -g corefn
$ psgo If FYI, Let me know what you think. |
Sounds great! A possible UX for all of this could be:
If the above makes sense then I have a few questions:
|
And cc @nwolverson: would this be interesting for the Erlang backend too? |
These all sound great to me.
Definitely. My mention of it was mainly for information; skipping for now sounds good.
If spago is not responsible for installing
Good question. |
@csicar congrats for the release of the Kotlin backend! 🙂 Cc'ing you to ask if you'd have any inputs about this thread, i.e. would the current description of "integration" work for |
First of all, I think adding support for alternative backends is a great idea.
I think just using the name of the executable there might even be easier: eg. for the go backend you would write The proposed changes would also work for
I agree with @andyarvanitis there: I think spago shouldn't have to care about that Some other ideas:
|
btw: pskt now has the same cli interface as psgo, so no additional arguments need to be provided to compile spago build -- --codegen corefn && pskt |
@csicar thanks for the inputs, it all sounds great! I have only one question:
How would this work? Also why not just push the various Though I think the above is a detail, so I'd say at this point we have a pretty clear plan. Since I'm going to be short on time myself in the next weeks I'll detail here what I think it should be done, so anyone can eventually pick it up and implement it:
|
It's been a bit of a hard sell to get non-js foreign code into the official core libraries. I can understand some of their reluctance, though, especially with more backends coming onto the scene. The approach I started taking with the second generation C++ backend and then continued with the Go backend works around this. But I wouldn't say it's a perfect solution, and some versioning provisions are still needed. See the comments on Aug 14 above for some (very basic) discussion on the matter. As for conforming to an "alternate backend CLI specification," I'm all for it, and would be happy to modify my stuff to accommodate it. Spago has been really great to work with! |
Having the foreign files in the original repos is of course preferable. In early development of the Backend and for alpha quality backends it is probably not desirable to upstream the foreign files to the official packages.
Though I think the above is a detail
Yes, absolutely. I don't want that to get in the way of progress.
I'm looking forward to having `--watch` available by default :)
Another question about the cli: I would also be interested in having a `no build` option: The kotlin compiler can be awfully slow, that means that recompilation is sometimes undesirable. Also when developing for Android, compilation is performed by the ide anyway, so that step can be skipped.
I guess that's something to work out when defining the cli specification.
Am 18. September 2019 19:59:25 MESZ schrieb Fabrizio Ferrai <[email protected]>:
…
@csicar thanks for the inputs, it all sounds great!
I have only one question:
> Support side-loading foreign files: PsKt and (if I remember correctly
also PsGo) side-load foreign files for some standard purescript
libraries (like prelude). If there was some support for that, the user
experience would be improved. Especially cloning the correct version of
the side-loaded repository for the installed package-set
How would this work? Also why not just push the various `.go` and
`.cpp` and `.kt` files to the core libraries so there wouldn't be the
need for sideloading but we could just use the "official" versions?
Though I think the above is a detail, so I'd say at this point we have
a pretty clear plan. Since I'm going to be short on time myself in the
next weeks I'll detail here what I think it should be done, so anyone
can eventually pick it up and implement it:
- add a `backend` key to the `Config`, of type `Maybe Text`, where
`Nothing` is the default backend and if it's `Just cmd` then `cmd` is
the alternate backend executable
- have `spago build` (and all the commands that build underneath) call
`spago build -- -g corefn && cmd`
- same for `spago run` but passing the `--run` flag to the backend
- write down an "alternate backend CLI specification" in here, so that
we have an interface that any backend can conform to if they want to
work with Spago
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#355 (comment)
|
I haven't tried upstreaming foreign code yet, but thst seems to confirm my suspicion.
My idea with side loading foreign files would be to clone a foreign package set with the same tag as the primary package set that is being used.
Say for example the `1.13` tag is used for the package set, then spago would also clone a foreign package set at tag `1.13` to some location in the current project - say `.spago/foreigns/psgo/`. The idea isn't refined, but maybe a starting point.
@andyarvanitis could that be a solution?
Am 19. September 2019 05:30:33 MESZ schrieb Andy Arvanitis <[email protected]>:
…It's been a bit of a hard sell to get non-js foreign code into the
official core libraries. I can understand some of their reluctance,
though, especially with more backends coming onto the scene. The
approach I started taking with the second generation C++ backend and
then continued with the Go backend works around this. But I wouldn't
say it's a perfect solution, and some versioning provisions are still
needed. See the comments on Aug 14 above for some (very basic)
discussion on the matter.
As for conforming to an "alternate backend CLI specification," I'm all
for it, and would be happy to modify my stuff to accommodate it. Spago
has been really great to work with!
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#355 (comment)
|
Yes, I was thinking of something along those lines, but for the Golang backend, I'd probably need it to go through |
That solution would also work for pskt.
One think isn't clear to me yet: How would psgo know for which packages it should download the foreign files?
If for example the packages "function" and "effect" are installed, would you still download the foreign files for other packages in the foreign files repo?
Am 20. September 2019 07:01:36 MESZ schrieb Andy Arvanitis <[email protected]>:
…Yes, I was thinking of something along those lines, but for the go
backend, I'd probably need it to go through `psgo` itself, due to the
way the `go` tools work. So something like a switch on `psgo`
specifying the tag, and then it would take care of fetching the files.
An example would be
`psgo --ffi-tag 1.13`. Do you think maybe `pskt` could also do the
fetching in a similar way? It wouldn't be great, but it would at least
make it easier on `spago` too.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#355 (comment)
|
For now, the entire |
Yeah, it's the same for me: Btw: |
I'm working on the implementation here: #426 |
Sounds great, thanks! |
You're welcome 🙂 |
@f-f I think support for |
@i-am-the-slime right now |
Yeah I'm totally in the dark wrt the need of other backends to have a custom test workflow, so please detail if you have more context - I think we'd be fine addind a separate path for |
Has there been any discussion of being able to specify the options passed to
purs
in the config file? My particular use case (alternate backends) currently requiresspago build -- -g corefn
, which admittedly isn't bad, but it would be nice to just set it once for a project.The text was updated successfully, but these errors were encountered: