# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Auto-Generated by cargo-ebuild 0.5.4

EAPI=8

CRATES="
	addr2line-0.17.0
	adler-1.0.2
	aho-corasick-0.7.19
	ansi_term-0.12.1
	anyhow-1.0.64
	async-broadcast-0.4.1
	async-channel-1.7.1
	async-executor-1.4.1
	async-io-1.9.0
	async-lock-2.5.0
	async-priority-channel-0.1.0
	async-recursion-0.3.2
	async-recursion-1.0.0
	async-stream-0.3.3
	async-stream-impl-0.3.3
	async-task-4.3.0
	async-trait-0.1.57
	atomic-take-1.0.0
	atty-0.2.14
	autocfg-1.1.0
	axum-0.5.15
	axum-core-0.2.9
	backtrace-0.3.66
	base64-0.13.0
	bitflags-1.3.2
	block-0.1.6
	bstr-0.2.17
	bstr-1.0.1
	btoi-0.4.2
	byteorder-1.4.3
	bytes-1.2.1
	cache-padded-1.2.0
	cc-1.0.73
	cfg-if-0.1.10
	cfg-if-1.0.0
	clap-3.2.20
	clap_lex-0.2.4
	clearscreen-2.0.0
	command-group-2.0.1
	concurrent-queue-1.2.4
	console-api-0.4.0
	console-subscriber-0.1.8
	crc32fast-1.3.2
	crossbeam-channel-0.5.6
	crossbeam-utils-0.8.11
	dashmap-5.4.0
	derivative-2.2.0
	dirs-2.0.2
	dirs-4.0.0
	dirs-next-2.0.0
	dirs-sys-0.3.7
	dirs-sys-next-0.1.2
	either-1.8.0
	embed-resource-1.7.2
	enumflags2-0.7.5
	enumflags2_derive-0.7.4
	event-listener-2.5.3
	fastrand-1.8.0
	filetime-0.2.17
	flate2-1.0.24
	fnv-1.0.7
	fsevent-sys-4.1.0
	futures-0.3.25
	futures-channel-0.3.25
	futures-core-0.3.25
	futures-executor-0.3.25
	futures-io-0.3.25
	futures-lite-1.12.0
	futures-macro-0.3.25
	futures-sink-0.3.25
	futures-task-0.3.25
	futures-util-0.3.25
	getrandom-0.1.16
	getrandom-0.2.7
	gimli-0.26.2
	git-actor-0.16.0
	git-config-0.14.0
	git-config-value-0.10.0
	git-date-0.3.1
	git-features-0.26.0
	git-glob-0.5.1
	git-hash-0.10.1
	git-lock-3.0.0
	git-object-0.25.0
	git-path-0.7.0
	git-ref-0.22.0
	git-sec-0.6.0
	git-tempfile-3.0.0
	git-validate-0.7.1
	globset-0.4.9
	h2-0.3.14
	hashbrown-0.12.3
	hdrhistogram-7.5.1
	heck-0.3.3
	hermit-abi-0.1.19
	hex-0.4.3
	http-0.2.8
	http-body-0.4.5
	http-range-header-0.3.0
	httparse-1.8.0
	httpdate-1.0.2
	humantime-2.1.0
	hyper-0.14.20
	hyper-timeout-0.4.1
	ignore-0.4.18
	indexmap-1.9.1
	inotify-0.9.6
	inotify-sys-0.1.5
	instant-0.1.12
	is_ci-1.1.1
	itertools-0.10.3
	itoa-1.0.3
	kqueue-1.0.6
	kqueue-sys-1.0.3
	lazy_static-1.4.0
	libc-0.2.139
	libmimalloc-sys-0.1.25
	lock_api-0.4.8
	log-0.4.17
	mac-notification-sys-0.5.6
	malloc_buf-0.0.6
	matchers-0.1.0
	matchit-0.5.0
	memchr-2.5.0
	memmap2-0.5.7
	memoffset-0.6.5
	memoffset-0.7.1
	miette-5.3.0
	miette-derive-5.3.0
	mimalloc-0.1.29
	mime-0.3.16
	minimal-lexical-0.2.1
	miniz_oxide-0.5.4
	mio-0.8.4
	nix-0.23.1
	nix-0.26.2
	nom-5.1.2
	nom-7.1.1
	normalize-path-0.2.0
	notify-5.0.0
	notify-rust-4.5.8
	num-traits-0.2.15
	num_cpus-1.13.1
	num_threads-0.1.6
	objc-0.2.7
	objc-foundation-0.1.1
	objc_id-0.1.1
	object-0.29.0
	once_cell-1.14.0
	ordered-stream-0.0.1
	os_str_bytes-6.3.0
	owo-colors-3.5.0
	parking-2.0.0
	parking_lot-0.12.1
	parking_lot_core-0.9.3
	percent-encoding-2.1.0
	phf-0.8.0
	phf_codegen-0.8.0
	phf_generator-0.8.0
	phf_shared-0.8.0
	pin-project-1.0.12
	pin-project-internal-1.0.12
	pin-project-lite-0.2.9
	pin-utils-0.1.0
	polling-2.3.0
	ppv-lite86-0.2.16
	proc-macro-crate-1.2.1
	proc-macro2-1.0.43
	prost-0.11.0
	prost-derive-0.11.0
	prost-types-0.11.1
	quick-error-2.0.1
	quote-1.0.21
	rand-0.7.3
	rand-0.8.5
	rand_chacha-0.2.2
	rand_chacha-0.3.1
	rand_core-0.5.1
	rand_core-0.6.3
	rand_hc-0.2.0
	rand_pcg-0.2.1
	redox_syscall-0.2.16
	redox_users-0.4.3
	regex-1.6.0
	regex-automata-0.1.10
	regex-syntax-0.6.27
	remove_dir_all-0.5.3
	rustc-demangle-0.1.21
	rustc_version-0.4.0
	ryu-1.0.11
	same-file-1.0.6
	scopeguard-1.1.0
	semver-1.0.13
	serde-1.0.144
	serde_derive-1.0.144
	serde_json-1.0.85
	serde_repr-0.1.9
	sha1-0.6.1
	sha1_smol-1.0.0
	sharded-slab-0.1.4
	signal-hook-0.3.14
	signal-hook-registry-1.4.0
	siphasher-0.3.10
	slab-0.4.7
	smallvec-1.9.0
	smawk-0.3.1
	socket2-0.4.7
	static_assertions-1.1.0
	strsim-0.10.0
	strum-0.22.0
	strum_macros-0.22.0
	supports-color-1.3.0
	supports-hyperlinks-1.2.0
	supports-unicode-1.0.2
	syn-1.0.99
	sync_wrapper-0.1.1
	tempfile-3.3.0
	termcolor-1.1.3
	terminal_size-0.1.17
	terminfo-0.7.3
	textwrap-0.15.0
	thiserror-1.0.38
	thiserror-impl-1.0.38
	thread_local-1.1.4
	time-0.3.14
	time-macros-0.2.4
	tokio-1.24.2
	tokio-io-timeout-1.2.0
	tokio-macros-1.8.0
	tokio-stream-0.1.9
	tokio-util-0.7.3
	toml-0.5.9
	tonic-0.8.0
	tower-0.4.13
	tower-http-0.3.4
	tower-layer-0.3.1
	tower-service-0.3.2
	tracing-0.1.36
	tracing-attributes-0.1.22
	tracing-core-0.1.29
	tracing-futures-0.2.5
	tracing-log-0.1.3
	tracing-serde-0.1.3
	tracing-subscriber-0.3.15
	try-lock-0.2.3
	uds_windows-1.0.2
	unicase-2.6.0
	unicode-bom-1.1.4
	unicode-ident-1.0.3
	unicode-linebreak-0.1.2
	unicode-segmentation-1.9.0
	unicode-width-0.1.9
	valuable-0.1.0
	version_check-0.9.4
	vswhom-0.1.0
	vswhom-sys-0.1.1
	waker-fn-1.1.0
	walkdir-2.3.2
	want-0.3.0
	wasi-0.9.0+wasi-snapshot-preview1
	wasi-0.11.0+wasi-snapshot-preview1
	wepoll-ffi-0.1.2
	which-4.3.0
	winapi-0.3.9
	winapi-i686-pc-windows-gnu-0.4.0
	winapi-util-0.1.5
	winapi-x86_64-pc-windows-gnu-0.4.0
	windows-0.24.0
	windows-0.40.0
	windows-sys-0.36.1
	windows-sys-0.42.0
	windows_aarch64_gnullvm-0.40.0
	windows_aarch64_gnullvm-0.42.0
	windows_aarch64_msvc-0.36.1
	windows_aarch64_msvc-0.40.0
	windows_aarch64_msvc-0.42.0
	windows_i686_gnu-0.24.0
	windows_i686_gnu-0.36.1
	windows_i686_gnu-0.40.0
	windows_i686_gnu-0.42.0
	windows_i686_msvc-0.24.0
	windows_i686_msvc-0.36.1
	windows_i686_msvc-0.40.0
	windows_i686_msvc-0.42.0
	windows_x86_64_gnu-0.24.0
	windows_x86_64_gnu-0.36.1
	windows_x86_64_gnu-0.40.0
	windows_x86_64_gnu-0.42.0
	windows_x86_64_gnullvm-0.40.0
	windows_x86_64_gnullvm-0.42.0
	windows_x86_64_msvc-0.24.0
	windows_x86_64_msvc-0.36.1
	windows_x86_64_msvc-0.40.0
	windows_x86_64_msvc-0.42.0
	winreg-0.10.1
	winrt-notification-0.5.1
	xml-rs-0.8.4
	zbus-2.3.2
	zbus_macros-2.3.2
	zbus_names-2.2.0
	zvariant-3.6.0
	zvariant_derive-3.6.0
"

inherit cargo

DESCRIPTION="Executes commands in response to file modifications"
HOMEPAGE="https://github.com/watchexec/watchexec"
SRC_URI="https://github.com/watchexec/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" $(cargo_crate_uris)"

LICENSE="Apache-2.0 || ( Artistic-2 CC0-1.0 ) BSD ISC MIT Unicode-DFS-2016 WTFPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
# Prevent portage from trying to fetch bunch of *.crate from mirror despite they are not mirrored.
RESTRICT="mirror"

DOCS=( crates/cli/README.md )
HTML_DOCS=( doc/watchexec.1.html )

# rust does not use *FLAGS from make.conf, silence portage warning
# update with proper path to binaries this crate installs, omit leading /
QA_FLAGS_IGNORED="usr/bin/${PN}"

src_compile() {
	cargo_src_compile --manifest-path=crates/cli/Cargo.toml
}

src_test() {
	cargo_src_test --manifest-path crates/lib/Cargo.toml --lib
	cargo_src_test --manifest-path crates/cli/Cargo.toml
}

src_install() {
	cargo_src_install --path "${S}"/crates/cli

	einstalldocs
	doman doc/watchexec.1

	insinto /usr/share/zsh/site-functions
	newins completions/zsh _watchexec
}
