spl-collections: fix borsh builds for string wrappers#188
Conversation
|
Could we add a |
|
@joncinque we currently have --feature-powerset but the issue is that I'm wondering if that self-referencing dev dependency pattern is idiomatic. I think we can get this coverage by:
- [dev-dependencies]
- spl-collections = { path = ".", features = ["borsh", "wincode"] }
test-%:
- SBF_OUT_DIR=$(PWD)/target/deploy cargo $(nightly) test --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
+ SBF_OUT_DIR=$(PWD)/target/deploy cargo $(nightly) hack test --each-feature --tests --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
#[cfg(test)]
mod tests {
+ #[cfg(any(feature = "borsh", feature = "wincode"))]
use super::*;
+ #[cfg(feature = "borsh")]
use borsh::{BorshDeserialize, BorshSerialize};
+ #[cfg(feature = "wincode")]
use wincode::WriteError;Hmm. But that puts cargo-hack as a dep on the Thoughts? |
|
How about we just drop |
|
Hmmm, yeah, that seems to be the issue. Weird that it would resolve dependencies for all targets together. An alternative is not to use We can tweak the script to go over all the targets that we want. |
That will grant feature isolation for the build, but then we lose the compile checks on the feature-gated tests. But if we keep the self-referencing dev deps, the That would make the ci/cd have:
If we are cool with that, then that's a simple fix. If we find that tests should also have feature isolation, we'd need a solution that runs
Would be nice somehow to not have to maintain that list in the makefile and keep package lists in |
|
Sorry if this is a silly question, but what do we get out of feature isolation in tests? |
A test that uses multiple features that should not be used together? I can't think of a specific case but perhaps someone writes a test that implicitly relies on everything being turned on when that is not a valid feature set (?). Maybe it's not a real issue though 🤔 |
|
#189 for the fix |
from_utf8is a function that was only imported behind thewincodefeature. As a result, downstream crates usingspl-collectionswithfeatures = ["borsh"]failed to compile.