* Automatically add Junit.present=true to ant properties when in the test phase
authorPetteri Räty <betelgeuse@gentoo.org>
Tue, 13 Feb 2007 19:52:51 +0000 (19:52 +0000)
committerPetteri Räty <betelgeuse@gentoo.org>
Tue, 13 Feb 2007 19:52:51 +0000 (19:52 +0000)
* Allow multiple atoms in EANT_GENTOO_CLASSPATH
* Automatically add junit to gentoo.classpath when EANT_GENTOO_CLASSPATH is
  defined, ant-junit is in ANT_TASKS and we are in the test phase.

eclass/java-utils-2.eclass

index e089580ddc852c81d9a5e1a25e387f46d370cd21..1eb1c488c3cb73d4dfb8bd68466caa8fda63c7f4 100644 (file)
@@ -6,7 +6,7 @@
 #
 # Licensed under the GNU General Public License, v2
 #
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.56 2007/01/30 14:12:34 caster Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.57 2007/02/13 19:52:51 betelgeuse Exp $
 
 
 # -----------------------------------------------------------------------------
@@ -405,7 +405,8 @@ java-pkg_doso() {
                        # otherwise make a symlink to the symlink's origin
                        else
                                # TODO use dosym
-                               ln -s "$(readlink "${lib}")" "${D}${JAVA_PKG_LIBDEST}/$(basename "${lib}")"
+                               ln -s "$(readlink "${lib}")" \
+                                       "${D}${JAVA_PKG_LIBDEST}/$(basename "${lib}")"
                                debug-print "${lib} is a symlink, linking accordanly"
                        fi
                # otherwise die
@@ -1556,6 +1557,7 @@ eant() {
        fi
 
        local antflags="-Dnoget=true -Dmaven.mode.offline=true"
+
        java-pkg_init-compiler_
        local compiler="${GENTOO_COMPILER}"
 
@@ -1633,10 +1635,20 @@ eant() {
 
        local gcp="${EANT_GENTOO_CLASSPATH}"
 
-       if [[ "${gcp}" ]]; then
-               local cp="$(java-pkg_getjars ${gcp})"
+       if [[ ${EBUILD_PHASE} = "test" ]]; then
+               antflags="${antflags} -DJunit.present=true"
+               [[ ${gcp} && ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
+       fi
+
+       local cp
+
+       for atom in ${gcp}; do
+               cp="${cp}:$(java-pkg_getjars ${atom})"
+       done
+
+       if [[ ${cp} ]]; then
                # It seems ant does not like single quotes around ${cp}
-               antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
+               antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\""
        fi
 
        [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"