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
This commit is contained in:
Scott Lamb 2022-07-13 10:51:03 -07:00
parent 33bd057ade
commit d75d5585f5
8 changed files with 47 additions and 14 deletions

View File

@ -35,22 +35,24 @@ jobs:
toolchain: ${{ matrix.rust }} toolchain: ${{ matrix.rust }}
override: true override: true
components: ${{ matrix.extra_components }} components: ${{ matrix.extra_components }}
- name: Build
run: cargo build --all-features --all-targets --workspace
- name: Test - name: Test
run: cargo test --all-features --all-targets run: cargo test --all-features --all-targets --workspace
- name: Check fuzz tests - name: Check fuzz tests
run: cd fuzz && cargo check run: cd fuzz && cargo check --workspace
- name: Check main crate formatting - name: Check main crate formatting
if: matrix.rust == 'stable' if: matrix.rust == 'stable'
run: cargo fmt -- --check run: cargo fmt -- --check
- name: Check fuzz crate formatting - name: Check fuzz crate formatting
if: matrix.rust == 'stable' if: matrix.rust == 'stable'
run: cd fuzz && cargo fmt -- --check run: cd fuzz && cargo fmt -- --check --all
- name: Clippy on main crate - name: Clippy on main crate
if: matrix.rust == 'stable' if: matrix.rust == 'stable'
run: cargo clippy -- -D warnings run: cargo clippy --workspace -- -D warnings
- name: Clippy on fuzz crate - name: Clippy on fuzz crate
if: matrix.rust == 'stable' if: matrix.rust == 'stable'
run: cd fuzz && cargo clippy -- -D warnings run: cd fuzz && cargo clippy --workspace -- -D warnings
license: license:
name: Check copyright/license headers name: Check copyright/license headers

20
Cargo.lock generated
View File

@ -137,6 +137,22 @@ dependencies = [
"vec_map", "vec_map",
] ]
[[package]]
name = "client"
version = "0.0.0"
dependencies = [
"anyhow",
"bytes",
"futures",
"itertools",
"log",
"mylog",
"retina",
"structopt",
"tokio",
"url",
]
[[package]] [[package]]
name = "cookie-factory" name = "cookie-factory"
version = "0.3.2" version = "0.3.2"
@ -900,7 +916,6 @@ checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
name = "retina" name = "retina"
version = "0.4.0" version = "0.4.0"
dependencies = [ dependencies = [
"anyhow",
"base64", "base64",
"bitreader", "bitreader",
"bytes", "bytes",
@ -909,7 +924,6 @@ dependencies = [
"h264-reader", "h264-reader",
"hex", "hex",
"http-auth", "http-auth",
"itertools",
"log", "log",
"mylog", "mylog",
"once_cell", "once_cell",
@ -919,7 +933,6 @@ dependencies = [
"rtsp-types", "rtsp-types",
"sdp-types", "sdp-types",
"smallvec", "smallvec",
"structopt",
"thiserror", "thiserror",
"time", "time",
"tokio", "tokio",
@ -1194,7 +1207,6 @@ dependencies = [
"mio", "mio",
"num_cpus", "num_cpus",
"once_cell", "once_cell",
"parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"socket2", "socket2",

View File

@ -1,3 +1,7 @@
[workspace]
members = [".", "examples/client"]
default-members = ["."]
[package] [package]
name = "retina" name = "retina"
version = "0.4.0" version = "0.4.0"
@ -34,12 +38,9 @@ tokio-util = { version = "0.7.3", features = ["codec"] }
url = "2.2.1" url = "2.2.1"
[dev-dependencies] [dev-dependencies]
anyhow = "1.0.41"
criterion = { version = "0.3.4", features = ["async_tokio"] } criterion = { version = "0.3.4", features = ["async_tokio"] }
itertools = "0.10.1"
mylog = { git = "https://github.com/scottlamb/mylog" } mylog = { git = "https://github.com/scottlamb/mylog" }
structopt = "0.3.21" tokio = { version = "1.5.0", features = ["io-util", "macros", "rt-multi-thread", "test-util"] }
tokio = { version = "1.5.0", features = ["fs", "io-util", "macros", "parking_lot", "rt-multi-thread", "signal", "test-util"] }
[profile.bench] [profile.bench]
debug = true debug = true

View File

@ -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"