cargo: glob-expand workspace members#15704
Conversation
|
Do you have an example? I would rather avoid it, especially considering that crates.io workspace are exploded anyway and therefore we control somewhat the workspace Cargo.toml files that we process. |
|
Currently looking if I can somehow avoid this by writing custom meson files for it (we can just rely on Is there a mechanism that allows me to specify needed features for the synthesized |
|
No, there isn't (other than writing your own meson.build and dropping it via packagefiles, but that's more of a side effect than a good idea). |
|
Would it be possible to extend the |
It was removed in the past, so I'd be reluctant to add it back. Instead of globbing we could:
However, this does not work well for glycin because it has a pretty complex generated So another possibility is to add the wrap file by hand, add an entry to the wrap file, like and use it to generate the |
I don't mind not relying on the generated meson.build, but instead on handwritten meson code - esp. since I'd like to just rely on So, something like that in the main glycin meson.build: extra_members = []
foreach loader : get_options('loaders')
extra_members += 'glycin-loaders' / loader
endforeach
cargo = import('rust').workspace(extra_members: extra_members) |
|
Yes, that's what I had in mind too. Would you like to give it a shot? |
Cargo.toml workspace members are glob expressions, which we'd rather not rely on. This ignores any glob expressions which don't have a single canonical result and relies on the user to specify expanded results through the newly introduced extra_members kwarg instead.
Updated, but the delayed default_member initialization is really ugly. But I'm not sure how this could be addressed, unless we define extra_members to never be part of default_members. |
|
I have another idea. What if the glob members were processed normally for their Cargo.toml but never expanded via In the specific case of glycin, the loaders are binaries so you need to handle them by hand anyway with something like |
|
Not quite sure I understand. How would this differ from my initial attempt (3012464)? |
|
The difference would be that the Cargo.toml file is loaded but the members are not processed automatically. For glycin there would be no difference because those members are not libraries but in general there would be a difference. I will have to play a bit to formalize it more. |
Apparently a thing