Skip to content

postprocess: run on a whole dir at once, searching for *.c_decls.json files#1533

Merged
kkysen merged 1 commit intomasterfrom
kkysen/postprocess-search-dir
Jan 5, 2026
Merged

postprocess: run on a whole dir at once, searching for *.c_decls.json files#1533
kkysen merged 1 commit intomasterfrom
kkysen/postprocess-search-dir

Conversation

@kkysen
Copy link
Contributor

@kkysen kkysen commented Jan 5, 2026

Previously, we took a root rust source file (like lib.rs or main.rs). This is because tools like merge-rust use that. But the comment transferer works on any *.rs file with a corresponding *.c_decls.json, so we weren't always giving the rust tools the right root source file. Also, this only worked for running on a single file.

Now we take a root source file and search for *.c_decls.jsons in its directory, passing the root source file to merge-rust and the individual *.rss to the comment transferer. This isn't always perfect, as mod declarations can reference other files not in the directory hierarchy, but to get that exact search, we'd have to parse the Rust. This should be a good enough approximation for now. Also, this should be better for handling conditional compilation.

…n` files

Previously, we took a root rust source file (like `lib.rs` or `main.rs`).
This is because tools like `merge-rust` use that.
But the comment transferer works on any `*.rs` file with a corresponding `*.c_decls.json`,
so we weren't always giving the rust tools the right root source file.
Also, this only worked for running on a single file.

Now we take a root source file and search for `*.c_decls.json`s in its directory,
passing the root source file to `merge-rust`
and the individual `*.rs`s to the comment transferer.
This isn't always perfect, as `mod` declarations can reference other files not in the directory hierarchy,
but to get that exact search, we'd have to parse the Rust.
This should be a good enough approximation for now.
Also, this should be better for handling conditional compilation.
@kkysen kkysen requested a review from thedataking January 5, 2026 23:08
Base automatically changed from kkysen/postprocess-update-rust to master January 5, 2026 23:40
@kkysen kkysen merged commit 65ca2b9 into master Jan 5, 2026
6 checks passed
@kkysen kkysen deleted the kkysen/postprocess-search-dir branch January 5, 2026 23:40
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.

2 participants