Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Use Cargo in-process via API #82

Closed
nrc opened this issue Oct 28, 2016 · 6 comments
Closed

Use Cargo in-process via API #82

nrc opened this issue Oct 28, 2016 · 6 comments

Comments

@nrc
Copy link
Member

nrc commented Oct 28, 2016

This should be more efficient and less hacky. I imagine we'll want to add a fair amount of API to Cargo to make this happen and we should do a little planning about exactly what we want that to look like.

cc #81

@Arnavion
Copy link
Contributor

Arnavion commented Nov 1, 2016

The (easier?) alternative is to add an option to cargo rustc to emit the args as a JSON array to stdout.

@matklad
Copy link
Member

matklad commented Nov 2, 2016

The (easier?) alternative is to add an option to cargo rustc to emit the args as a JSON array to stdout.

Yep, there is a plan to output information about the build in the JSON format: rust-lang/cargo#3212.

I personally don't quite like linking Cargo into the RLS: Cargo is just a build tool, what if you are using a bunch of makefiles for your project? It might help short term, but exposing an internal API will have long term consequences :)

Ideally, RLS should just invoke cargo metadata: it contains the definitive info about the project structure.

@bruno-medeiros
Copy link
Contributor

Ideally, RLS should just invoke cargo metadata: it contains the definitive info about the project structure.

What if you are using a bunch of makefiles for your project?... 😲

Not that I am advocating rls caters to the makefile scenario, quite the contrary (it shouldn't) - I'm just confused because you seem to be directly contradicting yourself in those two paragraphs.

@matklad
Copy link
Member

matklad commented Nov 2, 2016

I'm just confused because you seem to be directly contradicting yourself in those two paragraphs.

Yep, it is indeed a bit contradictory on the first look :) The trick is that cargo metadata is just a bunch of JSON data, so it should be possible to produce similar data even without Cargo and then tell RLS: "hey, I don't use Cargo, but here's a project description in the JSON format for you". This should work with any weird build scenario.

@bruno-medeiros
Copy link
Contributor

@matklad ah okay... yeah, that makes much more sense. :)

@nrc
Copy link
Member Author

nrc commented Nov 6, 2016

Long term, we should not be tied to Cargo and should handle any build system (and we've been designing the underlying code with that in mind). However, for the foreseeable future I think it makes sense to focus on Cargo since that is so prevalent in the ecosystem. With that in mind, we should basically not worry about the non-Cargo case for now in the 'front' of the RLS.

@nrc nrc closed this as completed in aaeec56 Dec 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants