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

# Autogenerated by pycargoebuild 0.15.1

# update using this command:
# file --mime-type --no-pad tombi/{crates/*,xtask,toml-test,rust/*,extensions/*,editors/zed} |
# awk -F ': ' '/inode\/directory/ { print $1 }' |
# xargs pycargoebuild -i <filename.ebuild>

# when updating, make sure to check the root Cargo.toml, and check the dirctories we're passing on into the `file`
# command, are also there in Cargo.toml's default-members too, and none of them is missing

EAPI=8

RUST_MIN_VER="1.88.0"

CRATES="
	addr2line@0.24.2
	addr@0.15.6
	adler2@2.0.1
	aead@0.3.2
	aes-gcm@0.8.0
	aes-soft@0.6.4
	aes@0.6.0
	aes@0.8.4
	aesni@0.10.0
	ahash@0.8.12
	aho-corasick@1.1.3
	allocator-api2@0.2.21
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	anstream@0.6.20
	anstyle-parse@0.2.7
	anstyle-query@1.1.4
	anstyle-wincon@3.0.10
	anstyle@1.0.11
	anyhow@1.0.98
	arbitrary@1.4.1
	async-channel@1.9.0
	async-channel@2.5.0
	async-executor@1.13.2
	async-global-executor@2.4.1
	async-io@2.5.0
	async-lock@3.4.1
	async-std@1.13.1
	async-task@4.7.1
	async-trait@0.1.88
	atomic-waker@1.1.2
	atomic@0.6.1
	auditable-serde@0.8.0
	auto_impl@1.3.0
	autocfg@1.5.0
	backtrace@0.3.75
	base-x@0.2.11
	base64@0.13.1
	base64@0.22.1
	bit-set@0.5.3
	bit-vec@0.6.3
	bitflags@1.3.2
	bitflags@2.11.0
	block-buffer@0.10.4
	block-buffer@0.9.0
	blocking@1.6.2
	boxcar@0.2.13
	bstr@1.12.0
	bumpalo@3.19.0
	bytemuck@1.23.1
	byteorder@1.5.0
	bytes@0.5.6
	bytes@1.11.1
	bzip2-sys@0.1.13+1.0.8
	bzip2@0.5.2
	cc@1.2.32
	cfg-if@1.0.1
	cfg_aliases@0.2.1
	chrono@0.4.41
	cipher@0.2.5
	cipher@0.4.4
	clap@4.5.43
	clap_builder@4.5.43
	clap_complete@4.5.58
	clap_derive@4.5.41
	clap_lex@0.7.5
	colorchoice@1.0.4
	concurrent-queue@2.5.0
	console_error_panic_hook@0.1.7
	const_fn@0.4.11
	constant_time_eq@0.3.1
	convert_case@0.6.0
	cookie@0.14.4
	core-foundation-sys@0.8.7
	core-foundation@0.10.0
	countme@3.0.1
	cpufeatures@0.2.17
	cpuid-bool@0.2.0
	crc-catalog@2.4.0
	crc32fast@1.5.0
	crc@3.3.0
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.21
	crypto-common@0.1.6
	crypto-mac@0.10.0
	ctr@0.6.0
	curl-sys@0.4.82+curl-8.14.1
	curl@0.4.48
	dashmap@5.5.3
	deflate64@0.1.9
	deranged@0.5.5
	derive_arbitrary@1.4.1
	diff@0.1.13
	digest@0.10.7
	digest@0.9.0
	dirs-sys@0.5.0
	dirs@6.0.0
	discard@1.0.4
	displaydoc@0.2.5
	drop_bomb@0.1.5
	dyn-clone@1.0.20
	either@1.15.0
	email_address@0.2.9
	encoding_rs@0.8.35
	env_filter@0.1.4
	env_logger@0.11.8
	equivalent@1.0.2
	errno@0.3.13
	event-listener-strategy@0.5.4
	event-listener@2.5.3
	event-listener@5.4.1
	fancy-regex@0.13.0
	fast-glob@0.3.3
	fastrand@1.9.0
	fastrand@2.3.0
	filetime@0.2.27
	flate2@1.1.2
	flume@0.9.2
	fnv@1.0.7
	foldhash@0.1.5
	form_urlencoded@1.2.1
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-executor@0.3.31
	futures-io@0.3.31
	futures-lite@1.13.0
	futures-lite@2.6.1
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-timer@3.0.3
	futures-util@0.3.31
	futures@0.3.31
	generic-array@0.14.7
	getrandom@0.1.16
	getrandom@0.2.16
	getrandom@0.3.3
	ghash@0.3.1
	gimli@0.31.1
	glob@0.3.2
	globset@0.4.16
	gloo-net@0.6.0
	gloo-timers@0.3.0
	gloo-utils@0.2.0
	hashbrown@0.14.5
	hashbrown@0.15.5
	heck@0.5.0
	hermit-abi@0.5.2
	hkdf@0.10.0
	hmac@0.10.1
	hmac@0.12.1
	http-body-util@0.1.3
	http-body@1.0.1
	http-client@6.5.3
	http-types@2.12.0
	http@0.2.12
	http@1.3.1
	httparse@1.10.1
	hyper-rustls@0.27.7
	hyper-util@0.1.16
	hyper@1.6.0
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.63
	icu_collections@2.0.0
	icu_locale_core@2.0.0
	icu_normalizer@2.0.0
	icu_normalizer_data@2.0.0
	icu_properties@2.0.1
	icu_properties_data@2.0.1
	icu_provider@2.0.0
	id-arena@2.2.1
	idna@1.0.3
	idna_adapter@1.2.1
	ignore@0.4.23
	indexmap@2.10.0
	infer@0.2.3
	inout@0.1.4
	instant@0.1.13
	io-uring@0.7.9
	ipnet@2.11.0
	iri-string@0.7.8
	is_terminal_polyfill@1.70.1
	isahc@0.9.14
	itertools@0.13.0
	itertools@0.14.0
	itoa@1.0.15
	jiff-static@0.2.15
	jiff@0.2.15
	jobserver@0.1.33
	js-sys@0.3.77
	kv-log-macro@1.0.7
	leb128fmt@0.1.0
	libc@0.2.174
	libnghttp2-sys@0.1.11+1.64.0
	libredox@0.1.9
	libz-sys@1.1.22
	linux-raw-sys@0.9.4
	litemap@0.8.0
	lock_api@0.4.13
	log@0.4.27
	lru-slab@0.1.2
	lsp-types@0.94.1
	lzma-rs@0.3.0
	lzma-sys@0.1.20
	md-5@0.10.6
	memchr@2.7.5
	mime@0.3.17
	mime_guess@2.0.5
	miniz_oxide@0.8.9
	mio@1.0.4
	nu-ansi-term@0.50.1
	num-conv@0.2.0
	num-traits@0.2.19
	object@0.36.7
	once_cell@1.21.3
	once_cell_polyfill@1.70.1
	opaque-debug@0.3.1
	openssl-probe@0.1.6
	openssl-sys@0.9.112
	option-ext@0.2.0
	parking@2.2.1
	parking_lot_core@0.9.11
	pbkdf2@0.12.2
	pep440_rs@0.7.3
	pep508_rs@0.9.2
	percent-encoding@2.3.1
	pin-project-internal@1.1.10
	pin-project-lite@0.2.16
	pin-project@1.1.10
	pin-utils@0.1.0
	piper@0.2.4
	pkg-config@0.3.32
	polling@3.10.0
	polyval@0.4.5
	portable-atomic-util@0.2.5
	portable-atomic@1.13.1
	potential_utf@0.1.2
	powerfmt@0.2.0
	ppv-lite86@0.2.21
	pretty_assertions@1.4.1
	prettyplease@0.2.37
	proc-macro-crate@3.3.0
	proc-macro-hack@0.5.20+deprecated
	proc-macro2@1.0.95
	psl-types@2.0.11
	psl@2.1.199
	quinn-proto@0.11.14
	quinn-udp@0.5.13
	quinn@0.11.8
	quote@1.0.40
	r-efi@5.3.0
	rand@0.7.3
	rand@0.8.5
	rand@0.9.3
	rand_chacha@0.2.2
	rand_chacha@0.3.1
	rand_chacha@0.9.0
	rand_core@0.5.1
	rand_core@0.6.4
	rand_core@0.9.3
	rand_hc@0.2.0
	rayon-core@1.12.1
	rayon@1.10.0
	redox_syscall@0.5.17
	redox_users@0.5.2
	ref-cast-impl@1.0.24
	ref-cast@1.0.24
	regex-automata@0.4.13
	regex-syntax@0.8.5
	regex@1.12.2
	relative-path@1.9.3
	reqwest@0.12.22
	ring@0.17.14
	rstest@0.25.0
	rstest_macros@0.25.0
	rustc-demangle@0.1.26
	rustc-hash@2.1.1
	rustc_version@0.2.3
	rustc_version@0.4.1
	rustix@1.0.8
	rustls-native-certs@0.8.1
	rustls-pki-types@1.12.0
	rustls-webpki@0.103.13
	rustls@0.23.31
	rustversion@1.0.22
	ryu@1.0.20
	same-file@1.0.6
	schannel@0.1.29
	schemars@1.0.4
	schemars_derive@1.0.4
	scopeguard@1.2.0
	security-framework-sys@2.17.0
	security-framework@3.7.0
	semver-parser@0.7.0
	semver@0.9.0
	semver@1.0.26
	serde-wasm-bindgen@0.6.5
	serde@1.0.228
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_derive_internals@0.29.1
	serde_json@1.0.142
	serde_qs@0.8.5
	serde_repr@0.1.20
	serde_urlencoded@0.7.1
	sha1@0.10.6
	sha1@0.6.1
	sha1_smol@1.0.1
	sha2@0.9.9
	shlex@1.3.0
	simd-adler32@0.3.7
	similar@2.7.0
	slab@0.4.11
	sluice@0.5.5
	smallvec@1.15.1
	smawk@0.3.2
	socket2@0.5.10
	socket2@0.6.0
	spdx@0.10.9
	spinning_top@0.2.5
	stable_deref_trait@1.2.0
	standback@0.2.17
	stdweb-derive@0.5.3
	stdweb-internal-macros@0.2.9
	stdweb-internal-runtime@0.1.5
	stdweb@0.4.20
	strsim@0.11.1
	subtle@2.6.1
	surf@2.3.2
	syn@1.0.109
	syn@2.0.106
	sync_wrapper@1.0.2
	synstructure@0.13.2
	tar@0.4.45
	tempfile@3.20.0
	textwrap@0.16.2
	thiserror-impl@1.0.69
	thiserror-impl@2.0.12
	thiserror@1.0.69
	thiserror@2.0.12
	time-core@0.1.8
	time-macros-impl@0.1.2
	time-macros@0.1.1
	time@0.2.27
	time@0.3.47
	tinystr@0.8.1
	tinyvec@1.9.0
	tinyvec_macros@0.1.1
	tokio-macros@2.5.0
	tokio-rustls@0.26.2
	tokio-util@0.7.16
	tokio@1.47.1
	toml_datetime@0.6.11
	toml_edit@0.22.27
	topological-sort@0.2.2
	tower-http@0.6.6
	tower-layer@0.3.3
	tower-lsp-macros@0.9.0
	tower-lsp@0.20.0
	tower-service@0.3.3
	tower@0.4.13
	tower@0.5.2
	tracing-attributes@0.1.30
	tracing-core@0.1.34
	tracing-futures@0.2.5
	tracing@0.1.41
	try-lock@0.2.5
	typed-builder-macro@0.21.0
	typed-builder@0.21.0
	typenum@1.18.0
	ungrammar@1.16.1
	unicase@2.8.1
	unicode-ident@1.0.18
	unicode-linebreak@0.1.5
	unicode-segmentation@1.12.0
	unicode-width@0.2.1
	unicode-xid@0.2.6
	universal-hash@0.4.0
	unscanny@0.1.0
	untrusted@0.9.0
	url@2.5.4
	urlencoding@2.1.3
	utf8_iter@1.0.4
	utf8parse@0.2.2
	uuid@1.18.0
	value-bag@1.11.1
	vcpkg@0.2.15
	version-ranges@0.1.1
	version_check@0.9.5
	waker-fn@1.2.0
	walkdir@2.5.0
	want@0.3.1
	wasi@0.11.1+wasi-snapshot-preview1
	wasi@0.14.2+wasi-0.2.4
	wasi@0.9.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.100
	wasm-bindgen-futures@0.4.50
	wasm-bindgen-macro-support@0.2.100
	wasm-bindgen-macro@0.2.100
	wasm-bindgen-shared@0.2.100
	wasm-bindgen@0.2.100
	wasm-encoder@0.227.1
	wasm-metadata@0.227.1
	wasmparser@0.227.1
	web-sys@0.3.77
	web-time@1.1.0
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.9
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-core@0.61.2
	windows-implement@0.60.0
	windows-interface@0.59.1
	windows-link@0.1.3
	windows-link@0.2.1
	windows-result@0.3.4
	windows-strings@0.4.2
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-sys@0.60.2
	windows-sys@0.61.2
	windows-targets@0.52.6
	windows-targets@0.53.3
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_gnullvm@0.53.0
	windows_aarch64_msvc@0.52.6
	windows_aarch64_msvc@0.53.0
	windows_i686_gnu@0.52.6
	windows_i686_gnu@0.53.0
	windows_i686_gnullvm@0.52.6
	windows_i686_gnullvm@0.53.0
	windows_i686_msvc@0.52.6
	windows_i686_msvc@0.53.0
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnu@0.53.0
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_gnullvm@0.53.0
	windows_x86_64_msvc@0.52.6
	windows_x86_64_msvc@0.53.0
	winnow@0.7.12
	wit-bindgen-core@0.41.0
	wit-bindgen-rt@0.39.0
	wit-bindgen-rt@0.41.0
	wit-bindgen-rust-macro@0.41.0
	wit-bindgen-rust@0.41.0
	wit-bindgen@0.41.0
	wit-component@0.227.1
	wit-parser@0.227.1
	writeable@0.6.1
	xattr@1.6.1
	xshell-macros@0.2.7
	xshell@0.2.7
	xz2@0.1.7
	yansi@1.0.1
	yoke-derive@0.8.0
	yoke@0.8.0
	zed_extension_api@0.7.0
	zerocopy-derive@0.8.26
	zerocopy@0.8.26
	zerofrom-derive@0.1.6
	zerofrom@0.1.6
	zeroize@1.8.1
	zeroize_derive@1.4.2
	zerotrie@0.2.2
	zerovec-derive@0.11.1
	zerovec@0.11.4
	zip@2.4.2
	zopfli@0.8.2
	zstd-safe@7.2.4
	zstd-sys@2.0.15+zstd.1.5.7
	zstd@0.13.3
