/[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.23 - (hide annotations) (download)
Thu May 17 21:04:43 2007 UTC (7 years, 1 month ago) by caster
Branch: MAIN
Changes since 1.22: +4 -1 lines
Add check for bundled class files along with jar files.

1 nichoj 1.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 caster 1.23 # $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.22 2007/05/07 22:10:46 caster Exp $
9 nichoj 1.1
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 betelgeuse 1.13 # @IUSE
22     #
23     # ebuilds using this eclass can set JAVA_PKG_IUSE and then this eclass
24     # will automatically add deps for them.
25     #
26     # ------------------------------------------------------------------------------
27     IUSE="${JAVA_PKG_IUSE}"
28    
29     # ------------------------------------------------------------------------------
30 nichoj 1.1 # @depend
31     #
32     # Java packages need java-config, and a fairly new release of Portage.
33     #
34     # JAVA_PKG_E_DEPEND is defined in java-utils.eclass.
35     # ------------------------------------------------------------------------------
36     DEPEND="${JAVA_PKG_E_DEPEND}"
37    
38 betelgeuse 1.13 hasq source ${JAVA_PKG_IUSE} && DEPEND="${DEPEND} source? ( app-arch/zip )"
39    
40 nichoj 1.1 # ------------------------------------------------------------------------------
41     # @rdepend
42     #
43     # Nothing special for RDEPEND... just the same as DEPEND.
44     # ------------------------------------------------------------------------------
45     RDEPEND="${DEPEND}"
46    
47 betelgeuse 1.6 EXPORT_FUNCTIONS pkg_setup src_compile
48 nichoj 1.1
49     # ------------------------------------------------------------------------------
50     # @eclass-pkg_setup
51     #
52     # pkg_setup initializes the Java environment
53     # ------------------------------------------------------------------------------
54     java-pkg-2_pkg_setup() {
55     java-pkg_init
56 betelgeuse 1.5 java-pkg_ensure-test
57 nichoj 1.1 }
58    
59     # ------------------------------------------------------------------------------
60 betelgeuse 1.6 # @eclass-src_compile
61     #
62     # Default src_compile for java packages
63     # variables:
64     # EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml)
65 betelgeuse 1.10 # EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value
66 betelgeuse 1.6 # EANT_BUILD_TARGET - the ant target/targets to execute (default: jar)
67     # EANT_DOC_TARGET - the target to build extra docs under the doc use flag
68 caster 1.22 # (default: javadoc; declare empty to disable completely)
69 betelgeuse 1.12 # EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass
70 betelgeuse 1.16 # EANT_EXTRA_ARGS - extra arguments to pass to eant
71 betelgeuse 1.17 # EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment
72 betelgeuse 1.15 # param: Parameters are passed to ant verbatim
73 betelgeuse 1.6 # ------------------------------------------------------------------------------
74     java-pkg-2_src_compile() {
75     if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
76 betelgeuse 1.10 [[ "${EANT_FILTER_COMPILER}" ]] && \
77     java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
78 betelgeuse 1.6 local antflags="${EANT_BUILD_TARGET:=jar}"
79 caster 1.22 if hasq doc ${IUSE} && [[ -n "${EANT_DOC_TARGET=javadoc}" ]]; then
80     antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
81     fi
82 betelgeuse 1.20 local tasks
83     [[ ${EANT_ANT_TASKS} ]] && tasks="${ANT_TASKS} ${EANT_ANT_TASKS}"
84 betelgeuse 1.21 ANT_TASKS="${tasks:-${ANT_TASKS}}" \
85 betelgeuse 1.17 eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGS} "${@}"
86 betelgeuse 1.6 else
87 betelgeuse 1.18 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do."
88 betelgeuse 1.6 fi
89     }
90    
91     # ------------------------------------------------------------------------------
92 swegener 1.3 # @note
93 nichoj 1.1 #
94 swegener 1.3 # We need to initialize the environment in every function because Portage
95 nichoj 1.1 # will source /etc/profile between phases and trample all over the env.
96     # This is accomplished by phase hooks, which is available with newer versions of
97     # portage.
98     # ------------------------------------------------------------------------------
99    
100 caster 1.2 pre_pkg_setup() {
101 nichoj 1.1 java-pkg-2_pkg_setup
102     }
103    
104     pre_src_unpack() {
105     java-pkg-2_pkg_setup
106     }
107    
108     pre_src_compile() {
109 betelgeuse 1.9 if is-java-strict; then
110     echo "Searching for bundled jars:"
111     java-pkg_find-normal-jars || echo "None found."
112 caster 1.23 echo "Searching for bundled classes (no output if none found):"
113     find "${WORKDIR}" -name "*.class"
114     echo "Search done."
115 betelgeuse 1.9 fi
116 nichoj 1.1 java-pkg-2_pkg_setup
117     }
118    
119     pre_src_install() {
120     java-pkg-2_pkg_setup
121     }
122    
123     pre_src_test() {
124     java-pkg-2_pkg_setup
125     }
126    
127     pre_pkg_preinst() {
128     java-pkg-2_pkg_setup
129     }
130    
131     pre_pkg_postinst() {
132     java-pkg-2_pkg_setup
133     }
134    
135     # ------------------------------------------------------------------------------
136     # @eclass-end
137     # ------------------------------------------------------------------------------

  ViewVC Help
Powered by ViewVC 1.1.20