/[gentoo-x86]/eclass/java-pkg-2.eclass
Gentoo

Diff of /eclass/java-pkg-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.33 Revision 1.34
3# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org> 3# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
4# Copyright (c) 2004-2005, Gentoo Foundation 4# Copyright (c) 2004-2005, Gentoo Foundation
5# 5#
6# Licensed under the GNU General Public License, v2 6# Licensed under the GNU General Public License, v2
7# 7#
8# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.33 2009/02/19 05:10:37 serkan Exp $ 8# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.34 2009/09/02 21:41:29 betelgeuse Exp $
9 9
10inherit java-utils-2 10inherit java-utils-2
11 11
12# ----------------------------------------------------------------------------- 12# -----------------------------------------------------------------------------
13# @eclass-begin 13# @eclass-begin
101 else 101 else
102 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do." 102 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do."
103 fi 103 fi
104} 104}
105 105
106java-pkg-2_supports-test() {
107 python << EOF
108from xml.dom.minidom import parse
109import sys
110dom = parse("${1}")
111for elem in dom.getElementsByTagName('target'):
112 if elem.getAttribute('name') == 'test':
113 sys.exit(0)
114sys.exit(1)
115EOF
116 return $?
117}
118
119java-pkg-2_src_test() {
120 [[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
121
122 if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then
123 local opts task
124
125 if [[ ${EANT_TEST_JUNIT_INTO} ]]; then
126 java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit
127 fi
128
129 ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}}
130
131 if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then
132
133 if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then
134 ANT_TASKS="${ANT_TASKS} ant-junit"
135 else
136 ANT_TASKS="ant-junit"
137 fi
138
139 task=true
140 fi
141
142 if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then
143 opts="-Djunit.jar=\"$(java-pkg_getjar junit junit.jar)\""
144 if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then
145 EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH},junit"
146 elif [[ ${EANT_GENTOO_CLASSPATH} ]]; then
147 EANT_GENTOO_CLASSPATH+=',junit'
148 else
149 EANT_GENTOO_CLASSPATH=junit
150 fi
151 fi
152
153 eant ${opts} -f "${EANT_BUILD_XML}" \
154 ${EANT_EXTRA_ARGS} ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test}
155
156 else
157 echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}"
158 fi
159}
160
106# ------------------------------------------------------------------------------ 161# ------------------------------------------------------------------------------
107# @eclass-pkg_preinst 162# @eclass-pkg_preinst
108# 163#
109# wrapper for java-utils-2_pkg_preinst 164# wrapper for java-utils-2_pkg_preinst
110# ------------------------------------------------------------------------------ 165# ------------------------------------------------------------------------------

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

  ViewVC Help
Powered by ViewVC 1.1.20