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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.41 - (hide annotations) (download)
Wed Jun 17 09:48:12 2015 UTC (17 months, 2 weeks ago) by chewi
Branch: MAIN
CVS Tags: HEAD
Changes since 1.40: +2 -21 lines
Remove eclass dependency on python[xml] and replace with some ugly
grep that should suffice. Closes #552332.

1 nichoj 1.1 # Eclass for Java packages
2     #
3     # Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
4 chewi 1.40 # Copyright (c) 2004-2015, Gentoo Foundation
5 nichoj 1.1 #
6     # Licensed under the GNU General Public License, v2
7     #
8 chewi 1.41 # $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.40 2015/04/28 20:35:40 chewi Exp $
9 nichoj 1.1
10 sera 1.39 # @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 nichoj 1.1 # This eclass should be inherited for pure Java packages, or by packages which
18     # need to use Java.
19    
20 sera 1.39 inherit java-utils-2
21    
22     # @ECLASS-VARIABLE: JAVA_PKG_IUSE
23     # @DEFAULT_UNSET
24     # @DESCRIPTION:
25 betelgeuse 1.25 # Use JAVA_PKG_IUSE instead of IUSE for doc, source and examples so that
26     # the eclass can automatically add the needed dependencies for the java-pkg_do*
27     # functions.
28 betelgeuse 1.13 IUSE="${JAVA_PKG_IUSE}"
29    
30 nichoj 1.1 # Java packages need java-config, and a fairly new release of Portage.
31     # JAVA_PKG_E_DEPEND is defined in java-utils.eclass.
32     DEPEND="${JAVA_PKG_E_DEPEND}"
33    
34     # Nothing special for RDEPEND... just the same as DEPEND.
35     RDEPEND="${DEPEND}"
36    
37 betelgeuse 1.26 # Commons packages follow the same rules so do it here
38     if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then
39     HOMEPAGE="http://commons.apache.org/${PN#commons-}/"
40     SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz"
41     fi
42    
43 caster 1.35 case "${EAPI:-0}" in
44     0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst ;;
45     *) EXPORT_FUNCTIONS pkg_setup src_prepare src_compile pkg_preinst ;;
46     esac
47 nichoj 1.1
48 sera 1.39 # @FUNCTION: java-pkg-2_pkg_setup
49     # @DESCRIPTION:
50 nichoj 1.1 # pkg_setup initializes the Java environment
51 sera 1.39
52 nichoj 1.1 java-pkg-2_pkg_setup() {
53     java-pkg_init
54     }
55    
56 sera 1.39
57     # @FUNCTION: java-pkg-2_src_prepare
58     # @DESCRIPTION:
59 caster 1.30 # wrapper for java-utils-2_src_prepare
60 sera 1.39
61 caster 1.30 java-pkg-2_src_prepare() {
62     java-utils-2_src_prepare
63     }
64    
65 sera 1.39
66     # @FUNCTION: java-pkg-2_src_compile
67     # @DESCRIPTION:
68     # Default src_compile for java packages
69 betelgeuse 1.6 #
70 sera 1.39 # @CODE
71     # Variables:
72     # EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml)
73     # EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value
74     # EANT_BUILD_TARGET - the ant target/targets to execute (default: jar)
75     # EANT_DOC_TARGET - the target to build extra docs under the doc use flag
76     # (default: javadoc; declare empty to disable completely)
77     # EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass
78     # EANT_EXTRA_ARGS - extra arguments to pass to eant
79     # EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment
80     # @CODE
81    
82 betelgeuse 1.6 java-pkg-2_src_compile() {
83     if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
84 betelgeuse 1.10 [[ "${EANT_FILTER_COMPILER}" ]] && \
85     java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
86 betelgeuse 1.6 local antflags="${EANT_BUILD_TARGET:=jar}"
87 ssuominen 1.36 if has doc ${IUSE} && [[ -n "${EANT_DOC_TARGET=javadoc}" ]]; then
88 caster 1.22 antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
89     fi
90 betelgeuse 1.20 local tasks
91     [[ ${EANT_ANT_TASKS} ]] && tasks="${ANT_TASKS} ${EANT_ANT_TASKS}"
92 betelgeuse 1.21 ANT_TASKS="${tasks:-${ANT_TASKS}}" \
93 betelgeuse 1.17 eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGS} "${@}"
94 betelgeuse 1.6 else
95 betelgeuse 1.18 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do."
96 betelgeuse 1.6 fi
97     }
98    
99 sera 1.39 # @FUNCTION: java-pkg-2_src_test
100     # @DESCRIPTION:
101     # src_test, not exported.
102    
103 betelgeuse 1.34 java-pkg-2_src_test() {
104     [[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
105    
106 chewi 1.41 if [[ ${EANT_TEST_TARGET} ]] || < "${EANT_BUILD_XML}" tr -d "\n" | grep -Eq "<target\b[^>]*\bname=[\"']test[\"']"; then
107 chewi 1.40 local opts task_re junit_re pkg
108 betelgeuse 1.34
109     if [[ ${EANT_TEST_JUNIT_INTO} ]]; then
110     java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit
111     fi
112    
113 chewi 1.40 if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then
114     EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH}"
115     fi
116    
117 betelgeuse 1.34 ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}}
118    
119 chewi 1.40 task_re="\bdev-java/ant-junit(4)?(-[^:]+)?(:\S+)\b"
120     junit_re="\bdev-java/junit(-[^:]+)?(:\S+)\b"
121    
122     if [[ ${DEPEND} =~ ${task_re} ]]; then
123     pkg="ant-junit${BASH_REMATCH[1]}${BASH_REMATCH[3]}"
124     pkg="${pkg%:0}"
125 betelgeuse 1.34
126     if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then
127 chewi 1.40 ANT_TASKS="${ANT_TASKS} ${pkg}"
128 betelgeuse 1.34 else
129 chewi 1.40 ANT_TASKS="${pkg}"
130 betelgeuse 1.34 fi
131 chewi 1.40 elif [[ ${DEPEND} =~ ${junit_re} ]]; then
132     pkg="junit${BASH_REMATCH[2]}"
133     pkg="${pkg%:0}"
134 betelgeuse 1.34
135 chewi 1.40 opts="-Djunit.jar=\"$(java-pkg_getjar ${pkg} junit.jar)\""
136 betelgeuse 1.34
137 chewi 1.40 if [[ ${EANT_GENTOO_CLASSPATH} ]]; then
138     EANT_GENTOO_CLASSPATH+=",${pkg}"
139 betelgeuse 1.34 else
140 chewi 1.40 EANT_GENTOO_CLASSPATH="${pkg}"
141 betelgeuse 1.34 fi
142     fi
143    
144     eant ${opts} -f "${EANT_BUILD_XML}" \
145     ${EANT_EXTRA_ARGS} ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test}
146    
147     else
148     echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}"
149     fi
150     }
151    
152 sera 1.39 # @FUNCTION: java-pkg-2_pkg_preinst
153     # @DESCRIPTION:
154 serkan 1.33 # wrapper for java-utils-2_pkg_preinst
155 sera 1.39
156 betelgeuse 1.29 java-pkg-2_pkg_preinst() {
157 serkan 1.33 java-utils-2_pkg_preinst
158 betelgeuse 1.29 }

  ViewVC Help
Powered by ViewVC 1.1.20