Skip to content

chore: check each feature works properly #1695

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

Merged
merged 18 commits into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
tokio:
- fs
- io
- io-traits
- io-util
- net-driver
- process
Expand Down
15 changes: 15 additions & 0 deletions ci/azure-test-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,18 @@ jobs:
CI: 'True'
displayName: ${{ crate.key }} - cargo test --features ${{ feature }}
workingDirectory: $(Build.SourcesDirectory)/${{ crate.key }}

# Remove all dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866.
- bash: cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml ./*/Cargo.toml
displayName: Remove dev-dependencies

# Check each specified feature works properly
- ${{ each crate in parameters.crates }}:
# Run with each specified feature
- ${{ each feature in crate.value }}:
- script: cargo check --no-default-features --features ${{ feature }}
env:
LOOM_MAX_PREEMPTIONS: 2
CI: 'True'
displayName: ${{ crate.key }} - cargo check --features ${{ feature }}
workingDirectory: $(Build.SourcesDirectory)/${{ crate.key }}
11 changes: 11 additions & 0 deletions ci/remove-dev-dependencies/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "remove-dev-dependencies"
version = "0.1.0"
authors = ["Tokio Contributors <team@tokio.rs>"]
edition = "2018"
publish = false

[workspace]

[dependencies]
toml_edit = "0.1.5"
25 changes: 25 additions & 0 deletions ci/remove-dev-dependencies/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use std::{env, fs};

fn main() {
let res: Result<(), Box<dyn std::error::Error>> = env::args_os().skip(1).try_for_each(|file| {
let mut doc: toml_edit::Document = fs::read_to_string(&file)?.parse()?;
let table = doc.as_table_mut();
table.remove("dev-dependencies");
if let Some(table) = table.entry("target").as_table_mut() {
// `toml_edit::Table` does not have `.iter_mut()`, so collect keys.
let keys: Vec<String> = table.iter().map(|(key, _)| key.to_string()).collect();
for key in keys {
if let Some(table) = table.entry(&key).as_table_mut() {
table.remove("dev-dependencies");
}
}
}
fs::write(file, doc.to_string_in_original_order())?;
Ok(())
});

if let Err(e) = res {
eprintln!("{}", e);
std::process::exit(1)
}
}
21 changes: 17 additions & 4 deletions tokio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ default = [
"timer",
]

fs = ["tokio-executor/blocking"]
fs = ["io-traits", "tokio-executor/blocking"]
io-traits = ["bytes", "iovec"]
io-util = ["io-traits", "pin-project", "memchr"]
io = ["io-traits", "io-util"]
macros = ["tokio-macros"]
net-full = ["tcp", "udp", "uds"]
net-driver = ["mio", "tokio-executor/blocking"]
net-driver = [
"io-traits",
"mio",
"slab",
"sync",
"tokio-executor/blocking",
]
rt-current-thread = [
"timer",
"tokio-executor/current-thread",
Expand All @@ -60,11 +66,18 @@ signal = [
"libc",
"mio-uds",
"net-driver",
"signal-hook-registry"
"signal-hook-registry",
"winapi/consoleapi",
"winapi/minwindef",
]
sync = ["tokio-sync"]
tcp = ["io", "net-driver"]
timer = ["crossbeam-utils", "slab"]
timer = [
"crossbeam-utils",
"slab",
"sync",
"tokio-executor",
]
udp = ["io", "net-driver"]
uds = ["io", "net-driver", "mio-uds", "libc"]
process = [
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub mod fs;

pub mod future;

#[cfg(feature = "io")]
#[cfg(feature = "io-traits")]
pub mod io;

#[cfg(feature = "net-driver")]
Expand Down