Skip to content
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

Avoid modifying source files in tests/standalone if they have not changed #3072

Closed

Conversation

sivadeilra
Copy link
Collaborator

@sivadeilra sivadeilra commented Jun 5, 2024

This fixes a problem relating to the build script of the crates/tests/standalone crate. This build script runs bindgen on a variety of inputs and generates source code.

The problem is that the build script modifies source code during a build script, and does so unconditionally. Because this process is relatively slow, these filesystem writes sometimes interfere with Git operations, because Git sees the intermediate (partially modified) state of these source files. This has been a big hassle for me in running Git operations.

The solution is to provide an optional behavior for windows-bindgen, which will cause it to check the existing contents of a file and will only overwrite the file if the file's contents have changed. If they are the same, no further action is taken. This is not ideal -- it's not a good idea to have builds modifying source code -- but at least it only does so when the contents need to change. This avoids a lot of conflicts with Rust Analyzer, Git, etc.

dpaoliello
dpaoliello previously approved these changes Jun 5, 2024
@kennykerr
Copy link
Collaborator

I think this can be simplified by pushing the logic into the windows-bindgen crate. Here's what I mean: #3079

The other improvements, like using windows-bindgen instead of riddle is great too, but those can be introduced separately.

@kennykerr kennykerr closed this Jun 7, 2024
@sivadeilra sivadeilra changed the title Directly run bindgen instead of recursively running Cargo, in tests/standalone Avoid modifying source files in tests/standalone if they have not changed Jun 11, 2024
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.

3 participants