Skip to content

Expose Target and Unit params to appropriate Executor callbacks#4416

Merged
bors merged 1 commit intorust-lang:masterfrom
Xanewok:more-executor-params
Aug 20, 2017
Merged

Expose Target and Unit params to appropriate Executor callbacks#4416
bors merged 1 commit intorust-lang:masterfrom
Xanewok:more-executor-params

Conversation

@Xanewok
Copy link
Copy Markdown
Contributor

@Xanewok Xanewok commented Aug 19, 2017

This effectively does only two things:

  • Pass existing &Unit to init()
  • Pass existing &Target to exec()s

Also updated doc comments slightly.

The init() is called for every Work preparation by rustc() and since it's not called once (not sure if intended?), it'd be good to include more information for which Unit the rustc process invocation has been initially prepared (I think more importantly it shows that init() is called many times for many targets).
Additionally, it'd be good to know about Unit compiled in the exec() callbacks in more structured manner (so the user doesn't have to parse the ProcessBuilder arguments and/or make certain assumptions) and since target was already cloned and moved into the closure, it was only a matter of exposing it.

I think it'd be ideal to provide all the necessary information to recreate a Unit but with a static lifetime needed for the closure, however this would mean cloning more data per-target (Kind should be basically free, however not sure if cloning Profile is acceptable). With this, Executor users could query Context more easily (e.g. to get a unit dep graph! 😄), as the API accepts Units in many places.

r? @alexcrichton
cc @nrc

EDIT:
This changes the public API, not sure if there's something else I should do about it, only ran cargo test locally.

Xanewok added a commit to Xanewok/rls that referenced this pull request Aug 20, 2017
Until rust-lang/cargo#4416 is merged, this depends on
a `more-executor-params` of the Xanewok/cargo fork. That PR provides additional,
necessary information passed via `Executor` callbacks used to query `Context`
and create the target dependency graph.
Xanewok added a commit to Xanewok/rls that referenced this pull request Aug 20, 2017
Until rust-lang/cargo#4416 is merged, this depends on
a `more-executor-params` of the Xanewok/cargo fork. That PR provides additional,
necessary information passed via `Executor` callbacks used to query `Context`
and create the target dependency graph.
@alexcrichton
Copy link
Copy Markdown
Member

@bors: r+

Looks great to me, thanks!

@bors
Copy link
Copy Markdown
Contributor

bors commented Aug 20, 2017

📌 Commit 2fd78db has been approved by alexcrichton

@bors
Copy link
Copy Markdown
Contributor

bors commented Aug 20, 2017

⌛ Testing commit 2fd78db with merge bcf3997...

bors added a commit that referenced this pull request Aug 20, 2017
Expose `Target` and `Unit` params to appropriate `Executor` callbacks

This effectively does only two things:
* Pass existing `&Unit` to `init()`
* Pass existing `&Target` to `exec()`s

Also updated doc comments slightly.

The `init()` is called for every `Work` preparation by `rustc()` and since it's not called once (not sure if intended?), it'd be good to include more information for which `Unit` the `rustc` process invocation has been initially prepared (I think more importantly it shows that `init()` is called many times for many targets).
Additionally, it'd be good to know about `Unit` compiled in the `exec()` callbacks in more structured manner (so the user doesn't have to parse the `ProcessBuilder` arguments and/or make certain assumptions) and since `target` was already cloned and moved into the closure, it was only a matter of exposing it.

I think it'd be ideal to provide all the necessary information to recreate a `Unit` but with a static lifetime needed for the closure, however this would mean cloning more data per-target ([`Kind`](https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/cargo_rustc/mod.rs#L41) should be basically free, however not sure if cloning [`Profile`](https://github.com/rust-lang/cargo/blob/master/src/cargo/core/manifest.rs#L151) is acceptable). With this, `Executor` users could query `Context` more easily (e.g. to get a unit dep graph! 😄), as the API accepts `Unit`s in many places.

r? @alexcrichton
cc @nrc

EDIT:
This changes the public API, not sure if there's something else I should do about it, only ran `cargo test` locally.
@bors
Copy link
Copy Markdown
Contributor

bors commented Aug 20, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing bcf3997 to master...

@bors bors merged commit 2fd78db into rust-lang:master Aug 20, 2017
@Xanewok
Copy link
Copy Markdown
Contributor Author

Xanewok commented Aug 20, 2017

Thank you! 🎉

@Xanewok Xanewok deleted the more-executor-params branch August 20, 2017 22:13
@ehuss ehuss added this to the 1.21.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants