-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: allow customizing the command for running build scripts #11956
Conversation
@Veykril this helps with properly expanding procedural macros in rust-lang/rust. Would you like to review this? |
Is this required? I am a bit reluctant to setting that env var since we don't really want crates to specialize for the case where r-a builds them. |
Not really. rust-lang/rust requires a few env vars to be set as can be seen with eddyb's comment: |
I wonder if this is the right solution. Usually, if the project is a normal cargo workspace there should be no reason why we can't |
|
Sure, but making it fully configurable wouldn't mean that it can't be configured to still use (I don't want to let the perfect be the enemy of the good though.) |
Yeah. That is why I pushed the fully configurable version. |
crates/rust-analyzer/src/config.rs
Outdated
/// Advanced option, fully override the command rust-analyzer uses for | ||
/// checking buildscripts and procedural macros. The command should | ||
/// include `--message-format=json` or similar option. | ||
checkBuildScriptOnSave_overrideCommand: Option<Vec<String>> = "null", |
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 suggest we call this rust-analyzer.cargo.runBuildScriptsCommand
(maybe runBuildScripts.command
would be ideal if we didn't already have runBuildScripts
as a boolean option). (The point of running cargo check here is not to check the build scripts, it's to have their results and the proc macros available.) For the description how about something like this:
Advanced option, fully override the command rust-analyzer uses to run build scripts and build procedural macros. The command should include `--message-format=json` or a similar option.
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.
done.
e83eb26
to
2a3b5ea
Compare
Maybe update the PR title and commit message? |
bors r+ |
bors doesn't work right now because of the repo move |
Are you working on the PRs to migrate to homu? I would like to help. |
Ye I was about to look into that, help with would be appreciated :) |
@bors ping |
@bors r=flodiebold |
📌 Commit 73a033e has been approved by |
☀️ Test successful - checks-actions |
Can we submit a change to the rustc contributor docs to say how to enable this feature? |
It shouldn't be changed until another nightly is released, rust-analyzer bumped in rust-lang/rust. But in the mean time I will write the instructions up and prepare a PR to rustc-dev-guide. |
I have tested this locally and it fixed #9201 with some small changes on the compiler side with suggestions from #9201 (comment).
I have also added an environment variable
IS_RA_BUILDSCRIPT_CHECK
for crates to detect that it is a check for buildscripts, and allows defaulting to bogus values for expected environment variables.