Skip to content

Conversation

@alexeagle
Copy link
Contributor

@alexeagle alexeagle commented Nov 23, 2025

This technique is sometimes needed when a proc_macro derives information from the build, and it needs to be consumed by some other tool.

For example this one generates a JSON file as an intermediate output
https://github.com/napi-rs/napi-rs/blob/main/crates/macro/src/expand/typedef/type_def.rs#L11-L12
and then expects developers to call this via a Node.js binary which wraps rustc and also transforms that file to a TypeScript type definition file.

Under Bazel, this is better modeled as a rust_shared_library that produces the binding file (.so or .dylib for example) along with that JSON output, then run the Node.js binary as a separate target.

alexeagle and others added 4 commits November 23, 2025 12:58
…s will be created

This technique is sometimes needed when a proc_macro derives information from the build, and it needs to be consumed by some other tool
@alexeagle alexeagle marked this pull request as ready for review November 26, 2025 23:40
@UebelAndre UebelAndre self-requested a review November 27, 2025 06:11
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.

1 participant