/[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.12 - (show annotations) (download)
Fri Jan 12 16:12:15 2007 UTC (7 years, 11 months ago) by betelgeuse
Branch: MAIN
Changes since 1.11: +2 -12 lines
Moving EANT_GENTOO_CLASSPATH handling to eant implementation so that it can be used automatically in both src_compile and src_test.

1 # Eclass for Java packages
2 #
3 # Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
4 # Copyright (c) 2004-2005, Gentoo Foundation
5 #
6 # Licensed under the GNU General Public License, v2
7 #
8 # $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.11 2007/01/12 13:48:12 betelgeuse Exp $
9
10 inherit java-utils-2
11
12 # -----------------------------------------------------------------------------
13 # @eclass-begin
14 # @eclass-summary Eclass for Java Packages
15 #
16 # This eclass should be inherited for pure Java packages, or by packages which
17 # need to use Java.
18 # -----------------------------------------------------------------------------
19
20 # ------------------------------------------------------------------------------
21 # @depend
22 #
23 # Java packages need java-config, and a fairly new release of Portage.
24 #
25 # JAVA_PKG_E_DEPEND is defined in java-utils.eclass.
26 # ------------------------------------------------------------------------------
27 DEPEND="${JAVA_PKG_E_DEPEND}"
28
29 # ------------------------------------------------------------------------------
30 # @rdepend
31 #
32 # Nothing special for RDEPEND... just the same as DEPEND.
33 # ------------------------------------------------------------------------------
34 RDEPEND="${DEPEND}"
35
36 EXPORT_FUNCTIONS pkg_setup src_compile
37
38 # ------------------------------------------------------------------------------
39 # @eclass-pkg_setup
40 #
41 # pkg_setup initializes the Java environment
42 # ------------------------------------------------------------------------------
43 java-pkg-2_pkg_setup() {
44 java-pkg_init
45 java-pkg_ensure-test
46 }
47
48 # ------------------------------------------------------------------------------
49 # @eclass-src_compile
50 #
51 # Default src_compile for java packages
52 # variables:
53 # EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml)
54 # EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value
55 # EANT_BUILD_TARGET - the ant target/targets to execute (default: jar)
56 # EANT_DOC_TARGET - the target to build extra docs under the doc use flag
57 # (default: the one provided by use_doc in
58 # java-utils-2.eclass)
59 # EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass
60 # EANT_EXTRA_ARGUMENTS - extra arguments to pass to eant
61 # ------------------------------------------------------------------------------
62 java-pkg-2_src_compile() {
63 if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
64 [[ "${EANT_FILTER_COMPILER}" ]] && \
65 java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
66
67 local antflags="${EANT_BUILD_TARGET:=jar}"
68 hasq doc ${IUSE} && antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
69 eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGUMENTS}
70 else
71 echo "${FUNCNAME}: No build.xml found so nothing to do."
72 fi
73 }
74
75 # ------------------------------------------------------------------------------
76 # @note
77 #
78 # We need to initialize the environment in every function because Portage
79 # will source /etc/profile between phases and trample all over the env.
80 # This is accomplished by phase hooks, which is available with newer versions of
81 # portage.
82 # ------------------------------------------------------------------------------
83
84 pre_pkg_setup() {
85 java-pkg-2_pkg_setup
86 }
87
88 pre_src_unpack() {
89 java-pkg-2_pkg_setup
90 }
91
92 pre_src_compile() {
93 if is-java-strict; then
94 echo "Searching for bundled jars:"
95 java-pkg_find-normal-jars || echo "None found."
96 fi
97 java-pkg-2_pkg_setup
98 }
99
100 pre_src_install() {
101 java-pkg-2_pkg_setup
102 }
103
104 pre_src_test() {
105 java-pkg-2_pkg_setup
106 }
107
108 pre_pkg_preinst() {
109 java-pkg-2_pkg_setup
110 }
111
112 pre_pkg_postinst() {
113 java-pkg-2_pkg_setup
114 }
115
116 # ------------------------------------------------------------------------------
117 # @eclass-end
118 # ------------------------------------------------------------------------------

  ViewVC Help
Powered by ViewVC 1.1.20