-
Notifications
You must be signed in to change notification settings - Fork 373
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
Make codegen I/O-free and agnostic to output location #3888
Conversation
let stderr = String::from_utf8_lossy(&output.stderr).trim().to_owned(); | ||
anyhow::bail!("{stdout}\n{stderr}") | ||
} | ||
} |
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 don't understand why you moved out the language-specific formatting out of the language-specific modules?
To me it makes more sense if GeneratedFiles
would be the final files, with no extra processing required.
Then these functions would be a lot more similar to each other (identical?)
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.
…and it would make the PR diff smaller too :)
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 just don't like the the mixup of concerns: the codegen pass should only concern itself with generating code, not any post-processing (including formatting) nor I/O.
Especially so with the current implementation where the codegen pass is nice and pure while the formatting pass requires I/O, process spawning, etc.
I will likely introduce a formalized formatting pass in #3495 though, which will make all these generate_XXX
methods go away and make --check
ing trivial.
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.
that makes sense!
6443539
to
136f851
Compare
Commit by commit
This is necessary refactoring work for the upcoming
attr.rust.custom_crate
attribute, itself necessary for the upcoming serde-codegen support, itself necessary for the upcoming blueprint experimentations as well as #3741.Changes
CodeGenerator
trait as well as all post-processing helpers (gitattributes, orphan detection...) are now I/O-free.This is very important as it makes it possible to generate e.g. rust code out of the
re_types
crate without everything crumbling down.A side-effect is that gitattributes files are now finer-grained.
Necessary for the upcoming
attr.rust.custom_crate
.md
files were removed in this PR.re_arrow2
toarrow
#3741--check
argument tocargo codegen
#3495Checklist