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

Disable winit default features #477

Merged
merged 8 commits into from Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -51,8 +51,9 @@ jobs:
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-19 --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-20 --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-22 --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-23 --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-24 --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-23/default --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-24/default --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-25/default --all-targets
rustfmt:
name: Check rustfmt
runs-on: ubuntu-latest
Expand Down Expand Up @@ -138,8 +139,9 @@ jobs:
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-19
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-20
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-22
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-23
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-24
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-23/default
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-24/default
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-25/default
# Run unreasonably slow tests under release, but only the crates that have
# them, and don't bother doing this on most platforms.
- run: cargo test -p imgui --release -- --ignored
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.markdown
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

- Removed automatically adding default features for `imgui-winit-support`
with the exception of the current default winit feature/dep version. Additionally, that version was updated to 0.25. If you want to not have the default features of winit with 0.25, set `default-features = false` and add `winit-25` as a normal feature. Thank you to @dzil123 for the work [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/477)!

- Added an `imgui-glow-renderer` which targets `glow 0.10`. Before release, this will be updated to target current `0.11` glow when further features are added. Thank you to @jmaargh for the work [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/495)!

- BREAKING: Reworked `.range` calls on `Slider`, `VerticalSlider`, and `Drag` to simply take two min and max values, and requires that they are provided in the constructor.
Expand Down
9 changes: 5 additions & 4 deletions imgui-winit-support/Cargo.toml
Expand Up @@ -14,12 +14,13 @@ imgui = { version = "0.7.0", path = "../imgui" }
winit-19 = { version = ">= 0.16, < 0.20", package = "winit", optional = true }
winit-20 = { version = ">= 0.20, < 0.22", package = "winit", optional = true }
winit-22 = { version = "0.22", package = "winit", optional = true }
winit-23 = { version = "0.23", package = "winit", optional = true }
winit-24 = { version = "0.24", package = "winit", optional = true }
winit-25 = { version = "0.25", package = "winit", optional = true }
winit-23 = { version = "0.23", package = "winit", default-features = false, optional = true }
winit-24 = { version = "0.24", package = "winit", default-features = false, optional = true }
winit-25 = { version = "0.25", package = "winit", default-features = false, optional = true }

[features]
default = ["winit-25"]
default = ["winit-25/default"]
test = ["winit-23/default", "winit-24/default", "winit-25/default"]

# This is phrased as a negative (unlike most features) so that it needs to be
# explicitly disabled (and `default-features = false` won't do it). To avoid
Expand Down
16 changes: 7 additions & 9 deletions imgui-winit-support/src/lib.rs
Expand Up @@ -194,15 +194,13 @@ use winit::{
TouchPhase, VirtualKeyCode, Window, WindowEvent,
};

#[cfg(
any(
feature = "winit-25",
feature = "winit-24",
feature = "winit-23",
feature = "winit-22",
feature = "winit-20"
)
)]
#[cfg(any(
feature = "winit-25",
feature = "winit-24",
feature = "winit-23",
feature = "winit-22",
feature = "winit-20"
))]
use winit::{
error::ExternalError,
event::{
Expand Down
18 changes: 16 additions & 2 deletions xtask/src/main.rs
Expand Up @@ -41,7 +41,14 @@ fn lint_all() -> Result<()> {
"cargo clippy --manifest-path imgui-winit-support/Cargo.toml --all-features --all-targets"
)
.run()?;
let winits = &["winit-19", "winit-20", "winit-22", "winit-23", "winit-24"];
let winits = &[
"winit-19",
"winit-20",
"winit-22",
"winit-23/default",
"winit-24/default",
"winit-25/default",
];
for &winit in winits {
xshell::cmd!("cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features {winit} --all-targets").run()?;
}
Expand All @@ -52,7 +59,14 @@ fn lint_all() -> Result<()> {
fn test_all() -> Result<()> {
xshell::cmd!("cargo test --workspace --all-targets").run()?;
xshell::cmd!("cargo test --workspace --doc").run()?;
let winits = &["winit-19", "winit-20", "winit-22", "winit-23", "winit-24"];
let winits = &[
"winit-19",
"winit-20",
"winit-22",
"winit-23/default",
"winit-24/default",
"winit-25/default",
];
for &winit in winits {
xshell::cmd!("cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features {winit} --all-targets").run()?;
}
Expand Down