winrt-rust
winrt-rust copied to clipboard
Should running the codegen be part of the build process?
We need to figure out whether running the code generator should be part of building the library. If so, we should have a Cargo build script to run it as part of building winrt-rust
.
So far, I'm inclined to say that we should have gen.rs
checked into the repository and distribute it that way. This has the following advantages:
- We can generate it from the most recent version of the
winmd
files. I think that those are backwards compatible, so you can always compile against the latest version and if you use a feature that is not available on your local OS version, it will fail at runtime. (This can also be considered a disadvantage: you will get compile-time errors when you first run codegen from your localwinmd
s, which is arguably better than runtime errors). - You don't need a C# compiler and .NET runtime to build the project (might be good for cross-compilation from Linux if that ever becomes a thing)