Repository navigation
Conversation
|
GNU testsuite comparison: |
b98f746 to
bf4239f
Compare
|
GNU testsuite comparison: |
bf4239f to
0fcde2d
Compare
|
GNU testsuite comparison: |
sylvestre
left a comment
There was a problem hiding this comment.
sorry
i really don't like the duplication of src/uu/*/build.rs
|
I don’t like the duplication either, but I’m not sure how to avoid it. Do you have suggestions on how we could factor this out? |
|
i prefer the current state than this duplication, sorry |
|
I guess we could |
|
if it works, it would be better |
|
I've tried specifying the cfg in The only alternative I can think of is introducing a small |
@sylvestre If this works, would you approve the changes? |
|
Cannot we use workespace's toplevel build.rs? |
i don't think it works. i tried too and failed |
yes |
0fcde2d to
945a586
Compare
Annoyingly, this didn't work. |
|
GNU testsuite comparison: |
945a586 to
5d3b4fd
Compare
|
GNU testsuite comparison: |
5d3b4fd to
971a907
Compare
|
GNU testsuite comparison: |
|
I don't like symlink since it breaks tarball extraction on Windows, but can you symlink build.rs? |
Can't do this because some utilities already have a |
971a907 to
585db72
Compare
d55b3eb to
ae4e120
Compare
This comment was marked as outdated.
This comment was marked as outdated.
ae4e120 to
0f88c5a
Compare
|
@sylvestre Actually, I don't think we should move the alias definitions to a common location. They depend on features defined by each crate (e.g. |
6140912 to
39cf1c6
Compare
39cf1c6 to
42dd93a
Compare
49e4675 to
3a61a24
Compare
3a61a24 to
a997a68
Compare
|
@zicklag Is there any way to share one config given by |
|
Oh, that's a great question! I need to double-check the way that cargo handles the custom You might be able to just put the cfg aliases in a crate that is included in all your other crates and they might be inherited, but I haven't verified yet. If that doesn't work then it would be reasonable to add a feature to I'll try to test it out today and let you know. |
@zicklag When I last looked into this, that approach turned out to be non-viable due to a |
|
Oh, interesting. I just confirmed that the cfgs are not inherited from dependencies' build scripts ( which makes sense, otherwise there could be namespacing issues ). I'll experiment with options and share what I find. |
|
OK, I think I found something that works pretty nicely. In your workspace you can create a file like pub fn activate() {
cfg_aliases::cfg_aliases! {
sixtyfour: { target_arch = "x86_64" },
thirtytwo: { target_arch = "x86" }
}
}Then in each crate that will need to use the aliases you can do this in the #[path = "../cfgs.rs"]
mod cfgs;
fn main() {
cfgs::activate();
}Rust analyzer seems happy with it for me. Let me know if that doesn't work for you for some reason. 🫡 |
|
Depends on #15634. |
|
@zicklag With your approach, I occasionally encounter a However, as described in rust-lang/rust-analyzer#20129, this can be worked around by explicitly adding the file to "rust-analyzer.vfs.extraIncludes": ["${workspaceFolder}/cfg_aliases.rs"] |
a997a68 to
07a5e95
Compare
USe
cfg-aliasescrate forselinuxandsmackfeatures.