summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorPetteri Räty <betelgeuse@gentoo.org>2009-09-02 21:41:29 +0000
committerPetteri Räty <betelgeuse@gentoo.org>2009-09-02 21:41:29 +0000
commit517f6ebcf04cc570da401d720efed351789fedcf (patch)
tree7206e0ff2c95357de91464b5889e382469b5b249 /eclass
parentFix attach function. Per bug #266684. (diff)
downloadgentoo-2-517f6ebcf04cc570da401d720efed351789fedcf.tar.gz
gentoo-2-517f6ebcf04cc570da401d720efed351789fedcf.tar.bz2
gentoo-2-517f6ebcf04cc570da401d720efed351789fedcf.zip
add java-pkg-2_src_test but don't export it so it can be used but doesn't break things that haven't been made to work with it
Diffstat (limited to 'eclass')
-rw-r--r--eclass/java-pkg-2.eclass57
1 files changed, 56 insertions, 1 deletions
diff --git a/eclass/java-pkg-2.eclass b/eclass/java-pkg-2.eclass
index 45bbeedf21f0..151bc20984ce 100644
--- a/eclass/java-pkg-2.eclass
+++ b/eclass/java-pkg-2.eclass
@@ -5,7 +5,7 @@
#
# Licensed under the GNU General Public License, v2
#
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.33 2009/02/19 05:10:37 serkan Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.34 2009/09/02 21:41:29 betelgeuse Exp $
inherit java-utils-2
@@ -103,6 +103,61 @@ java-pkg-2_src_compile() {
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
+
+ ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}}
+
+ if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then
+
+ if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then
+ ANT_TASKS="${ANT_TASKS} ant-junit"
+ else
+ ANT_TASKS="ant-junit"
+ fi
+
+ task=true
+ fi
+
+ if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then
+ opts="-Djunit.jar=\"$(java-pkg_getjar junit junit.jar)\""
+ if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then
+ EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH},junit"
+ elif [[ ${EANT_GENTOO_CLASSPATH} ]]; then
+ EANT_GENTOO_CLASSPATH+=',junit'
+ else
+ EANT_GENTOO_CLASSPATH=junit
+ fi
+ fi
+
+ eant ${opts} -f "${EANT_BUILD_XML}" \
+ ${EANT_EXTRA_ARGS} ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test}
+
+ else
+ echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}"
+ fi
+}
+
# ------------------------------------------------------------------------------
# @eclass-pkg_preinst
#