Skip to content

Commit

Permalink
cli: make aya deps platform specific
Browse files Browse the repository at this point in the history
  • Loading branch information
kckeiks committed May 27, 2024
1 parent 30bd998 commit ecd1a31
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6169,23 +6169,12 @@ dependencies = [
"workspace-hack 0.1.0",
]

[[package]]
name = "lightning-ebpf-common"
version = "0.0.0"
dependencies = [
"aya",
]

[[package]]
name = "lightning-ebpf-service"
version = "0.0.0"
dependencies = [
"anyhow",
"aya",
"aya-log",
"bytes",
"libc",
"lightning-ebpf-common",
"log",
"notify",
"once_cell",
Expand Down
7 changes: 4 additions & 3 deletions core/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ lightning-final-bindings = { path = "../final-bindings" }
lightning-utils = { path = "../utils" }
lightning-tui = { path = "../../etc/tui" }

aya = { git = "https://github.com/aya-rs/aya", rev = "e5d107d", features = ["async_tokio"], optional = true }
aya-log = { git = "https://github.com/aya-rs/aya", rev = "e5d107d", optional = true }
fleek-crypto.workspace = true
resolved-pathbuf.workspace = true
tokio.workspace = true
Expand Down Expand Up @@ -61,9 +59,12 @@ fleek-blake3 = "1.5"
default = []
# Opt-in for compiling services directly inside the node.
services = ["lightning-final-bindings/services"]
ebpf = ["aya", "aya-log", "lightning-ebpf-service/server"]
dev = ["lightning-tui/logger", "tui-logger"]

[target.'cfg(linux)'.dependencies]
aya = { git = "https://github.com/aya-rs/aya", rev = "e5d107d", features = ["async_tokio"], optional = true }
aya-log = { git = "https://github.com/aya-rs/aya", rev = "e5d107d", optional = true }

[[bin]]
name = "lightning-node"
path = "src/main.rs"
8 changes: 5 additions & 3 deletions core/cli/src/commands/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use tracing::debug;
#[cfg(feature = "tui-dev")]
use tracing::log::LevelFilter;

#[cfg(feature = "ebpf")]
#[cfg(target_os = "linux")]
use crate::commands::ebpf;
#[cfg(feature = "ebpf")]
#[cfg(target_os = "linux")]
use crate::commands::ebpf::EbpfCmd;

pub static BIND_PATH: OnceCell<ResolvedPathBuf> = OnceCell::new();
Expand All @@ -23,7 +23,7 @@ pub static PATH_CONFIG: OnceCell<PathConfig> = OnceCell::new();
pub enum AdminSubCmd {
/// Start the Admin TUI.
Tui(TuiCmd),
#[cfg(feature = "ebpf")]
#[cfg(target_os = "linux")]
#[clap(subcommand)]
/// Start the eBPF Control Application.
Ebpf(EbpfCmd),
Expand Down Expand Up @@ -74,6 +74,8 @@ pub async fn exec(cmd: AdminSubCmd) -> Result<()> {
File::create(config.packet_filter.as_path())?;
}

// Todo: maybe we could allow users to configure these values via CLI
// and remove these globals?
PATH_CONFIG.set(config).expect("Not to be initialized yet");
BIND_PATH
.set(
Expand Down
2 changes: 1 addition & 1 deletion core/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub mod admin;
pub mod dev;
#[cfg(feature = "ebpf")]
#[cfg(target_os = "linux")]
pub mod ebpf;
pub mod keys;
pub mod opt;
Expand Down

0 comments on commit ecd1a31

Please sign in to comment.