Skip to content
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

Developer experience - enable all the features when running tests by default #2516

Merged
merged 3 commits into from
Sep 27, 2024

Conversation

pacak
Copy link
Contributor

@pacak pacak commented Sep 24, 2024

What does this PR do

#2091 left developer experience in a bad state: as far as tools are concerned by default - the project is broken. cargo test fails with lots of bogus errors, rust-analyzer ignores majority of the code, etc.

This PR tries to address this problem by explicitly enabling all the features for the nix crate in dev mode and making sure they will be added manually to the list by removing explicit --all-features from a few places.

According to cargo docs path-only dev dependencies are allowed and will be ignored when publishing the crate.

With this change in place I can run tests with usual cargo test, rust-analyzer and other tools work as expected.

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

@@ -77,6 +77,11 @@ parking_lot = "0.12"
rand = "0.8"
tempfile = "3.7.1"
semver = "1.0.7"
nix = { path = ".", features = ["acct", "aio", "dir", "env", "event", "fanotify",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, this dev dependency is for tests (examples/benchmarks), so I guess we cannot remove the --all-features flag of cargo build and cargo clippy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both work for me locally, CI passes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's right, but that means it only builds or runs the clippy check for a small set of code, which is not gated with any feature

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was still needed for build and clippy targets, added it back.

@pacak
Copy link
Contributor Author

pacak commented Sep 24, 2024 via email

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@SteveLauC SteveLauC added this pull request to the merge queue Sep 26, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 26, 2024
@SteveLauC
Copy link
Member

SteveLauC commented Sep 27, 2024

The CI error that blocks this PR from being merged is fixed in #2518, once it is merged, you can rebase your branch:)

@SteveLauC
Copy link
Member

#2518 is merged.

@SteveLauC SteveLauC changed the title Developer experience - all the features in dev mode Developer experience - all the features when running tests Sep 27, 2024
@@ -57,9 +57,9 @@ task:
<< : *TEST
i386_test_script:
- . $HOME/.cargo/env
- cargo build --target i686-unknown-freebsd --all-features
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this was reverted accidentally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... Good catch. I wonder how I managed that. Time to go to sleep I guess.

@pacak pacak changed the title Developer experience - all the features when running tests Developer experience - enable all the features when running tests by default Sep 27, 2024
@SteveLauC SteveLauC added this pull request to the merge queue Sep 27, 2024
Merged via the queue into nix-rust:master with commit 9064b4c Sep 27, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants