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

Generate WIT file from Rust module #2

Merged
merged 13 commits into from
Feb 5, 2024
Merged

Generate WIT file from Rust module #2

merged 13 commits into from
Feb 5, 2024

Conversation

sviezypan
Copy link
Collaborator

@sviezypan sviezypan commented Feb 1, 2024

This PR introduces capability of a rust macro to generate WIT file from annotated rust module. Some examples are in examples project and readme.

@vigoo
Copy link
Contributor

vigoo commented Feb 1, 2024

I think you could just check if the target WIT's contents are the same, and not write to the file if so. That way although the macro would always run, it would not change the file times and make the WIT files dirty.

@vigoo
Copy link
Contributor

vigoo commented Feb 1, 2024

I'm doing this in zio-k8s/zio-aws code generators, I think :)

@vigoo
Copy link
Contributor

vigoo commented Feb 1, 2024

And for publishing, you can just copy the cargo settings and CI from for example https://github.com/golemcloud/golem-wasm-ast - there is an org secret that applies to this repo too for crates.io

@sviezypan
Copy link
Collaborator Author

I think you could just check if the target WIT's contents are the same, and not write to the file if so. That way although the macro would always run, it would not change the file times and make the WIT files dirty.

So you mean that macro would also read the file and compare the content with whatever it was trying to write and do not rewrite in case the content is the same?

@vigoo
Copy link
Contributor

vigoo commented Feb 1, 2024

Yes that's what I suggest

@sviezypan
Copy link
Collaborator Author

Yes that's what I suggest

I had some difficulties making it work reliably so I opened issue about it - and also few others for visibility.
Other than that from my side I think this is ready to be released.

@adamgfraser adamgfraser merged commit 271de4d into main Feb 5, 2024
2 checks passed
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