[workspace]
members = ["petname-macros"]

[workspace.package]
authors = ["Gavin Panella <gavin@allenap.me>"]
edition = "2021"
license = "Apache-2.0"
version = "3.0.0-beta.1"
repository = "https://github.com/allenap/rust-petname"

[package]
name = "petname"
categories = ["command-line-utilities", "no-std"]
description = "Generate human readable random names. Usable as a library and from the command-line."
keywords = ["pet", "name", "rand", "random", "generator"]
readme = "README.md"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true

[lib]
name = "petname"
path = "src/lib.rs"

[[bin]]
doc = false
name = "petname"
path = "src/main.rs"
required-features = ["clap", "default-rng", "default-words"]

[features]
# `clap` is NOT required for the library but is required for the command-line
# binary. Omitting it from the `default` list means that it must be specified
# _every time_ you want to build the binary, so it's here as a convenience.
default = ["clap", "default-rng", "default-words", "macros"]
# Allows generating petnames with thread rng.
default-rng = ["rand/thread_rng"]
# Allows the default word lists to be used.
default-words = ["macros"]
# Provides the `petnames!` proc macro.
macros = ["dep:petname-macros"]

[dev-dependencies]
anyhow = "1"
tempdir = "0.3"
rand_core = "0.10"

[dependencies]
petname-macros = { version = "3.0.0-beta.1", path = "petname-macros", optional = true }
clap = { version = "4", features = ["cargo", "derive"], optional = true }
rand = { version = "0.10", default-features = false }

[package.metadata.docs.rs]
# Limit docs.rs builds to a single tier one target, because they're identical on
# all. https://blog.rust-lang.org/2020/03/15/docs-rs-opt-into-fewer-targets.html
targets = ["x86_64-unknown-linux-gnu"]

# Follow some of the advice from https://github.com/johnthagen/min-sized-rust on
# how to minimise the compiled (release build) binary size. At the time of
# writing this reduces the binary from ~6MiB to ~2MiB.
[profile.release]
lto = true
opt-level = "z"
strip = true
