From: "Petteri Räty" <betelgeuse@gentoo.org>
To: Gentoo Java <gentoo-java@lists.gentoo.org>
Subject: [gentoo-java] Default src_test
Date: Wed, 13 Feb 2008 23:36:30 +0200 [thread overview]
Message-ID: <47B362DE.2050408@gentoo.org> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 159 bytes --]
Here is a proposal as a default src_test function.
It uses autodetection to see if there is a test target in build.xml and
runs that.
Regards,
Petteri
[-- Attachment #1.2: java-default-src_test.patch --]
[-- Type: text/plain, Size: 1802 bytes --]
Index: java-pkg-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v
retrieving revision 1.25
diff -u -r1.25 java-pkg-2.eclass
--- java-pkg-2.eclass 13 Nov 2007 19:36:50 -0000 1.25
+++ java-pkg-2.eclass 13 Feb 2008 21:35:12 -0000
@@ -43,7 +43,7 @@
# ------------------------------------------------------------------------------
RDEPEND="${DEPEND}"
-EXPORT_FUNCTIONS pkg_setup src_compile
+EXPORT_FUNCTIONS pkg_setup src_compile src_test
# ------------------------------------------------------------------------------
# @eclass-pkg_setup
@@ -87,6 +87,40 @@
fi
}
+java-pkg-2_supports-test() {
+ python << EOF
+from xml.dom.minidom import parse
+import sys
+dom = parse("${1}")
+for elem in dom.getElementsByTagName('target'):
+ if elem.getAttribute('name') == 'test':
+ sys.exit(0)
+sys.exit(1)
+EOF
+ return $?
+}
+
+java-pkg-2_src_test() {
+ [[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
+
+ if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then
+ local opts task
+ if [[ ${EANT_TEST_JUNIT_INTO} ]]; then
+ java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit
+ fi
+ if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then
+ ANT_TASKS=${ANT_TASKS:-ant-junit}
+ EANT_GENTOO_CLASSPATH=${EANT_GENTOO_CLASSPATH:-junit}
+ task=true
+ fi
+ if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then
+ opts="-Djunit.jar=\"$(java-pkg_getjar --build-only junit junit.jar)\""
+ fi
+ eant ${opts} -f "${EANT_BUILD_XML}" \
+ ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test}
+ fi
+}
+
# ------------------------------------------------------------------------------
# @eclass-end
# ------------------------------------------------------------------------------
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
reply other threads:[~2008-02-13 21:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47B362DE.2050408@gentoo.org \
--to=betelgeuse@gentoo.org \
--cc=gentoo-java@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox