From d75d5585f5f40b042963fc022782c80c6bb7a5ae Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Wed, 13 Jul 2022 10:51:03 -0700 Subject: [PATCH] move the client example to its own crate We're likely to add more examples with more dependencies (e.g. ffmpeg, gstreamer, webrtc). Nice to not have their deps in the main crate's dev-dependencies, and likewise to have each example show its true dependencies. As mentioned here: https://github.com/scottlamb/retina/issues/19#issuecomment-902302720 --- .github/workflows/ci.yml | 14 ++++++++------ Cargo.lock | 20 ++++++++++++++++---- Cargo.toml | 9 +++++---- examples/client/Cargo.toml | 18 ++++++++++++++++++ examples/client/{ => src}/info.rs | 0 examples/client/{ => src}/main.rs | 0 examples/client/{ => src}/mp4.rs | 0 examples/client/{ => src}/onvif.rs | 0 8 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 examples/client/Cargo.toml rename examples/client/{ => src}/info.rs (100%) rename examples/client/{ => src}/main.rs (100%) rename examples/client/{ => src}/mp4.rs (100%) rename examples/client/{ => src}/onvif.rs (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af7673e..987ebac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,22 +35,24 @@ jobs: toolchain: ${{ matrix.rust }} override: true components: ${{ matrix.extra_components }} + - name: Build + run: cargo build --all-features --all-targets --workspace - name: Test - run: cargo test --all-features --all-targets + run: cargo test --all-features --all-targets --workspace - name: Check fuzz tests - run: cd fuzz && cargo check + run: cd fuzz && cargo check --workspace - name: Check main crate formatting if: matrix.rust == 'stable' run: cargo fmt -- --check - name: Check fuzz crate formatting if: matrix.rust == 'stable' - run: cd fuzz && cargo fmt -- --check + run: cd fuzz && cargo fmt -- --check --all - name: Clippy on main crate if: matrix.rust == 'stable' - run: cargo clippy -- -D warnings + run: cargo clippy --workspace -- -D warnings - name: Clippy on fuzz crate if: matrix.rust == 'stable' - run: cd fuzz && cargo clippy -- -D warnings + run: cd fuzz && cargo clippy --workspace -- -D warnings license: name: Check copyright/license headers @@ -58,4 +60,4 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - run: find . -type f -print0 | xargs -0 .github/workflows/check-license.py \ No newline at end of file + - run: find . -type f -print0 | xargs -0 .github/workflows/check-license.py diff --git a/Cargo.lock b/Cargo.lock index 8c57f7c..40d7209 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -137,6 +137,22 @@ dependencies = [ "vec_map", ] +[[package]] +name = "client" +version = "0.0.0" +dependencies = [ + "anyhow", + "bytes", + "futures", + "itertools", + "log", + "mylog", + "retina", + "structopt", + "tokio", + "url", +] + [[package]] name = "cookie-factory" version = "0.3.2" @@ -900,7 +916,6 @@ checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" name = "retina" version = "0.4.0" dependencies = [ - "anyhow", "base64", "bitreader", "bytes", @@ -909,7 +924,6 @@ dependencies = [ "h264-reader", "hex", "http-auth", - "itertools", "log", "mylog", "once_cell", @@ -919,7 +933,6 @@ dependencies = [ "rtsp-types", "sdp-types", "smallvec", - "structopt", "thiserror", "time", "tokio", @@ -1194,7 +1207,6 @@ dependencies = [ "mio", "num_cpus", "once_cell", - "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", diff --git a/Cargo.toml b/Cargo.toml index fb39242..ca88b9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,7 @@ +[workspace] +members = [".", "examples/client"] +default-members = ["."] + [package] name = "retina" version = "0.4.0" @@ -34,12 +38,9 @@ tokio-util = { version = "0.7.3", features = ["codec"] } url = "2.2.1" [dev-dependencies] -anyhow = "1.0.41" criterion = { version = "0.3.4", features = ["async_tokio"] } -itertools = "0.10.1" mylog = { git = "https://github.com/scottlamb/mylog" } -structopt = "0.3.21" -tokio = { version = "1.5.0", features = ["fs", "io-util", "macros", "parking_lot", "rt-multi-thread", "signal", "test-util"] } +tokio = { version = "1.5.0", features = ["io-util", "macros", "rt-multi-thread", "test-util"] } [profile.bench] debug = true diff --git a/examples/client/Cargo.toml b/examples/client/Cargo.toml new file mode 100644 index 0000000..48084fb --- /dev/null +++ b/examples/client/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "client" +version = "0.0.0" +publish = false +edition = "2021" +rust-version = "1.59" + +[dependencies] +bytes = "1.0.1" +futures = "0.3.14" +log = "0.4.8" +retina = { path = "../../" } +tokio = { version = "1.5.0", features = ["fs", "io-util", "macros", "rt-multi-thread", "signal"] } +url = "2.2.1" +anyhow = "1.0.41" +itertools = "0.10.1" +mylog = { git = "https://github.com/scottlamb/mylog" } +structopt = "0.3.21" diff --git a/examples/client/info.rs b/examples/client/src/info.rs similarity index 100% rename from examples/client/info.rs rename to examples/client/src/info.rs diff --git a/examples/client/main.rs b/examples/client/src/main.rs similarity index 100% rename from examples/client/main.rs rename to examples/client/src/main.rs diff --git a/examples/client/mp4.rs b/examples/client/src/mp4.rs similarity index 100% rename from examples/client/mp4.rs rename to examples/client/src/mp4.rs diff --git a/examples/client/onvif.rs b/examples/client/src/onvif.rs similarity index 100% rename from examples/client/onvif.rs rename to examples/client/src/onvif.rs