Skip to content

Commit

Permalink
Prevent installing crossbeam-channel with default-features="false"
Browse files Browse the repository at this point in the history
Debouncers used to install `crossbeam-channel`,
due to keeping `notify`'s default features enabled
even if their own default features were disabled.

With this change, `crossbeam-channel` will
no longer be installed if `notify-debouncer-*`
as well as `notify` are installed with
`default-features = false`

Fixes #549
  • Loading branch information
LeoniePhiline authored and Leonie Philine Bitto committed Nov 23, 2023
1 parent c4d0470 commit 1d02f8b
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 16 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,24 @@ jobs:
run: cargo check -p notify --no-default-features --features=macos_kqueue
# -p notify required for feature selection!

- name: check notify debouncer mini features
- name: check notify debouncer mini without crossbeam/default features
if: matrix.version == 'stable'
run: cargo check -p notify-debouncer-mini --no-default-features
run: cargo check -p notify-debouncer-mini --no-default-features --features=macos_fsevent
# -p required for feature selection to actually work!

- name: check notify debouncer full features
- name: check notify debouncer mini without crossbeam/default features on macos with kqueue
if: matrix.version == 'stable' && matrix.os == 'macos-latest'
run: cargo check -p notify-debouncer-mini --no-default-features --features=macos_kqueue
# -p required for feature selection to actually work!

- name: check notify debouncer full without crossbeam/default features
if: matrix.version == 'stable'
run: cargo check -p notify-debouncer-full --no-default-features --features=macos_fsevent
# -p required for feature selection to actually work!

- name: check notify debouncer full without crossbeam/default features on macos with kqueue
if: matrix.version == 'stable'
run: cargo check -p notify-debouncer-full --no-default-features
run: cargo check -p notify-debouncer-full --no-default-features --features=macos_kqueue
# -p required for feature selection to actually work!

- name: check build examples
Expand Down
6 changes: 4 additions & 2 deletions notify-debouncer-full/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ name = "notify_debouncer_full"
path = "src/lib.rs"

[features]
default = ["crossbeam"]
default = ["crossbeam","macos_fsevent"]
# can't use dep:crossbeam-channel and feature name crossbeam-channel below rust 1.60
crossbeam = ["crossbeam-channel","notify/crossbeam-channel"]
macos_fsevent = ["notify/macos_fsevent"]
macos_kqueue = ["notify/macos_kqueue"]

[dependencies]
notify = { version = "6.1.1", path = "../notify" }
notify = { version = "6.1.1", path = "../notify", default-features = false }
crossbeam-channel = { version = "0.5", optional = true }
file-id = { version = "0.2.1", path = "../file-id" }
walkdir = "2.2.2"
Expand Down
13 changes: 12 additions & 1 deletion notify-debouncer-full/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,24 @@ A debouncer for [notify] that is optimized for ease of use.
- `crossbeam` enabled by default, for crossbeam channel support.

This may create problems used in tokio environments. See [#380](https://github.com/notify-rs/notify/issues/380).
Use someting like the following to disable it.
Use something like the following to disable it.

```toml
notify-debouncer-full = { version = "*", default-features = false }
```

This also passes through to notify as `crossbeam-channel` feature.

On MacOS, when disabling default features, enable either the `macos_fsevent` feature
or, on latest MacOS, the `macos_kqueue` feature to be passed through to notify.

```toml
# Using FSEvents
notify-debouncer-full = { version = "*", default-features = false, features = ["macos_fsevent"] }

# Using Kernel Queues
notify-debouncer-full = { version = "*", default-features = false, features = ["macos_kqueue"] }
```

[docs]: https://docs.rs/notify-debouncer-full
[notify]: https://crates.io/crates/notify
6 changes: 4 additions & 2 deletions notify-debouncer-mini/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ name = "notify_debouncer_mini"
path = "src/lib.rs"

[features]
default = ["crossbeam"]
default = ["crossbeam","macos_fsevent"]
# can't use dep:crossbeam-channel and feature name crossbeam-channel below rust 1.60
crossbeam = ["crossbeam-channel","notify/crossbeam-channel"]
macos_fsevent = ["notify/macos_fsevent"]
macos_kqueue = ["notify/macos_kqueue"]

[dependencies]
notify = { version = "6.1.1", path = "../notify" }
notify = { version = "6.1.1", path = "../notify", default-features = false }
crossbeam-channel = { version = "0.5", optional = true }
serde = { version = "1.0.89", features = ["derive"], optional = true }
log = "0.4.17"
28 changes: 21 additions & 7 deletions notify-debouncer-mini/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ Tiny debouncer for [notify]. Filters incoming events and emits only one event pe

## Features

- `crossbeam` enabled by default, for crossbeam channel support.
This may create problems used in tokio environments. See [#380](https://github.com/notify-rs/notify/issues/380).
Use something like the following to disable it.
```toml
notify-debouncer-mini = { version = "*", default-features = false }
```
This also passes through to notify as `crossbeam-channel` feature.
- `crossbeam` enabled by default, for crossbeam channel support.

This may create problems used in tokio environments. See [#380](https://github.com/notify-rs/notify/issues/380).
Use something like the following to disable it.

```toml
notify-debouncer-mini = { version = "*", default-features = false }
```

This also passes through to notify as `crossbeam-channel` feature.

On MacOS, when disabling default features, enable either the `macos_fsevent` feature
or, on latest MacOS, the `macos_kqueue` feature to be passed through to notify.

```toml
# Using FSEvents
notify-debouncer-mini = { version = "*", default-features = false, features = ["macos_fsevent"] }

# Using Kernel Queues
notify-debouncer-mini = { version = "*", default-features = false, features = ["macos_kqueue"] }
```
- `serde` for serde support of event types, off by default

[docs]: https://docs.rs/notify-debouncer-mini
Expand Down

0 comments on commit 1d02f8b

Please sign in to comment.