[package]
name = "abootimg-oxide"
version.workspace = true
authors.workspace = true
edition = "2021"
rust-version = "1.86.0" # Same as Nixpkgs 25.05, a sane default
description = "Android boot image (boot.img) parser"
readme = "README.md"
repository.workspace = true
license.workspace = true
categories = ["parser-implementations", "no-std"]

[dependencies]
binrw = { version = "0.15.0", default-features = false, features = ["verbose-backtrace"] }
document-features = "0.2.12"
digest = { version = "0.10.7", optional = true }

[dev-dependencies]
expect-test-bytes = "0.1.0"
sha1.workspace = true
sha2.workspace = true
hex_fmt.workspace = true

[lints]
workspace = true

[features]
default = ["std"]

## Enables [`binrw`](mod@binrw)'s `std` feature. See its documentation for more. Disabling this feature will make this crate `no_std`-compatible, while still requiring `alloc`.
std = ["binrw/std"]

## Provide the [`HeaderV0::compute_hash_digest`] helper
hash = ["dep:digest"]

[patch.crates-io]
# fix doc_cfg so abootimg-oxide's docs can build on docs.rs
generic-array = { git = "https://github.com/axelkar/generic-array", rev = "0.14.7-doc_cfg-fix" }

[package.metadata.docs.rs]
all-features = true
# enable unstable features in the documentation
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[[example]]
name = "extract-kernel"
required-features = ["std"]

[[example]]
name = "compute-hash-digest"
required-features = ["std", "hash"]
doc-scrape-examples = true # Make sure that the examples are scraped

[workspace]
members = ["mkbootimg", "unpack_bootimg"]
resolver = "2"

[workspace.package]
version = "0.3.0"
authors = ["Axel Karjalainen <axel@axka.fi>"]
repository = "https://github.com/axelkar/abootimg-oxide"
license = "MIT OR Apache-2.0"

[workspace.dependencies]
clap = { version = "4.5.16", features = ["derive"] }
hex_fmt = "0.3.0"
sha1 = "0.10.6"
sha2 = "0.10.9"

[workspace.lints.rust]
missing_docs = "warn"

[workspace.lints.clippy]
pedantic = "warn"
allow_attributes = "warn"
allow_attributes_without_reason = "warn"
should_panic_without_expect = "warn"
str_to_string = "warn"
implicit_clone = "warn"
