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

# Auto-Generated by cargo-ebuild 0.5.4-r1

EAPI=8

CRATES="
	addr2line@0.21.0
	adler@1.0.2
	aho-corasick@1.1.2
	anes@0.1.6
	ansi_term@0.12.1
	anstream@0.6.12
	anstyle@1.0.6
	anstyle-parse@0.2.3
	anstyle-query@1.0.2
	anstyle-wincon@3.0.2
	anyhow@1.0.80
	assert_cmd@2.0.14
	ast-grep-tree-sitter-c-sharp@0.20.0
	async-trait@0.1.77
	atty@0.2.14
	auto_impl@1.1.2
	autocfg@1.1.0
	backtrace@0.3.69
	bit-set@0.5.3
	bit-vec@0.6.3
	bitflags@1.3.2
	bitflags@2.4.2
	bstr@1.9.0
	bumpalo@3.15.0
	byteorder@1.5.0
	bytes@1.5.0
	cast@0.3.0
	cc@1.0.90
	cfg-if@1.0.0
	ciborium@0.2.2
	ciborium-io@0.2.2
	ciborium-ll@0.2.2
	clap@4.5.2
	clap_builder@4.5.2
	clap_complete@4.5.1
	clap_derive@4.5.0
	clap_lex@0.7.0
	codespan-reporting@0.11.1
	colorchoice@1.0.0
	convert_case@0.6.0
	criterion@0.5.1
	criterion-plot@0.5.0
	crossbeam-deque@0.8.5
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.19
	crossterm@0.25.0
	crossterm@0.27.0
	crossterm_winapi@0.9.1
	crunchy@0.2.2
	ctor@0.2.6
	dashmap@5.5.3
	difflib@0.4.0
	doc-comment@0.3.3
	dyn-clone@1.0.16
	either@1.10.0
	equivalent@1.0.1
	errno@0.3.8
	fastrand@2.0.1
	float-cmp@0.9.0
	form_urlencoded@1.2.1
	futures@0.3.30
	futures-channel@0.3.30
	futures-core@0.3.30
	futures-io@0.3.30
	futures-macro@0.3.30
	futures-sink@0.3.30
	futures-task@0.3.30
	futures-util@0.3.30
	fuzzy-matcher@0.3.7
	fxhash@0.2.1
	gimli@0.28.1
	globset@0.4.14
	half@2.3.1
	hashbrown@0.14.3
	heck@0.4.1
	hermit-abi@0.1.19
	hermit-abi@0.3.6
	httparse@1.8.0
	idna@0.5.0
	ignore@0.4.22
	indexmap@2.2.3
	indoc@2.0.4
	inquire@0.7.0
	is-terminal@0.4.12
	itertools@0.10.5
	itoa@1.0.10
	js-sys@0.3.68
	libc@0.2.153
	libloading@0.8.1
	linux-raw-sys@0.4.13
	lock_api@0.4.11
	log@0.4.20
	lsp-types@0.94.1
	memchr@2.7.1
	memoffset@0.9.0
	miniz_oxide@0.7.2
	mio@0.8.10
	napi@2.16.0
	napi-build@2.1.2
	napi-derive@2.16.0
	napi-derive-backend@1.0.62
	napi-sys@2.3.0
	newline-converter@0.3.0
	normalize-line-endings@0.3.0
	num-traits@0.2.18
	num_cpus@1.16.0
	object@0.32.2
	once_cell@1.19.0
	oorandom@11.1.3
	parking_lot@0.12.1
	parking_lot_core@0.9.9
	percent-encoding@2.3.1
	pin-project@1.1.4
	pin-project-internal@1.1.4
	pin-project-lite@0.2.13
	pin-utils@0.1.0
	plotters@0.3.5
	plotters-backend@0.3.5
	plotters-svg@0.3.5
	portable-atomic@1.6.0
	predicates@3.1.0
	predicates-core@1.0.6
	predicates-tree@1.0.9
	proc-macro2@1.0.78
	pyo3@0.20.3
	pyo3-build-config@0.20.3
	pyo3-ffi@0.20.3
	pyo3-macros@0.20.3
	pyo3-macros-backend@0.20.3
	pythonize@0.20.0
	quote@1.0.35
	rayon@1.8.1
	rayon-core@1.12.1
	redox_syscall@0.4.1
	regex@1.10.3
	regex-automata@0.4.5
	regex-syntax@0.8.2
	rustc-demangle@0.1.23
	rustix@0.38.31
	ryu@1.0.17
	same-file@1.0.6
	schemars@0.8.16
	schemars_derive@0.8.16
	scopeguard@1.2.0
	semver@1.0.22
	serde@1.0.196
	serde_derive@1.0.196
	serde_derive_internals@0.26.0
	serde_json@1.0.114
	serde_repr@0.1.18
	serde_yaml@0.9.32
	signal-hook@0.3.17
	signal-hook-mio@0.2.3
	signal-hook-registry@1.4.1
	similar@2.4.0
	slab@0.4.9
	smallvec@1.13.1
	strsim@0.11.0
	syn@1.0.109
	syn@2.0.49
	target-lexicon@0.12.13
	tempfile@3.10.1
	termcolor@1.4.1
	termtree@0.4.1
	thiserror@1.0.57
	thiserror-impl@1.0.57
	thread_local@1.1.8
	tinytemplate@1.2.1
	tinyvec@1.6.0
	tinyvec_macros@0.1.1
	tokio@1.36.0
	tokio-util@0.7.10
	toml_datetime@0.6.5
	toml_edit@0.22.6
	tower@0.4.13
	tower-layer@0.3.2
	tower-lsp@0.20.0
	tower-lsp-macros@0.9.0
	tower-service@0.3.2
	tracing@0.1.40
	tracing-attributes@0.1.27
	tracing-core@0.1.32
	tree-sitter@0.20.10
	tree-sitter-bash@0.20.5
	tree-sitter-c@0.20.8
	tree-sitter-cpp@0.20.5
	tree-sitter-css@0.20.0
	tree-sitter-dart@0.0.3
	tree-sitter-elixir@0.1.1
	tree-sitter-facade-sg@0.9.2
	tree-sitter-go@0.20.0
	tree-sitter-html-dvdb@0.20.0
	tree-sitter-java@0.20.2
	tree-sitter-javascript@0.20.4
	tree-sitter-json@0.20.2
	tree-sitter-kotlin@0.3.1
	tree-sitter-lua@0.0.19
	tree-sitter-php@0.22.2
	tree-sitter-python@0.20.4
	tree-sitter-ruby@0.20.1
	tree-sitter-rust@0.20.4
	tree-sitter-scala@0.20.3
	tree-sitter-swift@0.4.1
	tree-sitter-typescript@0.20.5
	unicode-bidi@0.3.15
	unicode-ident@1.0.12
	unicode-normalization@0.1.22
	unicode-segmentation@1.11.0
	unicode-width@0.1.11
	unindent@0.2.3
	unsafe-libyaml@0.2.10
	url@2.5.0
	utf8parse@0.2.1
	wait-timeout@0.2.0
	walkdir@2.4.0
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen@0.2.91
	wasm-bindgen-backend@0.2.91
	wasm-bindgen-futures@0.4.41
	wasm-bindgen-macro@0.2.91
	wasm-bindgen-macro-support@0.2.91
	wasm-bindgen-shared@0.2.91
	web-sys@0.3.68
	web-tree-sitter-sg@1.3.4
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.6
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-targets@0.48.5
	windows-targets@0.52.0
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.0
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.0
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.0
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.0
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.0
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.0
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.0
	winnow@0.6.2
"

inherit cargo

DESCRIPTION="Search and Rewrite code at large scale using precise AST pattern"
# Double check the homepage as the cargo_metadata crate
# does not provide this value so instead repository is used
HOMEPAGE="https://github.com/ast-grep/ast-grep"
SRC_URI="${CARGO_CRATE_URIS}
	https://github.com/ast-grep/${PN}/archive/refs/tags/${PV}.tar.gz
"

# License set may be more restrictive as OR is not respected
# use cargo-license for a more accurate license picture
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"

DEPEND=""
RDEPEND="${DEPEND}"
BDEPEND=""

# 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_install() {
	cd target/release
	dolib.so libast_grep_napi.so
	dolib.so libast_grep_py.so
	dobin ast-grep
}