-
Notifications
You must be signed in to change notification settings - Fork 614
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
[pregen] Use pathlib in pre-generation scripts #6745
[pregen] Use pathlib in pre-generation scripts #6745
Conversation
This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR. |
If the file contents didn't change, why would it need to rewrite the file? That's just making the build system do more work. wpiformat isn't run by the build system, yet it still only writes files that changed. |
Why would you run the script if the inputs haven't changed? Now that they are pre generated it is completely divorced from the gradle / cmake / bazel i(s smart enough to run it once and not overwrite the files if the diff is a no-op). The average user and builder will never run these scripts, either directly or indirectly by running any flavor of build.
|
It's a principle thing. It's like two extra lines that saves the build system potential work. Whether the build runs the script or not is irrelevant. |
Selfishly, it actively interferes with bazel. It produces non hermeticity in the build. The inputs to the function don't change, but the outputs can, depending on if it has been run before. |
As the person who wrote the |
Since there's an increasing number of these nearly-equivalent generation scripts, is there something we can do to reduce code duplication and ensure similarity? I'm not saying to generate the generation scripts, but deduplicate them somehow. |
They all have their own snowflake bits, but there is probably some things that could be pulled into a library. I'd like to do that as a follow up after these two prs land |
This stems from this comment left on my other PR.
When I made the PWM generator, I copied the style of the other pregeneration tools. However the
Path
library is nice, and if that was requested in that PR, these other files should be updated for consistency. I also added type hints where possible, and snuck in command line arguments so that my bazel build can run the generation during a build.In the cases where it existed, I removed the "only write if dirty" check. This isn't as crucial since the scripts don't get run during a build, and I thought it was better for the "least astonishment principle" if it always generates the files, as its name suggests.