"

inherit cargo shell-completion

DESCRIPTION="TOML Formatter / Linter / Language Server"
HOMEPAGE="https://tombi-toml.github.io/tombi/"
SRC_URI="
	https://github.com/tombi-toml/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"

LICENSE="MIT"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD ISC MIT MPL-2.0 Unicode-3.0 ZLIB"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
RESTRICT="mirror"
# apply-crates-fixes start
DEPEND="
	>=app-arch/zstd-1.5.7
	dev-libs/openssl
"

src_configure(){
	# fix for bzip2-sys crate
	mkdir "${T}/pkg-config" || die
	export PKG_CONFIG_PATH=${T}/pkg-config${PKG_CONFIG_PATH+:${PKG_CONFIG_PATH}}
	cat >> "${T}/pkg-config/bzip2.pc" <<-EOF || die
	Name: bzip2
	Version: 9999
	Description:
	Libs: -lbz2
	EOF
	cargo_src_configure
}

src_compile(){
	export ZSTD_SYS_USE_PKG_CONFIG=1 # fix for zstd-sys crate
	export OPENSSL_NO_VENDOR=1 # fix for openssl-sys
	cargo_src_compile
}
# apply-crates-fixes end

src_test(){
	# these require network at the time of writing this, so that's why they're skipped
	local CARGO_SKIP_TESTS=(
		'de::tests::test_deserialize_array'
		'de::tests::test_deserialize_complex_nested'
		'de::tests::test_deserialize_datetime'
		'de::tests::test_deserialize_default_values'
		'de::tests::test_deserialize_empty_containers'
		'de::tests::test_deserialize_enum'
		'de::tests::test_deserialize_map'
		'de::tests::test_deserialize_mixed_type_array'
		'de::tests::test_deserialize_nested_struct'
		'de::tests::test_deserialize_numeric_boundaries'
		'de::tests::test_deserialize_option'
		'de::tests::test_deserialize_special_characters'
		'de::tests::test_deserialize_struct'
		'de::tests::test_empty_tombi_config'
		'document::tests::test_array_of_tables_serialization'
		'document::tests::test_complex_nested_structures_serialization'
		'document::tests::test_date_time_serialization'
		'document::tests::test_document_serialization'
		'document::tests::test_nested_tables_serialization'
		'schema_format_rules::test_schema_format_rules_disabled_keeps_schema_order_targets_unsorted'
		'schema_overrides::test_root_array_override_applies_inside_subschema'
		'schema_overrides::test_root_schema_override_applies_inside_subschema'
		'schema_overrides::test_schema_format_rules_disabled_can_be_overridden_by_matching_array_override'
		'schema_overrides::test_schema_format_rules_disabled_can_be_overridden_by_matching_table_override'
		'schema_overrides::test_schema_overrides_disable_table_keys_order_for_matched_target'
		'schema_overrides::test_schema_overrides_reenable_array_values_order_for_matched_target'
		'schema_overrides::test_schema_overrides_reenable_table_keys_order_for_matched_target'
		'schema_overrides::test_schema_overrides_reenable_without_explicit_order_uses_schema_default'
		'schema_overrides::test_subschema_array_override_applies_without_root_override'
		'schema_overrides::test_subschema_array_override_precedes_root_array_override'
		'schema_overrides::test_subschema_override_applies_without_root_override'
		'schema_overrides::test_subschema_override_precedes_root_schema_override'
		'ser::tests::test_builder_with_schema_store_cargo_dependencies'
		'ser::tests::test_serialize_array'
		'ser::tests::test_serialize_datetime'
		'ser::tests::test_serialize_enum'
		'ser::tests::test_serialize_map'
		'ser::tests::test_serialize_nested_struct'
		'ser::tests::test_serialize_option'
		'ser::tests::test_serialize_struct'
		'table_keys_order::cargo::test_cargo_lints_rust_not_sorted_when_schema_format_rules_disabled'
	)
	cargo_src_test
}

src_install(){
	dobin target/release/tombi

	target/release/tombi completion bash > "${PN}" || die "generating bash completion failed"
	dobashcomp "${PN}"
	target/release/tombi completion zsh > "_${PN}" || die "generating zsh completion failed"
	dozshcomp "_${PN}"
	target/release/tombi completion fish > "${PN}.fish" || die "generating fish completion failed"
	dofishcomp "${PN}.fish"
}