Make the cli's csharp feature actually turn csharp off - #1690
Conversation
`wit-bindgen-csharp` is optional in the cli, but the cli depends on `wit-bindgen-test` unconditionally and that crate had a hard dependency on it, so the crate was always built no matter what features were picked. Make it optional there too and forward the cli's feature. `crates/test` is the only test driver that links a bindgen crate at all -- it needs `CSProject` to write the .csproj -- so `mod csharp` and the `Language::Csharp` variant go behind the same feature.
|
Thanks! I'm a bit hesitant to do this though because it's a pretty minor gain (removing a crate at compile time), and this otherwise makes the internal implementation of the test framework inconsistent where C# gets a cargo feature but nothing else does. One thing that I'm not certain of, however, is the original motivations of #1510. Do you have your own motivations for fixing this issue? Or are you mostly looking to contribute and that seemed a good bug to fix? |
|
No motivation of my own here — I'm not a C# user and I don't build with I'd also narrow what I wrote in the description: the feature does still gate the Closing. Leaving #1510 open in case someone shows up who actually wants the smaller build. |
wit-bindgen-csharpisoptional = truein the cli, but the cli also depends onwit-bindgen-testunconditionally, and that crate depended onwit-bindgen-csharpoutright. So the feature never actually removed anything:
After this it's out of the graph for
--no-default-featuresand for any singlenon-csharp language, and still in for the default build and for
--no-default-features --features csharp.crates/testis the only test driver that links a bindgen crate — the others shellout — and it does so for
CSProject, to write the .csproj. Somod csharpand theLanguage::Csharpvariant go behind the same feature. With csharp off the harnessno longer knows the
csextension and falls through to the--customlookup, whichsays the extension is unknown. Happy to keep the variant always present and error at
run time instead if you'd rather.
Closes #1510