/[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.32 Revision 1.36
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.32 2009/01/28 19:59:53 serkan Exp $ 8# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.36 2011/07/08 11:35:01 ssuominen 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
52case "${EAPI:-0}" in
52EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst 53 0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst ;;
53[[ "${EAPI:-0}" == "2" ]] && EXPORT_FUNCTIONS src_prepare 54 *) EXPORT_FUNCTIONS pkg_setup src_prepare src_compile pkg_preinst ;;
55esac
54 56
55# ------------------------------------------------------------------------------ 57# ------------------------------------------------------------------------------
56# @eclass-pkg_setup 58# @eclass-pkg_setup
57# 59#
58# pkg_setup initializes the Java environment 60# pkg_setup initializes the Java environment
89java-pkg-2_src_compile() { 91java-pkg-2_src_compile() {
90 if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then 92 if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
91 [[ "${EANT_FILTER_COMPILER}" ]] && \ 93 [[ "${EANT_FILTER_COMPILER}" ]] && \
92 java-pkg_filter-compiler ${EANT_FILTER_COMPILER} 94 java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
93 local antflags="${EANT_BUILD_TARGET:=jar}" 95 local antflags="${EANT_BUILD_TARGET:=jar}"
94 if hasq doc ${IUSE} && [[ -n "${EANT_DOC_TARGET=javadoc}" ]]; then 96 if has doc ${IUSE} && [[ -n "${EANT_DOC_TARGET=javadoc}" ]]; then
95 antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})" 97 antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
96 fi 98 fi
97 local tasks 99 local tasks
98 [[ ${EANT_ANT_TASKS} ]] && tasks="${ANT_TASKS} ${EANT_ANT_TASKS}" 100 [[ ${EANT_ANT_TASKS} ]] && tasks="${ANT_TASKS} ${EANT_ANT_TASKS}"
99 ANT_TASKS="${tasks:-${ANT_TASKS}}" \ 101 ANT_TASKS="${tasks:-${ANT_TASKS}}" \
101 else 103 else
102 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do." 104 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do."
103 fi 105 fi
104} 106}
105 107
108java-pkg-2_supports-test() {
109 python << EOF
110from xml.dom.minidom import parse
111import sys
112dom = parse("${1}")
113for elem in dom.getElementsByTagName('target'):
114 if elem.getAttribute('name') == 'test':
115 sys.exit(0)
116sys.exit(1)
117EOF
118 return $?
119}
106 120
121java-pkg-2_src_test() {
122 [[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
123
124 if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then
125 local opts task
126
127 if [[ ${EANT_TEST_JUNIT_INTO} ]]; then
128 java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit
129 fi
130
131 ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}}
132
133 if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then
134
135 if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then
136 ANT_TASKS="${ANT_TASKS} ant-junit"
137 else
138 ANT_TASKS="ant-junit"
139 fi
140
141 task=true
142 fi
143
144 if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then
145 opts="-Djunit.jar=\"$(java-pkg_getjar junit junit.jar)\""
146 if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then
147 EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH},junit"
148 elif [[ ${EANT_GENTOO_CLASSPATH} ]]; then
149 EANT_GENTOO_CLASSPATH+=',junit'
150 else
151 EANT_GENTOO_CLASSPATH=junit
152 fi
153 fi
154
155 eant ${opts} -f "${EANT_BUILD_XML}" \
156 ${EANT_EXTRA_ARGS} ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test}
157
158 else
159 echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}"
160 fi
161}
162
163# ------------------------------------------------------------------------------
164# @eclass-pkg_preinst
165#
166# wrapper for java-utils-2_pkg_preinst
167# ------------------------------------------------------------------------------
107java-pkg-2_pkg_preinst() { 168java-pkg-2_pkg_preinst() {
108 if is-java-strict; then 169 java-utils-2_pkg_preinst
109 if has_version dev-java/java-dep-check; then
110 [[ -e "${JAVA_PKG_ENV}" ]] || return
111 local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}")
112 if [[ ${output} && has_version <=dev-java/java-dep-check-0.2 ]]; then
113 ewarn "Possibly unneeded dependencies found in package.env:"
114 for dep in ${output}; do
115 ewarn "\t${dep}"
116 done
117 fi
118 if [[ ${output} && has_version >dev-java/java-dep-check-0.2 ]]; then
119 ewarn "${output}"
120 fi
121 else
122 eerror "Install dev-java/java-dep-check for dependency checking"
123 fi
124 fi
125} 170}
126 171
127# ------------------------------------------------------------------------------ 172# ------------------------------------------------------------------------------
128# @eclass-end 173# @eclass-end
129# ------------------------------------------------------------------------------ 174# ------------------------------------------------------------------------------

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.20