Skip to content

Commit 6194c06

Browse files
committed
Add flashing feature, disable feature-specific dependencies
1 parent a186654 commit 6194c06

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ jobs:
7474
runs-on: ubuntu-22.04
7575

7676
steps:
77-
7877
- uses: actions/checkout@v4
7978

8079
- uses: ./.github/actions/setup-target
@@ -83,6 +82,8 @@ jobs:
8382
target: ${{ matrix.platform.target }}
8483

8584
- run: cargo check -p espflash --lib --no-default-features
85+
- run: cargo check -p espflash --lib --no-default-features --features flashing
86+
- run: cargo check -p espflash --lib --no-default-features --features serialport
8687

8788
msrv:
8889
name: Check MSRV (${{ matrix.platform.target }})

espflash/Cargo.toml

+9-5
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ regex = { version = "1.10.3", optional = true }
5050
serde = { version = "1.0.196", features = ["derive"] }
5151
serialport = { version = "4.3.0", optional = true }
5252
sha2 = "0.10.8"
53-
slip-codec = "0.4.0"
53+
slip-codec = { version = "0.4.0", optional = true }
5454
strum = { version = "0.26.1", features = ["derive"] }
5555
thiserror = "1.0.56"
5656
toml = "0.8.10"
5757
update-informer = { version = "1.1.0", optional = true }
58-
xmas-elf = "0.9.1"
58+
xmas-elf = { version = "0.9.1", optional = true }
5959

6060
[target.'cfg(unix)'.dependencies]
6161
libc = "0.2.153"
@@ -78,8 +78,12 @@ cli = [
7878
"dep:indicatif",
7979
"dep:lazy_static",
8080
"dep:parse_int",
81-
"dep:regex",
8281
"dep:update-informer",
83-
"serialport",
82+
"serialport"
8483
]
85-
serialport = ["dep:serialport"]
84+
85+
# enables connecting to a device via serial port
86+
serialport = ["flashing", "dep:serialport", "dep:slip-codec", "dep:regex"]
87+
88+
# enables flash stubs and stub commands
89+
flashing = ["xmas-elf"]

espflash/src/command.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Send commands to a target device
1+
//! Commands to work with a flasher stub running on a target device
22
33
use std::{io::Write, mem::size_of, time::Duration};
44

espflash/src/error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::{
66
};
77

88
use miette::Diagnostic;
9+
#[cfg(feature = "serialport")]
910
use slip_codec::SlipError;
1011
use strum::{FromRepr, VariantNames};
1112
use thiserror::Error;

espflash/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131
#[cfg(feature = "cli")]
3232
#[cfg_attr(docsrs, doc(cfg(feature = "cli")))]
3333
pub mod cli;
34+
#[cfg(feature = "flashing")]
3435
pub mod command;
3536
#[cfg(feature = "serialport")]
3637
#[cfg_attr(docsrs, doc(cfg(feature = "serialport")))]
3738
pub mod connection;
3839
pub mod elf;
3940
pub mod error;
41+
#[cfg(feature = "flashing")]
4042
pub mod flasher;
4143
pub mod image_format;
4244
pub mod targets;

0 commit comments

Comments
 (0)