-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying the target to run the test with #136
Comments
Do you mean you need an option to process the following two lines in one line? cargo hack check --each-feature
cargo hack check --each-feature --skip std --target wasm32-unknown-unknown |
Those two lines are not going to cut it. What they don't handle is:
|
Overall, I think baking in the logic to derive target from a feature is kind of overly specific, but I've figured that each crate can have some instructions on how it should be tested by |
Thanks for the explanation. If I understand correctly, what this feature request is asking for is something like:
And the following is the feature that I initially thought this feature request to be asking for.
|
Yep. something like this. I tried to implement it manually with some scripting, but it ended up non-trivial with One thing to note is a difficulty with how substrate projects manage This means we need to Can we actually detect whether the Some extra context of our caseWe have, by in large, three kinds of crates:
What would be nice is to run the checks on the individual crates in the |
Some context first: we are building a blockchain on substrate, and have a monorepo with a bunch of crates. Some crates are intended to be built in both std and
no_std
modes, but the issue is that when building inno_std
mode, wasm target is assumed. Crates have anstd
flag, which enables std mode in dependencies, and when it's absent - the dependent crates also disable std mode (and switch to assumingwasm
).The problem is we can't test
no_std
mode withcargo hack
.It would be great if we could use a presence of a certain feature in the features set under test to use a different compile
target
(in our case -wasm32-unknown-unknown
).An example.
Let us have a crate with features
std = ["dep1/std", "dep2/std"]
,feat1 = ["std", "codec"]
,feat2 = ["some-non-std-feature"]
.We'd like to test in the following way:
features:
[std]
target: native (since
std
is explicitly enabled)features:
[feat1]
target: native (since
std
is implicitly enabled viafeat1
)features:
[feat2]
target: WASM (since
std
is effectively not enabled)features:
[]
target: WASM (since
std
is effectively not enabled)We could specify all this manually somehow if we had just one or two crates, but we have way too much of them, and the logic to determine the target is so simple, yet tricky, so I thought it would be a good fit for
cargo-hack
.I'm sure if
cargo-hack
offers this functionality other projects will pick it up as well.The text was updated successfully, but these errors were encountered: