-
Notifications
You must be signed in to change notification settings - Fork 75
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
Improve target handling #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these commits are basically good, but I expect that rewriting without project.exec
and with lateinit
or lazy
will change stuff enough that I should look again.
Thanks for digging in, Thom!
7e2e719
to
2fc34ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm basically happy with this, modulo the cargoCommand
bit below. Add rustcCommand
(and env vars) if it's not possible to get this data from cargo
directly.
/** Attempt to get the default (desktop) target triple by parsing `rustc -Vv` output. */ | ||
private fun computeDefaultTargetTriple(): String? { | ||
val runtime = Runtime.getRuntime() | ||
// Do we need to worry about the env (specifically PATH) here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a cargoCommand
and a pythonCommand
. Can we determine this version from cargoCommand
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, we cannot. I'll add rustcCommand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think doing this would prevent us from caching the output. Hmm, let me think if there's a problem with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, All the caching code is gone, we just invoke it every time based on the extension configuration. It's not fatal for us to fail to locate it, we'll just pass --target explicitly and warn.
da27c05
to
3b26ec0
Compare
I've cleaned up the commit history as well. |
This fixes #9 and #10.
The complexity is mainly in the fix for #10, to avoiding invoking
rustc --version --verbose
once per task. It completes somewhat quickly, but we often have a lot of tasks. Ideally we'd just use a Lazy, static ctor, or some other way of doing the same thing we do automatically, but our need to pass in the Project prevents this.I also improved the documentation for
targetDirectory
in the fix for #10, since it didn't explain when you might want to use it, and i think the example could be confusing (since there's arelease
folder inside the target directory).