From 16664189c1fef6ab6476b0690fea929c5f2c2d24 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Thu, 6 Sep 2018 10:36:59 -0700 Subject: [PATCH] async-await: move examples into dedicated crate (#608) This works around a bug in the cargo renaming feature as well as allows the use of `[patch]` in the `Cargo.toml`. --- .travis.yml | 12 ++++++++ tokio-async-await/Cargo.toml | 4 +++ tokio-async-await/examples/Cargo.toml | 28 +++++++++++++++++++ tokio-async-await/examples/README.md | 5 ++++ tokio-async-await/examples/{ => src}/chat.rs | 0 .../examples/{ => src}/echo_client.rs | 0 .../examples/{ => src}/echo_server.rs | 0 tokio-async-await/examples/{ => src}/hyper.rs | 0 8 files changed, 49 insertions(+) create mode 100644 tokio-async-await/examples/Cargo.toml create mode 100644 tokio-async-await/examples/README.md rename tokio-async-await/examples/{ => src}/chat.rs (100%) rename tokio-async-await/examples/{ => src}/echo_client.rs (100%) rename tokio-async-await/examples/{ => src}/echo_server.rs (100%) rename tokio-async-await/examples/{ => src}/hyper.rs (100%) diff --git a/.travis.yml b/.travis.yml index 265aea283..7c4699b78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,18 @@ matrix: - env: TARGET=i686-unknown-freebsd - env: TARGET=i686-unknown-linux-gnu + # Test the async / await preview. We don't want to block PRs on this failing + # though. + - rust: nightly + env: ALLOW_FAILURES=true + script: | + cd tokio-async-await + cargo check --all + allow_failures: + - rust: nightly + env: ALLOW_FAILURES=true + + script: - | set -e diff --git a/tokio-async-await/Cargo.toml b/tokio-async-await/Cargo.toml index 1583de724..c8b077bf5 100644 --- a/tokio-async-await/Cargo.toml +++ b/tokio-async-await/Cargo.toml @@ -18,6 +18,10 @@ Experimental async/await support for Tokio categories = ["asynchronous"] [workspace] +members = [ + "./", + "examples", +] [lib] name = "tokio" diff --git a/tokio-async-await/examples/Cargo.toml b/tokio-async-await/examples/Cargo.toml new file mode 100644 index 000000000..204c91dec --- /dev/null +++ b/tokio-async-await/examples/Cargo.toml @@ -0,0 +1,28 @@ +cargo-features = ["edition"] + +[package] +name = "examples" +edition = "2018" + +# When releasing to crates.io: +# - Update html_root_url. +version = "0.1.1" +authors = ["Carl Lerche "] +license = "MIT" + +[[bin]] +name = "hyper" +path = "src/hyper.rs" + +[dependencies] +tokio-async-await = { version = "0.1.0", path = "../" } +bytes = "0.4.9" +hyper = "0.12.8" + +[patch.crates-io] +tokio = { path = "../.." } +tokio-executor = { path = "../../tokio-executor" } +tokio-io = { path = "../../tokio-io" } +tokio-reactor = { path = "../../tokio-reactor" } +tokio-tcp = { path = "../../tokio-tcp" } +tokio-timer = { path = "../../tokio-timer" } diff --git a/tokio-async-await/examples/README.md b/tokio-async-await/examples/README.md new file mode 100644 index 000000000..bd360f0e1 --- /dev/null +++ b/tokio-async-await/examples/README.md @@ -0,0 +1,5 @@ +# Tokio async/await examples + +These are a separate crate in order to work around some cargo bugs. It also +allows `[patch]` to be used in `Cargo.toml` to ensure the correct lib versions +are being pulled in. diff --git a/tokio-async-await/examples/chat.rs b/tokio-async-await/examples/src/chat.rs similarity index 100% rename from tokio-async-await/examples/chat.rs rename to tokio-async-await/examples/src/chat.rs diff --git a/tokio-async-await/examples/echo_client.rs b/tokio-async-await/examples/src/echo_client.rs similarity index 100% rename from tokio-async-await/examples/echo_client.rs rename to tokio-async-await/examples/src/echo_client.rs diff --git a/tokio-async-await/examples/echo_server.rs b/tokio-async-await/examples/src/echo_server.rs similarity index 100% rename from tokio-async-await/examples/echo_server.rs rename to tokio-async-await/examples/src/echo_server.rs diff --git a/tokio-async-await/examples/hyper.rs b/tokio-async-await/examples/src/hyper.rs similarity index 100% rename from tokio-async-await/examples/hyper.rs rename to tokio-async-await/examples/src/hyper.rs