# AuroraView Workspace
# Rust-powered WebView for Python apps & DCC embedding

[workspace]
resolver = "2"

[workspace.package]
version = "0.3.25" # x-release-please-version
edition = "2021"
# home 0.5.12+ requires Rust 1.88+, using 1.90 (current stable)
rust-version = "1.90"
authors = ["Hal Long <hal.long@outlook.com>"]
license = "MIT"
repository = "https://github.com/loonghao/auroraview"

# Root package - Core library with optional Python bindings
[package]
name = "auroraview"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
description = "AuroraView: Rust-powered WebView for Python apps & DCC embedding"
keywords = ["webview", "rust", "python", "wry", "pyo3", "dcc"]
categories = ["gui", "multimedia", "graphics"]
readme = "README.md"

[lib]
name = "_core"
crate-type = ["cdylib", "rlib"]


[dependencies]
# Core library (with wry-builder for shared WebView building logic)
auroraview-core = { path = "crates/auroraview-core", features = ["wry-builder"] }

# Signal system (Qt-style signals/slots with Python bindings)
aurora-signals = { path = "crates/aurora-signals", features = ["python"] }

# PyO3 for Python bindings (optional)
# multiple-pymethods: Allow splitting #[pymethods] across multiple files
# Note: abi3 feature is controlled separately via features section
pyo3 = { version = "0.27.2", features = ["multiple-pymethods"], optional = true }

# Wry for WebView
wry = "0.53.5"
tao = "0.34.5"

# Window handle for DCC integration
raw-window-handle = "0.6"

# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
simd-json = "0.17"

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

# Signal handling (Ctrl+C)
ctrlc = "3.4"

# System tray support
tray-icon = "0.19"
muda = "0.16"

# Error handling
anyhow = "1.0"
thiserror = "2.0"

# Logging
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

# URL handling
url = "2.5"

# Path normalization
path-clean = "1.0"

# MIME type detection
mime_guess = "2.0"

# Thread safety
parking_lot = "0.12"
once_cell = "1.20"

# Resource cleanup
scopeguard = "1.2"

# IPC communication
crossbeam-channel = "0.5"
flume = "0.12"
dashmap = "6.1"
ipc-channel = { version = "0.20", optional = true }
ipckit = "0.1"

# CPU detection
num_cpus = "1.16"

# Window utilities
active-win-pos-rs = "0.9"

# File dialogs
rfd = "0.16"

# Open URLs/files in system default application
open = "5.3"

# Image processing for window icon (minimal features for PNG loading)
image = { version = "0.24", default-features = false, features = ["png"] }

# Service discovery
mdns-sd = "0.17"
warp = { version = "0.4", features = ["server"] }
hyper = { version = "1.8", features = ["full"] }
hyper-util = { version = "0.1", features = ["full"] }

# Template engine for JS code generation
askama = { version = "0.14", optional = true }

# Regex for URL handling
regex = { version = "1.11", optional = true }
urlencoding = { version = "2.1", optional = true }

# Embed static assets
rust-embed = { version = "8.5", optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.62", features = ["Win32_Foundation", "Win32_UI_WindowsAndMessaging", "Win32_System_Com", "Win32_Graphics_Gdi"] }
winapi = "0.3.9"
webview2 = { version = "0.1.4", optional = true }
webview2-com = { version = "0.38", optional = true }

[dev-dependencies]
criterion = "0.8"
tempfile = "3.14"
rstest = "0.26"
test-case = "3.3"
proptest = "1.5"
mockall = "0.14"
serial_test = "3.2"
reqwest = { version = "0.12", features = ["json"] }

[profile.release]
opt-level = 3
lto = true
codegen-units = 1
strip = true

[profile.dev]
opt-level = 0

[features]
# Default: Core features without Python bindings (for CLI usage)
default = ["threaded-ipc", "wry-backend", "templates", "url-utils"]

# Python bindings (for Python wheel)
python-bindings = ["pyo3", "url-utils"]

# ABI3 stable ABI for Python 3.8+ (single wheel for all Python 3.8+ versions)
# For Python 3.7, use python-bindings without this feature
abi3-py38 = ["pyo3/abi3-py38"]

# Enable PyO3 auto-initialize in test builds
test-helpers = ["pyo3/auto-initialize"]

# Build as a true Python extension module (for wheels)
ext-module = ["pyo3/extension-module"]

# Rendering backend
wry-backend = []
win-webview2 = ["dep:webview2"]

# IPC backend
threaded-ipc = []
process-ipc = ["ipc-channel"]

# Templates for JS generation
templates = ["askama"]

# URL handling utilities
url-utils = ["regex", "urlencoding"]

# Embed static assets
embed-assets = ["rust-embed"]

# Performance features
performance-monitoring = []
ipc-batching = []

# Integration tests (in tests/rust/ directory)
[[test]]
name = "protocol_handlers_integration"
path = "tests/rust/protocol_handlers_integration_tests.rs"

[[test]]
name = "standalone_integration"
path = "tests/rust/standalone_integration_tests.rs"

[[test]]
name = "config_integration"
path = "tests/rust/config_integration_tests.rs"

[[test]]
name = "ipc_json_integration"
path = "tests/rust/ipc_json_integration_tests.rs"

[[test]]
name = "ipc_batch_integration"
path = "tests/rust/ipc_batch_integration_tests.rs"
required-features = ["python-bindings"]

[[test]]
name = "lifecycle_integration"
path = "tests/rust/lifecycle_integration_tests.rs"

[[test]]
name = "timer_integration"
path = "tests/rust/timer_integration_tests.rs"

[[test]]
name = "window_utils_integration"
path = "tests/rust/window_utils_integration_tests.rs"
required-features = ["python-bindings"]

[[test]]
name = "protocol_integration"
path = "tests/rust/protocol_integration_tests.rs"

[[test]]
name = "file_protocol_integration"
path = "tests/rust/file_protocol_integration_tests.rs"

[[test]]
name = "ipc_message_queue_integration"
path = "tests/rust/ipc_message_queue_integration_tests.rs"

[[test]]
name = "port_allocator_integration"
path = "tests/rust/port_allocator_integration_tests.rs"

[[test]]
name = "mdns_integration"
path = "tests/rust/mdns_integration_tests.rs"

[[test]]
name = "http_discovery_integration"
path = "tests/rust/http_discovery_integration_tests.rs"

# Benchmarks
[[bench]]
name = "ipc_bench"
harness = false

