/[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.26 Revision 1.27
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.26 2008/04/06 16:35:18 betelgeuse Exp $ 8# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.27 2008/07/07 16:48:45 betelgeuse Exp $
9 9
10inherit java-utils-2 10inherit java-utils-2
11 11
12# ----------------------------------------------------------------------------- 12# -----------------------------------------------------------------------------
13# @eclass-begin 13# @eclass-begin
47if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then 47if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then
48 HOMEPAGE="http://commons.apache.org/${PN#commons-}/" 48 HOMEPAGE="http://commons.apache.org/${PN#commons-}/"
49 SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz" 49 SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz"
50fi 50fi
51 51
52EXPORT_FUNCTIONS pkg_setup src_compile 52EXPORT_FUNCTIONS pkg_setup src_compile src_test
53 53
54# ------------------------------------------------------------------------------ 54# ------------------------------------------------------------------------------
55# @eclass-pkg_setup 55# @eclass-pkg_setup
56# 56#
57# pkg_setup initializes the Java environment 57# pkg_setup initializes the Java environment
91 else 91 else
92 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do." 92 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do."
93 fi 93 fi
94} 94}
95 95
96java-pkg-2_supports-test() {
97 python << EOF
98from xml.dom.minidom import parse
99import sys
100dom = parse("${1}")
101for elem in dom.getElementsByTagName('target'):
102 if elem.getAttribute('name') == 'test':
103 sys.exit(0)
104sys.exit(1)
105EOF
106 return $?
107}
108
109java-pkg-2_src_test() {
110 [[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
111
112 if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then
113 local opts task
114
115 if [[ ${EANT_TEST_JUNIT_INTO} ]]; then
116 java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit
117 fi
118
119 ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}}
120
121 if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then
122
123 if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then
124 ANT_TASKS="${ANT_TASKS} ant-junit"
125 else
126 ANT_TASKS="ant-junit"
127 fi
128
129 task=true
130 fi
131
132 if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then
133 opts="-Djunit.jar=\"$(java-pkg_getjar --build-only junit junit.jar)\""
134 if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then
135 EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH},junit"
136 elif [[ ${EANT_GENTOO_CLASSPATH} ]]; then
137 EANT_GENTOO_CLASSPATH+=',junit'
138 else
139 EANT_GENTOO_CLASSPATH=junit
140 fi
141 fi
142 eant ${opts} -f "${EANT_BUILD_XML}" \
143 ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test}
144
145 else
146 echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}"
147 fi
148}
149
96# ------------------------------------------------------------------------------ 150# ------------------------------------------------------------------------------
97# @eclass-end 151# @eclass-end
98# ------------------------------------------------------------------------------ 152# ------------------------------------------------------------------------------

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.20