[package]
name = "cfait"
version = "1.0.3"
edition = "2024"
description = "Powerful, fast and elegant task / TODO manager. (GUI & TUI, CalDAV & local)"
license = "GPL-3.0-or-later"
default-run = "cfait" # Default to TUI when running 'cargo run'
repository = "https://codeberg.org/trougnouf/cfait"
homepage = "https://codeberg.org/trougnouf/cfait"
readme = "README.md"
keywords = ["caldav", "todo", "productivity", "tui", "gui"]
categories = ["command-line-utilities", "gui", "network-programming", "database"]
exclude = [
    # Git and CI related files
    ".github/*",
    ".forgejo/*",
    ".gitignore",
    "packaging/*",
    # License generation tooling
    "about.hbs",
    "about.toml",
    "cliff.toml",
    "RUST_DEPENDENCIES.html",
    "android/*",
    "fastlane/*",
    "com.trougnouf.Cfait.yml",
    "scripts/*",
    "cargo-sources.yml",
    "LICENSES/*",
    "secrets/*"
]

[lib]
crate-type = ["lib", "cdylib"]
name = "cfait"

[dependencies]
# --- COMMON (Core Logic) ---
chrono = { version = "0.4", features = ["serde"] }
icalendar = "0.17"
uuid = { version = "1.19", features = ["v4"] }
tokio = { version = "1", features = ["full"] }
camino = "1.0"
libdav = "0.10"
http = "1.4"
hyper-util = { version = "0.1", features = ["client", "client-legacy", "http1", "tokio"] }
hyper-rustls = { version = "0.27", features = ["native-tokio"] }
tower-http = { version = "0.6", features = ["auth"] }
rustls = { version = "0.23", default-features = false, features = ["std", "tls12"] }
serde = { version = "1.0", features = ["derive"] }
toml = "1.0"
directories = "6.0"
anyhow = "1.0"
rrule = "0.14"
serde_json = "1.0"
# Single Source of Truth internationalization support (reads JSON locales)
isolang = { version = "2.4.0", features = ["local_names", "english_names"] }
rust-i18n = "4"
sys-locale = "0.3"
rustls-native-certs = "0.8"
futures = "0.3"
roxmltree = "0.21"
fs2 = "0.4"
digest_auth = "0.3"
base64 = "0.22"
tower = { version = "0.5", features = ["util"] }
tower-service = "0.3" # Explicitly add tower-service for the trait
tower-layer = "0.3"   # And tower-layer for the Layer trait
notify-rust = "4"
strum = { version = "0.28", features = ["derive"] }
unicode-width = "0.2"

# --- ANDROID / INTEROP ---
uniffi = { version = "0.31", features = ["tokio", "build", "cli"], optional = true }
uniffi_bindgen = { version = "0.31",  optional = true }
uniffi_meta = "0.31"

# --- LOGGING ---
log = "0.4"
simplelog = "0.12"
percent-encoding = "2.3"


# --- TUI ONLY (Optional) ---
ratatui = { version = "0.30", optional = true }
crossterm = { version = "0.29", optional = true }
rpassword = { version = "7.4", optional = true }
tui-markdown = { version = "0.3", optional = true }


# --- GUI ONLY (Future) ---
iced = { version = "0.14.0", features = ["tokio", "svg", "advanced", "image"], optional = true }
iced_aw = { version = "0.14", features = ["color_picker"], optional = true }
rfd = { version = "0.17", optional = true, default-features = false, features = ["xdg-portal"] }
fastrand = "2.3"
once_cell = "1.18"

[build-dependencies]
winresource = "0.1" # (Keep existing)

[target.'cfg(target_os = "windows")'.dependencies]
os_info = "3"
windows-native-keyring-store = "1.0.0"

# --- ANDROID SPECIFIC ---
[target.'cfg(target_os = "android")'.dependencies]
# Use webpki-roots instead of platform-verifier to avoid JNI/Context complexity
webpki-roots = "1.0"
android_logger = "0.15"
log = "0.4"
zip = "8.1"
android-native-keyring-store = "1.0.0"
jni = "0.22"
ndk-context = "0.1"

[dev-dependencies]
mockito = "1.7" # For mocking the HTTP server
tokio = { version = "1", features = ["full"] }
uuid = { version = "1.19", features = ["v4"] }
serial_test = "3.0"
uniffi_meta = "0.31"
# Required to run the bindgen binary

[features]
default = ["tui"]
tui = ["dep:ratatui", "dep:crossterm", "dep:rpassword", "dep:tui-markdown"]
gui = ["dep:iced", "dep:iced_aw", "dep:rfd"]
mobile = ["dep:uniffi", "dep:uniffi_bindgen"]
test_hooks = []



[[bin]]
name = "cfait"
path = "src/bin/tui.rs"
required-features = ["tui"]

[[bin]]
name = "cfait-gui"
path = "src/bin/gui.rs"
required-features = ["gui"]

# Generate Android bindings
[[bin]]
name = "uniffi-bindgen"
path = "src/bin/uniffi-bindgen.rs"
required-features = ["mobile"]

[[bin]]
name = "inspect_bindgen"
path = "tools/inspect_bindgen.rs"
required-features = ["mobile"]

[profile.release]
strip = true        # Removes symbols/debuginfo deterministically.
lto = true          # Link Time Optimization (removes dead code across crates).
codegen-units = 1   # Slower compile, but smaller binary.

[package.metadata.deb]
maintainer = "Benoit Brummer (Trougnouf) <trougnouf@disroot.org>"
copyright = "2026, Benoit Brummer (Trougnouf)"
license-file = ["LICENSE", "4"]
extended-description = """
Cfait is a powerful yet simple tasks / TODO CalDAV client. (TUI and GUI)
"""
depends = "$auto, libsecret-1-0, libvulkan1"
section = "utils"
priority = "optional"
assets = [
    ["target/release/cfait", "usr/bin/", "755"],
    ["target/release/cfait-gui", "usr/bin/cfait-gui", "755"],
    ["assets/cfait.desktop", "usr/share/applications/", "644"],
    ["assets/cfait.svg", "usr/share/icons/hicolor/scalable/apps/cfait.svg", "644"],
]

[[package.metadata.release.pre-release-replacements]]
file = "packaging/arch/PKGBUILD"
search = "pkgver=[0-9\\.]+"
replace = "pkgver={{version}}"

[package.metadata.release]
# Run this script before committing the release
pre-release-hook = ["python3", "scripts/prepare_release.py"]
# Ensure the Fastlane stuff is added to the git commit

[package.metadata.android]
# This must match (Major * 10000 + Minor * 100 + Patch)
version_code = 10003

# --- Keyring ecosystem for secure password storage ---
[dependencies.keyring-core]
version = "1.0.0"

[target.'cfg(target_os = "macos")'.dependencies]
apple-native-keyring-store = { version = "1.0.0", features = ["keychain"] }

[target.'cfg(target_os = "linux")'.dependencies]
oo7 = "0.6"
linux-keyutils-keyring-store = "1.0.0"
