/[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.38 Revision 1.39
3# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org> 3# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
4# Copyright (c) 2004-2011, Gentoo Foundation 4# Copyright (c) 2004-2011, 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.38 2012/06/04 08:27:42 sera Exp $ 8# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.39 2012/07/21 11:57:30 sera Exp $
9
10# @ECLASS: java-pkg-2.eclass
11# @MAINTAINER:
12# java@gentoo.org
13# @AUTHOR:
14# Thomas Matthijs <axxo@gentoo.org>
15# @BLURB: Eclass for Java Packages
16# @DESCRIPTION:
17# This eclass should be inherited for pure Java packages, or by packages which
18# need to use Java.
9 19
10inherit java-utils-2 20inherit java-utils-2
11 21
12# ----------------------------------------------------------------------------- 22# @ECLASS-VARIABLE: JAVA_PKG_IUSE
13# @eclass-begin 23# @DEFAULT_UNSET
14# @eclass-summary Eclass for Java Packages 24# @DESCRIPTION:
15#
16# This eclass should be inherited for pure Java packages, or by packages which
17# need to use Java.
18# -----------------------------------------------------------------------------
19
20# ------------------------------------------------------------------------------
21# @IUSE
22#
23# Use JAVA_PKG_IUSE instead of IUSE for doc, source and examples so that 25# Use JAVA_PKG_IUSE instead of IUSE for doc, source and examples so that
24# the eclass can automatically add the needed dependencies for the java-pkg_do* 26# the eclass can automatically add the needed dependencies for the java-pkg_do*
25# functions. 27# functions.
26#
27# ------------------------------------------------------------------------------
28IUSE="${JAVA_PKG_IUSE}" 28IUSE="${JAVA_PKG_IUSE}"
29 29
30# ------------------------------------------------------------------------------
31# @depend
32#
33# Java packages need java-config, and a fairly new release of Portage. 30# Java packages need java-config, and a fairly new release of Portage.
34#
35# JAVA_PKG_E_DEPEND is defined in java-utils.eclass. 31# JAVA_PKG_E_DEPEND is defined in java-utils.eclass.
36# ------------------------------------------------------------------------------
37DEPEND="${JAVA_PKG_E_DEPEND}" 32DEPEND="${JAVA_PKG_E_DEPEND}"
38 33
39# ------------------------------------------------------------------------------
40# @rdepend
41#
42# Nothing special for RDEPEND... just the same as DEPEND. 34# Nothing special for RDEPEND... just the same as DEPEND.
43# ------------------------------------------------------------------------------
44RDEPEND="${DEPEND}" 35RDEPEND="${DEPEND}"
45 36
46# Commons packages follow the same rules so do it here 37# Commons packages follow the same rules so do it here
47if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then 38if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then
48 HOMEPAGE="http://commons.apache.org/${PN#commons-}/" 39 HOMEPAGE="http://commons.apache.org/${PN#commons-}/"
52case "${EAPI:-0}" in 43case "${EAPI:-0}" in
53 0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst ;; 44 0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst ;;
54 *) EXPORT_FUNCTIONS pkg_setup src_prepare src_compile pkg_preinst ;; 45 *) EXPORT_FUNCTIONS pkg_setup src_prepare src_compile pkg_preinst ;;
55esac 46esac
56 47
57# ------------------------------------------------------------------------------ 48# @FUNCTION: java-pkg-2_pkg_setup
58# @eclass-pkg_setup 49# @DESCRIPTION:
59#
60# pkg_setup initializes the Java environment 50# pkg_setup initializes the Java environment
61# ------------------------------------------------------------------------------ 51
62java-pkg-2_pkg_setup() { 52java-pkg-2_pkg_setup() {
63 java-pkg_init 53 java-pkg_init
64} 54}
65 55
66# ------------------------------------------------------------------------------ 56
67# @eclass-src_prepare 57# @FUNCTION: java-pkg-2_src_prepare
68# 58# @DESCRIPTION:
69# wrapper for java-utils-2_src_prepare 59# wrapper for java-utils-2_src_prepare
70# ------------------------------------------------------------------------------ 60
71java-pkg-2_src_prepare() { 61java-pkg-2_src_prepare() {
72 java-utils-2_src_prepare 62 java-utils-2_src_prepare
73} 63}
74 64
75# ------------------------------------------------------------------------------ 65
76# @eclass-src_compile 66# @FUNCTION: java-pkg-2_src_compile
67# @DESCRIPTION:
68# Default src_compile for java packages
77# 69#
78# Default src_compile for java packages 70# @CODE
79# variables: 71# Variables:
80# EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml) 72# EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml)
81# EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value 73# EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value
82# EANT_BUILD_TARGET - the ant target/targets to execute (default: jar) 74# EANT_BUILD_TARGET - the ant target/targets to execute (default: jar)
83# EANT_DOC_TARGET - the target to build extra docs under the doc use flag 75# EANT_DOC_TARGET - the target to build extra docs under the doc use flag
84# (default: javadoc; declare empty to disable completely) 76# (default: javadoc; declare empty to disable completely)
85# EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass 77# EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass
86# EANT_EXTRA_ARGS - extra arguments to pass to eant 78# EANT_EXTRA_ARGS - extra arguments to pass to eant
87# EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment 79# EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment
88# param: Parameters are passed to ant verbatim 80# @CODE
89# ------------------------------------------------------------------------------ 81
90java-pkg-2_src_compile() { 82java-pkg-2_src_compile() {
91 if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then 83 if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
92 [[ "${EANT_FILTER_COMPILER}" ]] && \ 84 [[ "${EANT_FILTER_COMPILER}" ]] && \
93 java-pkg_filter-compiler ${EANT_FILTER_COMPILER} 85 java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
94 local antflags="${EANT_BUILD_TARGET:=jar}" 86 local antflags="${EANT_BUILD_TARGET:=jar}"
102 else 94 else
103 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do." 95 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do."
104 fi 96 fi
105} 97}
106 98
99
100# @FUNCTION: java-pkg-2_supports-test
101# @INTERNAL
102# @DESCRIPTION:
103# test whether a build.xml has a test target.
104
107java-pkg-2_supports-test() { 105java-pkg-2_supports-test() {
108 python << EOF 106 python << EOF
109from xml.dom.minidom import parse 107from xml.dom.minidom import parse
110import sys 108import sys
111dom = parse("${1}") 109dom = parse("${1}")
114 sys.exit(0) 112 sys.exit(0)
115sys.exit(1) 113sys.exit(1)
116EOF 114EOF
117 return $? 115 return $?
118} 116}
117
118# @FUNCTION: java-pkg-2_src_test
119# @DESCRIPTION:
120# src_test, not exported.
119 121
120java-pkg-2_src_test() { 122java-pkg-2_src_test() {
121 [[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return 123 [[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
122 124
123 if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then 125 if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then
157 else 159 else
158 echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}" 160 echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}"
159 fi 161 fi
160} 162}
161 163
162# ------------------------------------------------------------------------------ 164# @FUNCTION: java-pkg-2_pkg_preinst
163# @eclass-pkg_preinst 165# @DESCRIPTION:
164#
165# wrapper for java-utils-2_pkg_preinst 166# wrapper for java-utils-2_pkg_preinst
166# ------------------------------------------------------------------------------ 167
167java-pkg-2_pkg_preinst() { 168java-pkg-2_pkg_preinst() {
168 java-utils-2_pkg_preinst 169 java-utils-2_pkg_preinst
169} 170}
170
171# ------------------------------------------------------------------------------
172# @eclass-end
173# ------------------------------------------------------------------------------

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

  ViewVC Help
Powered by ViewVC 1.1.20