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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.49 - (hide annotations) (download)
Thu Apr 29 08:40:29 2010 UTC (4 years, 3 months ago) by caster
Branch: MAIN
Changes since 1.48: +6 -1 lines
Skip the src_configure of java-ant-2.eclass when java-pkg-opt-2 is inherited and java USE flag is disabled, to prevent bugs like #317673.

1 nichoj 1.1 # eclass for ant based Java packages
2     #
3     # Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
4     # Copyright (c) 2004-2005, Gentoo Foundation
5 betelgeuse 1.10 # Changes:
6 betelgeuse 1.22 # May 2007:
7     # Made bsfix make one pass for all things and add some glocal targets for
8     # setting up the whole thing. Contributed by kiorky
9     # (kiorky@cryptelium.net).
10 betelgeuse 1.10 # December 2006:
11     # I pretty much rewrote the logic of the bsfix functions
12     # and xml-rewrite.py because they were so slow
13     # Petteri R├Ąty (betelgeuse@gentoo.org)
14 nichoj 1.1 #
15     # Licensed under the GNU General Public License, v2
16     #
17 caster 1.49 # $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.48 2010/02/12 23:51:44 caster Exp $
18 nichoj 1.1
19     inherit java-utils-2
20    
21     # This eclass provides functionality for Java packages which use
22     # ant to build. In particular, it will attempt to fix build.xml files, so that
23     # they use the appropriate 'target' and 'source' attributes.
24    
25 caster 1.14 # -----------------------------------------------------------------------------
26     # @variable-preinherit WANT_ANT_TASKS
27     # @variable-default ""
28     #
29     # Please see the description in java-utils-2.eclass.
30     #WANT_ANT_TASKS
31    
32 caster 1.17 # -----------------------------------------------------------------------------
33     # @variable-preinherit JAVA_ANT_DISABLE_ANT_CORE_DEP
34     # @variable-default unset for java-pkg-2, true for java-pkg-opt-2
35     #
36     # Setting this variable non-empty before inheriting java-ant-2 disables adding
37     # dev-java/ant-core into DEPEND.
38 betelgeuse 1.15
39 caster 1.17 # construct ant-speficic DEPEND
40 betelgeuse 1.38 JAVA_ANT_E_DEPEND=""
41 caster 1.25 # add ant-core into DEPEND, unless disabled
42 caster 1.17 if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then
43     JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.7.0"
44     fi
45 betelgeuse 1.15
46 caster 1.14 # add ant tasks specified in WANT_ANT_TASKS to DEPEND
47     local ANT_TASKS_DEPEND;
48     ANT_TASKS_DEPEND="$(java-pkg_ant-tasks-depend)"
49     # check that java-pkg_ant-tasks-depend didn't fail
50     if [[ $? != 0 ]]; then
51     eerror "${ANT_TASKS_DEPEND}"
52     die "java-pkg_ant-tasks-depend() failed"
53     fi
54 betelgeuse 1.43
55     # We need some tools from javatoolkit. We also need portage 2.1 for phase hooks
56     # and ant dependencies constructed above.
57     JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND}
58 maekke 1.44 ${ANT_TASKS_DEPEND}
59     ${JAVA_PKG_PORTAGE_DEP}
60     >=dev-java/javatoolkit-0.3.0-r2"
61 caster 1.17
62     # this eclass must be inherited after java-pkg-2 or java-pkg-opt-2
63     # if it's java-pkg-opt-2, ant dependencies are pulled based on USE flag
64     if hasq java-pkg-opt-2 ${INHERITED}; then
65     JAVA_ANT_E_DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_ANT_E_DEPEND} )"
66     elif ! hasq java-pkg-2 ${INHERITED}; then
67     eerror "java-ant-2 eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2"
68     fi
69    
70 betelgeuse 1.43 DEPEND="${JAVA_ANT_E_DEPEND}"
71 nichoj 1.1
72     # ------------------------------------------------------------------------------
73 nichoj 1.7 # @global JAVA_PKG_BSFIX
74 nichoj 1.1 #
75     # Should we attempt to 'fix' ant build files to include the source/target
76     # attributes when calling javac?
77     #
78     # default: on
79     # ------------------------------------------------------------------------------
80 nichoj 1.7 JAVA_PKG_BSFIX=${JAVA_PKG_BSFIX:-"on"}
81 nichoj 1.1
82     # ------------------------------------------------------------------------------
83 nichoj 1.7 # @global JAVA_PKG_BSFIX_ALL
84 nichoj 1.1 #
85     # If we're fixing build files, should we try to fix all the ones we can find?
86     #
87     # default: yes
88     # ------------------------------------------------------------------------------
89 nichoj 1.7 JAVA_PKG_BSFIX_ALL=${JAVA_PKG_BSFIX_ALL:-"yes"}
90 nichoj 1.1
91     # ------------------------------------------------------------------------------
92 nichoj 1.5 # @global JAVA_PKG_BSFIX_NAME
93 nichoj 1.1 #
94     # Filename of build files to fix/search for
95     #
96     # default: build.xml
97     # ------------------------------------------------------------------------------
98 nichoj 1.7 JAVA_PKG_BSFIX_NAME=${JAVA_PKG_BSFIX_NAME:-"build.xml"}
99 nichoj 1.1
100     # ------------------------------------------------------------------------------
101 nichoj 1.7 # @global JAVA_PKG_BSFIX_TARGETS_TAGS
102 nichoj 1.1 #
103     # Targets to fix the 'source' attribute in
104     #
105     # default: javac xjavac javac.preset
106     # ------------------------------------------------------------------------------
107 nichoj 1.7 JAVA_PKG_BSFIX_TARGET_TAGS=${JAVA_PKG_BSFIX_TARGET_TAGS:-"javac xjavac javac.preset"}
108 nichoj 1.1
109     # ------------------------------------------------------------------------------
110 nichoj 1.7 # @global JAVA_PKG_BSFIX_SOURCE_TAGS
111 nichoj 1.1 #
112     # Targets to fix the 'target' attribute in
113     #
114     # default: javacdoc javac xjavac javac.preset
115     # ------------------------------------------------------------------------------
116 nichoj 1.7 JAVA_PKG_BSFIX_SOURCE_TAGS=${JAVA_PKG_BSFIX_SOURCE_TAGS:-"javadoc javac xjavac javac.preset"}
117 nichoj 1.1
118     # ------------------------------------------------------------------------------
119 betelgeuse 1.30 # @global JAVA_ANT_CLASSPATH_TAGS
120     #
121     # Targets to add the classpath attribute to
122     #
123     # default: javac xjavac
124     # ------------------------------------------------------------------------------
125     JAVA_ANT_CLASSPATH_TAGS="javac xjavac"
126    
127     # ------------------------------------------------------------------------------
128 betelgeuse 1.23 # @global JAVA_ANT_IGNORE_SYSTEM_CLASSES
129 nichoj 1.1 #
130 betelgeuse 1.23 # Rewrites available tasks to ignore ant classpath.
131 nichoj 1.1 #
132 betelgeuse 1.23 # default: off
133 nichoj 1.1 # ------------------------------------------------------------------------------
134    
135 caster 1.47 case "${EAPI:-0}" in
136     0|1) : ;;
137     *) EXPORT_FUNCTIONS src_configure ;;
138     esac
139 betelgeuse 1.40
140     # ------------------------------------------------------------------------------
141     # @eclass-src_configure
142     #
143     # src_configure rewrites the build.xml files
144     # ------------------------------------------------------------------------------
145     java-ant-2_src_configure() {
146 caster 1.49 # if java support is optional, don't perform this when the USE flag is off
147     if hasq java-pkg-opt-2 ${INHERITED}; then
148     use ${JAVA_PKG_OPT_USE} || return
149     fi
150    
151 betelgeuse 1.40 # eant will call us unless called by Portage
152     [[ -e "${T}/java-ant-2_src_configure-run" ]] && return
153    
154     [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" ]] \
155     && java-ant_ignore-system-classes "${S}/build.xml"
156    
157     java-ant_bsfix
158     touch "${T}/java-ant-2_src_configure-run"
159 maekke 1.44 }
160 betelgeuse 1.40
161 nichoj 1.1 # ------------------------------------------------------------------------------
162     # @private java-ant_bsfix
163     #
164     # Attempts to fix build files. The following variables will affect its behavior
165     # as listed above:
166     # JAVA_PKG_BSFIX
167     # JAVA_PKG_BSFIX_ALL
168     # JAVA_PKG_BSFIX_NAME,
169     # ------------------------------------------------------------------------------
170     java-ant_bsfix() {
171     debug-print-function ${FUNCNAME} $*
172    
173 nelchael 1.4 [[ "${JAVA_PKG_BSFIX}" != "on" ]] && return
174     if ! java-pkg_needs-vm; then
175 nichoj 1.1 echo "QA Notice: Package is using java-ant, but doesn't depend on a Java VM"
176     fi
177    
178 betelgeuse 1.10 pushd "${S}" >/dev/null
179 nelchael 1.4
180 nichoj 1.7 local find_args=""
181     [[ "${JAVA_PKG_BSFIX_ALL}" == "yes" ]] || find_args="-maxdepth 1"
182 swegener 1.8
183 nichoj 1.7 find_args="${find_args} -type f -name ${JAVA_PKG_BSFIX_NAME// / -o -name } "
184 nichoj 1.1
185 betelgeuse 1.10 # This voodoo is done for paths with spaces
186     local bsfix_these
187 nichoj 1.1 while read line; do
188     [[ -z ${line} ]] && continue
189 betelgeuse 1.10 bsfix_these="${bsfix_these} '${line}'"
190 swegener 1.8 done <<-EOF
191 flameeyes 1.3 $(find . ${find_args})
192 nichoj 1.1 EOF
193    
194 betelgeuse 1.10 [[ "${bsfix_these// /}" ]] && eval java-ant_bsfix_files ${bsfix_these}
195    
196     popd > /dev/null
197 nelchael 1.4 }
198    
199 betelgeuse 1.11 _bsfix_die() {
200     if has_version dev-python/pyxml; then
201     eerror "If the output above contains:"
202     eerror "ImportError:"
203     eerror "/usr/lib/python2.4/site-packages/_xmlplus/parsers/pyexpat.so:"
204     eerror "undefined symbol: PyUnicodeUCS2_DecodeUTF8"
205     eerror "Try re-emerging dev-python/pyxml"
206     die ${1} " Look at the eerror message above"
207     else
208     die ${1}
209     fi
210     }
211    
212 nelchael 1.4 # ------------------------------------------------------------------------------
213 betelgeuse 1.10 # @public java-ant_bsfix_files
214 nelchael 1.4 #
215 betelgeuse 1.10 # Attempts to fix named build files. The following variables will affect its behavior
216 nelchael 1.4 # as listed above:
217     # JAVA_PKG_BSFIX_SOURCE_TAGS
218     # JAVA_PKG_BSFIX_TARGET_TAGS
219 betelgeuse 1.22 # JAVA_ANT_REWRITE_CLASSPATH
220     # JAVA_ANT_JAVADOC_INPUT_DIRS: Where we can find java sources for javadoc
221     # input. Can be a space separated list of
222     # directories
223     # JAVA_ANT_BSFIX_EXTRA_ARGS: You can use this to pass extra variables to the
224     # rewriter if you know what you are doing.
225     #
226     # If JAVA_ANT_JAVADOC_INPUT_DIRS is set, we will turn on the adding of a basic
227     # javadoc target to the ant's build.xml with the javadoc xml-rewriter feature.
228     # Then we will set EANT DOC TARGET to the added javadoc target
229     # NOTE: the variable JAVA_ANT_JAVADOC_OUTPUT_DIR points where we will
230     # generate the javadocs. This is a read-only variable, dont change it.
231    
232 betelgeuse 1.10 # When changing this function, make sure that it works with paths with spaces in
233     # them.
234 nelchael 1.4 # ------------------------------------------------------------------------------
235 betelgeuse 1.10 java-ant_bsfix_files() {
236 nelchael 1.4 debug-print-function ${FUNCNAME} $*
237    
238 betelgeuse 1.10 [[ ${#} = 0 ]] && die "${FUNCNAME} called without arguments"
239 nelchael 1.4
240 nichoj 1.1 local want_source="$(java-pkg_get-source)"
241     local want_target="$(java-pkg_get-target)"
242    
243 betelgeuse 1.10 debug-print "${FUNCNAME}: target: ${want_target} source: ${want_source}"
244 nichoj 1.1
245     if [ -z "${want_source}" -o -z "${want_target}" ]; then
246     eerror "Could not find valid -source/-target values"
247     eerror "Please file a bug about this on bugs.gentoo.org"
248     die "Could not find valid -source/-target values"
249     else
250 betelgeuse 1.10 local files
251 nelchael 1.4
252 betelgeuse 1.10 for file in "${@}"; do
253     debug-print "${FUNCNAME}: ${file}"
254 nelchael 1.4
255 betelgeuse 1.10 if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
256     cp "${file}" "${file}.orig" || die "failed to copy ${file}"
257     fi
258    
259     if [[ ! -w "${file}" ]]; then
260     chmod u+w "${file}" || die "chmod u+w ${file} failed"
261     fi
262    
263     files="${files} -f '${file}'"
264     done
265    
266 betelgeuse 1.28 # Play nice with paludis
267     if [[ $(type -t quiet_mode) = function ]] && quiet_mode; then
268     local output=">/dev/null"
269     fi
270 betelgeuse 1.22
271 betelgeuse 1.28 # for javadoc target and all in one pass, we need the new rewriter.
272     local rewriter3="/usr/share/javatoolkit/xml-rewrite-3.py"
273 ali_bush 1.33 if [[ ! -f ${rewriter3} ]]; then
274     rewriter3="/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-3.py"
275     fi
276    
277 betelgeuse 1.36 local rewriter4="/usr/$(get_libdir)/javatoolkit/bin/build-xml-rewrite"
278    
279     if [[ -x ${rewriter4} && ${JAVA_ANT_ENCODING} ]]; then
280     [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]] && local gcp="-g"
281     [[ ${JAVA_ANT_ENCODING} ]] && local enc="-e ${JAVA_ANT_ENCODING}"
282     eval echo "cElementTree rewriter" ${output}
283     debug-print "${rewriter4} extra args: ${gcp} ${enc}"
284     ${rewriter4} ${gcp} ${enc} \
285     -c "${JAVA_PKG_BSFIX_SOURCE_TAGS}" source ${want_source} \
286     -c "${JAVA_PKG_BSFIX_TARGET_TAGS}" target ${want_target} \
287     "${@}" || die "build-xml-rewrite failed"
288     elif [[ ! -f ${rewriter3} ]]; then
289 betelgeuse 1.28 debug-print "Using second generation rewriter"
290     eval echo "Rewriting source attributes" ${output}
291 ali_bush 1.32 eval xml-rewrite-2.py ${files} \
292 betelgeuse 1.28 -c -e ${JAVA_PKG_BSFIX_SOURCE_TAGS// / -e } \
293 ali_bush 1.32 -a source -v ${want_source} ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
294 betelgeuse 1.28
295     eval echo "Rewriting target attributes" ${output}
296 ali_bush 1.32 eval xml-rewrite-2.py ${files} \
297 betelgeuse 1.28 -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
298 ali_bush 1.32 -a target -v ${want_target} ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
299 betelgeuse 1.28
300     eval echo "Rewriting nowarn attributes" ${output}
301 ali_bush 1.32 eval xml-rewrite-2.py ${files} \
302 betelgeuse 1.28 -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
303 ali_bush 1.32 -a nowarn -v yes ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
304 betelgeuse 1.22
305 betelgeuse 1.28 if [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then
306     eval echo "Adding gentoo.classpath to javac tasks" ${output}
307 ali_bush 1.32 eval xml-rewrite-2.py ${files} \
308 betelgeuse 1.28 -c -e javac -e xjavac -a classpath -v \
309 ali_bush 1.32 '\${gentoo.classpath}' \
310     || _bsfix_die "xml-rewrite2 failed"
311 betelgeuse 1.28 fi
312     else
313     debug-print "Using third generation rewriter"
314     eval echo "Rewriting attributes" ${output}
315     local bsfix_extra_args=""
316     # WARNING KEEP THE ORDER, ESPECIALLY FOR CHANGED ATTRIBUTES!
317     if [[ -n ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then
318 betelgeuse 1.45 local cp_tags="${JAVA_ANT_CLASSPATH_TAGS// / -e }"
319     bsfix_extra_args="${bsfix_extra_args} -g -e ${cp_tags}"
320 betelgeuse 1.28 bsfix_extra_args="${bsfix_extra_args} -a classpath -v '\${gentoo.classpath}'"
321     fi
322     if [[ -n ${JAVA_ANT_JAVADOC_INPUT_DIRS} ]]; then
323     if [[ -n ${JAVA_ANT_JAVADOC_OUTPUT_DIR} ]]; then
324     die "Do not define JAVA_ANT_JAVADOC_OUTPUT_DIR!"
325     fi
326     # Where will our generated javadoc go.
327 betelgeuse 1.29 readonly JAVA_ANT_JAVADOC_OUTPUT_DIR="${WORKDIR}/gentoo_javadoc"
328 betelgeuse 1.28 mkdir -p "${JAVA_ANT_JAVADOC_OUTPUT_DIR}" || die
329    
330     if hasq doc ${IUSE}; then
331     if use doc; then
332     if [[ -z ${EANT_DOC_TARGET} ]]; then
333     EANT_DOC_TARGET="gentoojavadoc"
334     else
335     die "You can't use javadoc adding and set EANT_DOC_TARGET too."
336     fi
337 betelgeuse 1.22
338 betelgeuse 1.28 for dir in ${JAVA_ANT_JAVADOC_INPUT_DIRS};do
339     if [[ ! -d ${dir} ]]; then
340     eerror "This dir: ${dir} doesnt' exists"
341     die "You must specify directories for javadoc input/output dirs."
342 betelgeuse 1.22 fi
343 betelgeuse 1.28 done
344     bsfix_extra_args="${bsfix_extra_args} --javadoc --source-directory "
345     # filter third/double spaces
346     JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /}
347     JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /}
348     bsfix_extra_args="${bsfix_extra_args} ${JAVA_ANT_JAVADOC_INPUT_DIRS// / --source-directory }"
349     bsfix_extra_args="${bsfix_extra_args} --output-directory ${JAVA_ANT_JAVADOC_OUTPUT_DIR}"
350 betelgeuse 1.22 fi
351 betelgeuse 1.28 else
352     die "You need to have doc in IUSE when using JAVA_ANT_JAVADOC_INPUT_DIRS"
353 betelgeuse 1.22 fi
354 betelgeuse 1.28 fi
355 betelgeuse 1.22
356 betelgeuse 1.28 [[ -n ${JAVA_ANT_BSFIX_EXTRA_ARGS} ]] \
357     && bsfix_extra_args="${bsfix_extra_args} ${JAVA_ANT_BSFIX_EXTRA_ARGS}"
358 betelgeuse 1.22
359 betelgeuse 1.45 debug-print "bsfix_extra_args: ${bsfix_extra_args}"
360    
361 betelgeuse 1.28 eval ${rewriter3} ${files} \
362     -c --source-element ${JAVA_PKG_BSFIX_SOURCE_TAGS// / --source-element } \
363     --source-attribute source --source-value ${want_source} \
364     --target-element ${JAVA_PKG_BSFIX_TARGET_TAGS// / --target-element } \
365     --target-attribute target --target-value ${want_target} \
366     --target-attribute nowarn --target-value yes \
367     ${bsfix_extra_args} \
368     ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
369 betelgeuse 1.10 fi
370 nelchael 1.4
371     if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
372 betelgeuse 1.10 for file in "${@}"; do
373     diff -NurbB "${file}.orig" "${file}"
374     done
375 nelchael 1.4 fi
376 nichoj 1.1 fi
377 betelgeuse 1.24 return 0 # so that the 1 for diff doesn't get reported
378 nichoj 1.1 }
379 nelchael 1.6
380 betelgeuse 1.10
381     # ------------------------------------------------------------------------------
382     # @public java-ant_bsfix_one
383     #
384     # Attempts to fix named build file. The following variables will affect its behavior
385     # as listed above:
386     # JAVA_PKG_BSFIX_SOURCE_TAGS
387     # JAVA_PKG_BSFIX_TARGET_TAGS
388     # ------------------------------------------------------------------------------
389     java-ant_bsfix_one() {
390     debug-print-function ${FUNCNAME} $*
391    
392     if [ -z "${1}" ]; then
393     eerror "${FUNCNAME} needs one argument"
394     die "${FUNCNAME} needs one argument"
395     fi
396    
397     java-ant_bsfix_files "${1}"
398     }
399    
400 nelchael 1.6 # ------------------------------------------------------------------------------
401     # @public java-ant_rewrite-classpath
402     #
403     # Adds 'classpath="${gentoo.classpath}"' to specified build file.
404 betelgeuse 1.30 # Affected by:
405     # JAVA_ANT_CLASSPATH_TAGS
406 betelgeuse 1.12 # @param $1 - the file to rewrite (defaults to build.xml)
407 nelchael 1.6 # ------------------------------------------------------------------------------
408     java-ant_rewrite-classpath() {
409     debug-print-function ${FUNCNAME} $*
410    
411 betelgeuse 1.12 local file="${1}"
412     [[ -z "${1}" ]] && file=build.xml
413 betelgeuse 1.24 [[ ${#} -gt 1 ]] && die "${FUNCNAME} currently can only rewrite one file."
414 nelchael 1.6
415     echo "Adding gentoo.classpath to ${file}"
416     debug-print "java-ant_rewrite-classpath: ${file}"
417    
418     cp "${file}" "${file}.orig" || die "failed to copy ${file}"
419    
420     chmod u+w "${file}"
421    
422 betelgeuse 1.30 java-ant_xml-rewrite -f "${file}" --change \
423     -e ${JAVA_ANT_CLASSPATH_TAGS// / -e } -a classpath -v '${gentoo.classpath}'
424 nelchael 1.6
425     if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
426     diff -NurbB "${file}.orig" "${file}"
427     fi
428     }
429 betelgeuse 1.12
430     # ------------------------------------------------------------------------------
431     # @public java-ant_ignore-system-classes
432     #
433     # Makes the available task ignore classes in the system classpath
434     # @param $1 - the file to rewrite (defaults to build.xml)
435     # ------------------------------------------------------------------------------
436     java-ant_ignore-system-classes() {
437     debug-print-function ${FUNCNAME} $*
438 betelgeuse 1.36 local file=${1:-build.xml}
439     echo "Changing ignoresystemclasses to true for available tasks in ${file}"
440 betelgeuse 1.12 java-ant_xml-rewrite -f "${file}" --change \
441     -e available -a ignoresystemclasses -v "true"
442     }
443    
444     # ------------------------------------------------------------------------------
445     # @public java-ant_xml-rewrite
446     # Run the right xml-rewrite binary with the given arguments
447     # ------------------------------------------------------------------------------
448     java-ant_xml-rewrite() {
449 ali_bush 1.32 local gen2="/usr/bin/xml-rewrite-2.py"
450 ali_bush 1.33 local gen2_1="/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-2.py"
451 ali_bush 1.31 # gen1 is deprecated
452 betelgeuse 1.12 if [[ -x "${gen2}" ]]; then
453 ali_bush 1.32 ${gen2} "${@}" || die "${gen2} failed"
454 ali_bush 1.34 elif [[ -x "${gen2_1}" ]]; then
455 ali_bush 1.35 ${gen2_1} "${@}" || die "${gen2_1} failed"
456 betelgeuse 1.12 else
457     eerror "No binary for rewriting found."
458     eerror "Do you have dev-java/javatoolkit installed?"
459     die "xml-rewrite not found"
460     fi
461     }
462 caster 1.46
463     # ------------------------------------------------------------------------------
464     # @public java-ant_rewrite-bootclasspath
465     #
466     # Adds bootclasspath to javac-like tasks in build.xml filled with jars of a
467     # bootclasspath package of given version.
468     #
469     # Affected by:
470     # JAVA_PKG_BSFIX_TARGET_TAGS - the tags of javac tasks
471     #
472     # @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
473     # of the current JDK
474     # @param $2 - path to desired build.xml file, defaults to 'build.xml'
475     # @param $3 - (optional) what to prepend the bootclasspath with (to override)
476     # @param $4 - (optional) what to append to the bootclasspath
477     # ------------------------------------------------------------------------------
478    
479     java-ant_rewrite-bootclasspath() {
480     local version="${1}"
481     local file="${2-build.xml}"
482     local extra_before="${3}"
483     local extra_after="${4}"
484    
485 caster 1.48 local bcp="$(java-pkg_get-bootclasspath "${version}")"
486    
487 caster 1.46 if [[ -n "${extra_before}" ]]; then
488     bcp="${extra_before}:${bcp}"
489     fi
490     if [[ -n "${extra_after}" ]]; then
491     bcp="${bcp}:${extra_after}"
492     fi
493    
494     java-ant_xml-rewrite -f "${file}" -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
495     -a bootclasspath -v "${bcp}"
496     }

  ViewVC Help
Powered by ViewVC 1.1.20