Skip to content

Commit 93474d2

Browse files
committed
build: add a feature writers-and-readers, so we can import only the types in some cases
1 parent b549fe7 commit 93474d2

File tree

5 files changed

+11737
-9
lines changed

5 files changed

+11737
-9
lines changed

runtime_tracing/Cargo.toml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "runtime_tracing"
3-
version = "0.15.0"
3+
version = "0.16.0"
44
edition = "2024"
55
authors = ["Metacraft Labs Ltd"]
66
description = "A library for the schema and tracing helpers for the CodeTracer db trace format"
@@ -20,19 +20,26 @@ serde = { version = "1.0", features = ["derive"] }
2020
serde_json = "1.0"
2121
serde_repr = "0.1"
2222
schemars = "0.8.2"
23-
capnp = "0.21.1"
24-
cbor4ii = { version = "1.0.0", features = ["serde1", "use_std"] }
25-
fscommon = "0.1.1"
23+
capnp = { version = "0.21.1", optional = true }
24+
cbor4ii = { version = "1.0.0", features = ["serde1", "use_std"], optional = true }
25+
fscommon = { version = "0.1.1", optional = true }
2626

2727
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
28-
zeekstd = "0.6.0"
28+
zeekstd = { version = "0.6.0", optional = true }
2929

3030
[target.'cfg(target_arch = "wasm32")'.dependencies]
31-
ruzstd = "0.8.1"
31+
ruzstd = { version = "0.8.1", optional = true }
3232

3333
[build-dependencies]
34-
capnpc = "0.21.0"
34+
capnpc = { version = "0.21.0", optional = true }
3535

3636
[lib]
3737
name = "runtime_tracing"
3838
path = "src/lib.rs"
39+
40+
[features]
41+
writers_and_readers = ["dep:capnp", "dep:cbor4ii", "dep:fscommon", "dep:zeekstd", "dep:ruzstd", "dep:capnpc"]
42+
# to not sure the default features, a dependency must use: `default-features = false ` !
43+
# https://doc.rust-lang.org/cargo/reference/features.html
44+
default = ["writers_and_readers"]
45+
# default = []

runtime_tracing/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
fn main() {
2+
#[cfg(feature = "writers_and_readers")]
23
::capnpc::CompilerCommand::new().file("src/trace.capnp").run().expect("compiling schema")
34
}

0 commit comments

Comments
 (0)