summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Zongyu <zzy2529420793@gmail.com>2020-08-26 00:30:09 +0800
committerMiroslav Šulc <fordfrog@gentoo.org>2020-08-30 18:01:54 +0200
commitfaa407032918b43fafe7d4e1de85dde4d30ba4f2 (patch)
tree7dc04c498e72fe57498ac3ff663bef3af20bb486 /eclass/java-utils-2.eclass
parentmedia-video/vlc: force net-libs/libupnp[ipv6] for USE=upnp (diff)
downloadgentoo-faa407032918b43fafe7d4e1de85dde4d30ba4f2.tar.gz
gentoo-faa407032918b43fafe7d4e1de85dde4d30ba4f2.tar.bz2
gentoo-faa407032918b43fafe7d4e1de85dde4d30ba4f2.zip
java-pkg-simple.eclass and java-utils-2.eclass: features and enhancements
1) support java resources 2) support java main class and launcher 3) enable java-pkg-simple_src_test() 4) support binary jars (both for resolve circular deps and for pkgdiff test) Signed-off-by: Zhang Zongyu <zzy2529420793@gmail.com> Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
Diffstat (limited to 'eclass/java-utils-2.eclass')
-rw-r--r--eclass/java-utils-2.eclass38
1 files changed, 38 insertions, 0 deletions
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 29f13e031f48..a33962f114de 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1861,6 +1861,44 @@ ejunit4() {
ejunit_ "junit-4" "${@}"
}
+# @FUNCTION: etestng
+# @USAGE: etestng_ [-cp $classpath] <test classes>
+# @INTERNAL
+# @DESCRIPTION:
+# Testng wrapper function. Makes it easier to run the tests.
+# Launches the tests using org.testng.TestNG.
+#
+# @CODE
+# $1 - -cp or -classpath
+# $2 - the classpath passed to it
+# $@ - test classes for testng to run.
+# @CODE
+etestng() {
+ debug-print-function ${FUNCNAME} $*
+
+ local runner=org.testng.TestNG
+ local cp=$(java-pkg_getjars --with-dependencies testng)
+ local tests
+
+ if [[ ${1} = -cp || ${1} = -classpath ]]; then
+ cp="${cp}:${2}"
+ shift 2
+ else
+ cp="${cp}:."
+ fi
+
+ for test in ${@}; do
+ tests+="${test},"
+ done
+
+ debug-print "java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\""\
+ "-Djava.awt.headless=true ${runner}"\
+ "-usedefaultlisteners false -testclass ${tests}"
+ java -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true\
+ ${runner} -usedefaultlisteners false -testclass ${tests}\
+ || die "Running TestNG failed."
+}
+
# @FUNCTION: java-utils-2_src_prepare
# @DESCRIPTION:
# src_prepare Searches for bundled jars