# Template file for 'apache-jmeter'
pkgname=apache-jmeter
version=5.4.3
revision=2
hostmakedepends="openjdk8"
depends="virtual?java-runtime"
short_desc="Application to load test functional behavior and measure performance"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://jmeter.apache.org/"
distfiles="http://apache.osuosl.org/jmeter/source/apache-jmeter-${version}_src.tgz"
checksum=6f5bfa63f90a8e05d23064a6e431bc34ff1d093ac2769283d506430edc141682

case "$XBPS_MACHINE" in
	ppc64*) ;;
	ppc*|arm*|mips*) broken="too slow" ;;
esac

do_build() {
	# Tests fail -- they are too dependent on networking environment
	. /etc/profile.d/jdk.sh
	./gradlew -PchecksumIgnore -x test createDist
}

do_install() {
	rm -rf build.gradle.kts buildSrc gradle* LICENSE licenses NOTICE \
	 settings.gradle.kts *.md

	vmkdir usr/share/doc/apache-jmeter
	vcopy xdocs/* usr/share/doc/apache-jmeter
	rm -rf xdocs

	rm -rf src
	vmkdir usr/libexec/apache-jmeter
	vcopy * usr/libexec/apache-jmeter

	vmkdir usr/bin
	ln -s /usr/libexec/apache-jmeter/bin/jmeter ${DESTDIR}/usr/bin/jmeter
}

apache-jmeter-doc_package() {
	short_desc+=" - documentation"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/share/doc
	}
}
