[package]
name = "herolib-virt"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
description = "Virtualization and container management for herolib (buildah, nerdctl, kubernetes)"

[dependencies]
# Core dependencies
anyhow = "1.0"
thiserror = "2.0"
tempfile = "3.23"
dirs = "6.0"
glob = "0.3"
libc = "0.2"
reqwest = { version = "0.12", default-features = false, features = ["json", "blocking", "rustls-tls-webpki-roots"] }
regex = "1.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
log = "0.4"
url = "2.4"
uuid = { version = "1.18", features = ["v4", "serde"] }
base64 = "0.22"
once_cell = "1.21"
which = "6.0"

# Hyper dependencies for Cloud Hypervisor
hyper = { version = "0.14", features = ["client", "http1", "http2"] }
hyperlocal = "0.8"

# Async runtime
tokio = { version = "1.48", features = ["full"] }

# Rhai scripting support
rhai = { version = "1.23.6", features = ["sync"], optional = true }

# Internal dependencies (os and process modules are needed by virt)
herolib-os = { workspace = true, default-features = true }
herolib-core = { workspace = true, default-features = true }

# Kubernetes dependencies (optional)
kube = { version = "2.0", default-features = false, features = ["client", "config", "derive", "rustls-tls", "webpki-roots"], optional = true }
k8s-openapi = { version = "0.26", features = ["v1_32"], optional = true }
tokio-retry = { version = "0.3", optional = true }
governor = { version = "0.10", optional = true }
tower = { version = "0.5", features = ["timeout", "limit"], optional = true }

# Platform-specific dependencies
[target.'cfg(target_os = "linux")'.dependencies]
nix = "0.30"
virtiofsd = "1.13"

[target.'cfg(unix)'.dependencies]
nix = "0.30"

[target.'cfg(windows)'.dependencies]
windows = { version = "0.62", features = [
    "Win32_Foundation",
    "Win32_System_Threading",
    "Win32_Storage_FileSystem",
] }

[dev-dependencies]
tempfile = "3.5"
lazy_static = "1.4"
tokio-test = "0.4"
env_logger = "0.11"

[[example]]
name = "01_basic_operations"
path = "examples/rust/kubernetes/01_basic_operations.rs"
required-features = ["kubernetes"]

[[example]]
name = "02_registry_deployment"
path = "examples/rust/kubernetes/02_registry_deployment.rs"
required-features = ["kubernetes"]

[[example]]
name = "03_registry_build_and_push"
path = "examples/rust/kubernetes/03_registry_build_and_push.rs"
required-features = ["kubernetes"]

[features]
default = ["rhai"]
rhai = ["dep:rhai"]
kubernetes = ["dep:kube", "dep:k8s-openapi", "dep:tokio-retry", "dep:governor", "dep:tower"]
full = ["rhai", "kubernetes"]
