/[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.48 - (hide annotations) (download)
Fri Feb 12 23:51:44 2010 UTC (4 years, 2 months ago) by caster
Branch: MAIN
Changes since 1.47: +3 -14 lines
Add a separate java-pkg_get-bootclasspath function and make java-pkg_rewrite-bootclasspath use it.

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.48 # $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.47 2010/02/01 09:38: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     # eant will call us unless called by Portage
147     [[ -e "${T}/java-ant-2_src_configure-run" ]] && return
148    
149     [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" ]] \
150     && java-ant_ignore-system-classes "${S}/build.xml"
151    
152     java-ant_bsfix
153     touch "${T}/java-ant-2_src_configure-run"
154 maekke 1.44 }
155 betelgeuse 1.40
156 nichoj 1.1 # ------------------------------------------------------------------------------
157     # @private java-ant_bsfix
158     #
159     # Attempts to fix build files. The following variables will affect its behavior
160     # as listed above:
161     # JAVA_PKG_BSFIX
162     # JAVA_PKG_BSFIX_ALL
163     # JAVA_PKG_BSFIX_NAME,
164     # ------------------------------------------------------------------------------
165     java-ant_bsfix() {
166     debug-print-function ${FUNCNAME} $*
167    
168 nelchael 1.4 [[ "${JAVA_PKG_BSFIX}" != "on" ]] && return
169     if ! java-pkg_needs-vm; then
170 nichoj 1.1 echo "QA Notice: Package is using java-ant, but doesn't depend on a Java VM"
171     fi
172    
173 betelgeuse 1.10 pushd "${S}" >/dev/null
174 nelchael 1.4
175 nichoj 1.7 local find_args=""
176     [[ "${JAVA_PKG_BSFIX_ALL}" == "yes" ]] || find_args="-maxdepth 1"
177 swegener 1.8
178 nichoj 1.7 find_args="${find_args} -type f -name ${JAVA_PKG_BSFIX_NAME// / -o -name } "
179 nichoj 1.1
180 betelgeuse 1.10 # This voodoo is done for paths with spaces
181     local bsfix_these
182 nichoj 1.1 while read line; do
183     [[ -z ${line} ]] && continue
184 betelgeuse 1.10 bsfix_these="${bsfix_these} '${line}'"
185 swegener 1.8 done <<-EOF
186 flameeyes 1.3 $(find . ${find_args})
187 nichoj 1.1 EOF
188    
189 betelgeuse 1.10 [[ "${bsfix_these// /}" ]] && eval java-ant_bsfix_files ${bsfix_these}
190    
191     popd > /dev/null
192 nelchael 1.4 }
193    
194 betelgeuse 1.11 _bsfix_die() {
195     if has_version dev-python/pyxml; then
196     eerror "If the output above contains:"
197     eerror "ImportError:"
198     eerror "/usr/lib/python2.4/site-packages/_xmlplus/parsers/pyexpat.so:"
199     eerror "undefined symbol: PyUnicodeUCS2_DecodeUTF8"
200     eerror "Try re-emerging dev-python/pyxml"
201     die ${1} " Look at the eerror message above"
202     else
203     die ${1}
204     fi
205     }
206    
207 nelchael 1.4 # ------------------------------------------------------------------------------
208 betelgeuse 1.10 # @public java-ant_bsfix_files
209 nelchael 1.4 #
210 betelgeuse 1.10 # Attempts to fix named build files. The following variables will affect its behavior
211 nelchael 1.4 # as listed above:
212     # JAVA_PKG_BSFIX_SOURCE_TAGS
213     # JAVA_PKG_BSFIX_TARGET_TAGS
214 betelgeuse 1.22 # JAVA_ANT_REWRITE_CLASSPATH
215     # JAVA_ANT_JAVADOC_INPUT_DIRS: Where we can find java sources for javadoc
216     # input. Can be a space separated list of
217     # directories
218     # JAVA_ANT_BSFIX_EXTRA_ARGS: You can use this to pass extra variables to the
219     # rewriter if you know what you are doing.
220     #
221     # If JAVA_ANT_JAVADOC_INPUT_DIRS is set, we will turn on the adding of a basic
222     # javadoc target to the ant's build.xml with the javadoc xml-rewriter feature.
223     # Then we will set EANT DOC TARGET to the added javadoc target
224     # NOTE: the variable JAVA_ANT_JAVADOC_OUTPUT_DIR points where we will
225     # generate the javadocs. This is a read-only variable, dont change it.
226    
227 betelgeuse 1.10 # When changing this function, make sure that it works with paths with spaces in
228     # them.
229 nelchael 1.4 # ------------------------------------------------------------------------------
230 betelgeuse 1.10 java-ant_bsfix_files() {
231 nelchael 1.4 debug-print-function ${FUNCNAME} $*
232    
233 betelgeuse 1.10 [[ ${#} = 0 ]] && die "${FUNCNAME} called without arguments"
234 nelchael 1.4
235 nichoj 1.1 local want_source="$(java-pkg_get-source)"
236     local want_target="$(java-pkg_get-target)"
237    
238 betelgeuse 1.10 debug-print "${FUNCNAME}: target: ${want_target} source: ${want_source}"
239 nichoj 1.1
240     if [ -z "${want_source}" -o -z "${want_target}" ]; then
241     eerror "Could not find valid -source/-target values"
242     eerror "Please file a bug about this on bugs.gentoo.org"
243     die "Could not find valid -source/-target values"
244     else
245 betelgeuse 1.10 local files
246 nelchael 1.4
247 betelgeuse 1.10 for file in "${@}"; do
248     debug-print "${FUNCNAME}: ${file}"
249 nelchael 1.4
250 betelgeuse 1.10 if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
251     cp "${file}" "${file}.orig" || die "failed to copy ${file}"
252     fi
253    
254     if [[ ! -w "${file}" ]]; then
255     chmod u+w "${file}" || die "chmod u+w ${file} failed"
256     fi
257    
258     files="${files} -f '${file}'"
259     done
260    
261 betelgeuse 1.28 # Play nice with paludis
262     if [[ $(type -t quiet_mode) = function ]] && quiet_mode; then
263     local output=">/dev/null"
264     fi
265 betelgeuse 1.22
266 betelgeuse 1.28 # for javadoc target and all in one pass, we need the new rewriter.
267     local rewriter3="/usr/share/javatoolkit/xml-rewrite-3.py"
268 ali_bush 1.33 if [[ ! -f ${rewriter3} ]]; then
269     rewriter3="/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-3.py"
270     fi
271    
272 betelgeuse 1.36 local rewriter4="/usr/$(get_libdir)/javatoolkit/bin/build-xml-rewrite"
273    
274     if [[ -x ${rewriter4} && ${JAVA_ANT_ENCODING} ]]; then
275     [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]] && local gcp="-g"
276     [[ ${JAVA_ANT_ENCODING} ]] && local enc="-e ${JAVA_ANT_ENCODING}"
277     eval echo "cElementTree rewriter" ${output}
278     debug-print "${rewriter4} extra args: ${gcp} ${enc}"
279     ${rewriter4} ${gcp} ${enc} \
280     -c "${JAVA_PKG_BSFIX_SOURCE_TAGS}" source ${want_source} \
281     -c "${JAVA_PKG_BSFIX_TARGET_TAGS}" target ${want_target} \
282     "${@}" || die "build-xml-rewrite failed"
283     elif [[ ! -f ${rewriter3} ]]; then
284 betelgeuse 1.28 debug-print "Using second generation rewriter"
285     eval echo "Rewriting source attributes" ${output}
286 ali_bush 1.32 eval xml-rewrite-2.py ${files} \
287 betelgeuse 1.28 -c -e ${JAVA_PKG_BSFIX_SOURCE_TAGS// / -e } \
288 ali_bush 1.32 -a source -v ${want_source} ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
289 betelgeuse 1.28
290     eval echo "Rewriting target attributes" ${output}
291 ali_bush 1.32 eval xml-rewrite-2.py ${files} \
292 betelgeuse 1.28 -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
293 ali_bush 1.32 -a target -v ${want_target} ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
294 betelgeuse 1.28
295     eval echo "Rewriting nowarn 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 nowarn -v yes ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
299 betelgeuse 1.22
300 betelgeuse 1.28 if [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then
301     eval echo "Adding gentoo.classpath to javac tasks" ${output}
302 ali_bush 1.32 eval xml-rewrite-2.py ${files} \
303 betelgeuse 1.28 -c -e javac -e xjavac -a classpath -v \
304 ali_bush 1.32 '\${gentoo.classpath}' \
305     || _bsfix_die "xml-rewrite2 failed"
306 betelgeuse 1.28 fi
307     else
308     debug-print "Using third generation rewriter"
309     eval echo "Rewriting attributes" ${output}
310     local bsfix_extra_args=""
311     # WARNING KEEP THE ORDER, ESPECIALLY FOR CHANGED ATTRIBUTES!
312     if [[ -n ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then
313 betelgeuse 1.45 local cp_tags="${JAVA_ANT_CLASSPATH_TAGS// / -e }"
314     bsfix_extra_args="${bsfix_extra_args} -g -e ${cp_tags}"
315 betelgeuse 1.28 bsfix_extra_args="${bsfix_extra_args} -a classpath -v '\${gentoo.classpath}'"
316     fi
317     if [[ -n ${JAVA_ANT_JAVADOC_INPUT_DIRS} ]]; then
318     if [[ -n ${JAVA_ANT_JAVADOC_OUTPUT_DIR} ]]; then
319     die "Do not define JAVA_ANT_JAVADOC_OUTPUT_DIR!"
320     fi
321     # Where will our generated javadoc go.
322 betelgeuse 1.29 readonly JAVA_ANT_JAVADOC_OUTPUT_DIR="${WORKDIR}/gentoo_javadoc"
323 betelgeuse 1.28 mkdir -p "${JAVA_ANT_JAVADOC_OUTPUT_DIR}" || die
324    
325     if hasq doc ${IUSE}; then
326     if use doc; then
327     if [[ -z ${EANT_DOC_TARGET} ]]; then
328     EANT_DOC_TARGET="gentoojavadoc"
329     else
330     die "You can't use javadoc adding and set EANT_DOC_TARGET too."
331     fi
332 betelgeuse 1.22
333 betelgeuse 1.28 for dir in ${JAVA_ANT_JAVADOC_INPUT_DIRS};do
334     if [[ ! -d ${dir} ]]; then
335     eerror "This dir: ${dir} doesnt' exists"
336     die "You must specify directories for javadoc input/output dirs."
337 betelgeuse 1.22 fi
338 betelgeuse 1.28 done
339     bsfix_extra_args="${bsfix_extra_args} --javadoc --source-directory "
340     # filter third/double spaces
341     JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /}
342     JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /}
343     bsfix_extra_args="${bsfix_extra_args} ${JAVA_ANT_JAVADOC_INPUT_DIRS// / --source-directory }"
344     bsfix_extra_args="${bsfix_extra_args} --output-directory ${JAVA_ANT_JAVADOC_OUTPUT_DIR}"
345 betelgeuse 1.22 fi
346 betelgeuse 1.28 else
347     die "You need to have doc in IUSE when using JAVA_ANT_JAVADOC_INPUT_DIRS"
348 betelgeuse 1.22 fi
349 betelgeuse 1.28 fi
350 betelgeuse 1.22
351 betelgeuse 1.28 [[ -n ${JAVA_ANT_BSFIX_EXTRA_ARGS} ]] \
352     && bsfix_extra_args="${bsfix_extra_args} ${JAVA_ANT_BSFIX_EXTRA_ARGS}"
353 betelgeuse 1.22
354 betelgeuse 1.45 debug-print "bsfix_extra_args: ${bsfix_extra_args}"
355    
356 betelgeuse 1.28 eval ${rewriter3} ${files} \
357     -c --source-element ${JAVA_PKG_BSFIX_SOURCE_TAGS// / --source-element } \
358     --source-attribute source --source-value ${want_source} \
359     --target-element ${JAVA_PKG_BSFIX_TARGET_TAGS// / --target-element } \
360     --target-attribute target --target-value ${want_target} \
361     --target-attribute nowarn --target-value yes \
362     ${bsfix_extra_args} \
363     ${output} || _bsfix_die "xml-rewrite2 failed: ${file}"
364 betelgeuse 1.10 fi
365 nelchael 1.4
366     if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
367 betelgeuse 1.10 for file in "${@}"; do
368     diff -NurbB "${file}.orig" "${file}"
369     done
370 nelchael 1.4 fi
371 nichoj 1.1 fi
372 betelgeuse 1.24 return 0 # so that the 1 for diff doesn't get reported
373 nichoj 1.1 }
374 nelchael 1.6
375 betelgeuse 1.10
376     # ------------------------------------------------------------------------------
377     # @public java-ant_bsfix_one
378     #
379     # Attempts to fix named build file. The following variables will affect its behavior
380     # as listed above:
381     # JAVA_PKG_BSFIX_SOURCE_TAGS
382     # JAVA_PKG_BSFIX_TARGET_TAGS
383     # ------------------------------------------------------------------------------
384     java-ant_bsfix_one() {
385     debug-print-function ${FUNCNAME} $*
386    
387     if [ -z "${1}" ]; then
388     eerror "${FUNCNAME} needs one argument"
389     die "${FUNCNAME} needs one argument"
390     fi
391    
392     java-ant_bsfix_files "${1}"
393     }
394    
395 nelchael 1.6 # ------------------------------------------------------------------------------
396     # @public java-ant_rewrite-classpath
397     #
398     # Adds 'classpath="${gentoo.classpath}"' to specified build file.
399 betelgeuse 1.30 # Affected by:
400     # JAVA_ANT_CLASSPATH_TAGS
401 betelgeuse 1.12 # @param $1 - the file to rewrite (defaults to build.xml)
402 nelchael 1.6 # ------------------------------------------------------------------------------
403     java-ant_rewrite-classpath() {
404     debug-print-function ${FUNCNAME} $*
405    
406 betelgeuse 1.12 local file="${1}"
407     [[ -z "${1}" ]] && file=build.xml
408 betelgeuse 1.24 [[ ${#} -gt 1 ]] && die "${FUNCNAME} currently can only rewrite one file."
409 nelchael 1.6
410     echo "Adding gentoo.classpath to ${file}"
411     debug-print "java-ant_rewrite-classpath: ${file}"
412    
413     cp "${file}" "${file}.orig" || die "failed to copy ${file}"
414    
415     chmod u+w "${file}"
416    
417 betelgeuse 1.30 java-ant_xml-rewrite -f "${file}" --change \
418     -e ${JAVA_ANT_CLASSPATH_TAGS// / -e } -a classpath -v '${gentoo.classpath}'
419 nelchael 1.6
420     if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
421     diff -NurbB "${file}.orig" "${file}"
422     fi
423     }
424 betelgeuse 1.12
425     # ------------------------------------------------------------------------------
426     # @public java-ant_ignore-system-classes
427     #
428     # Makes the available task ignore classes in the system classpath
429     # @param $1 - the file to rewrite (defaults to build.xml)
430     # ------------------------------------------------------------------------------
431     java-ant_ignore-system-classes() {
432     debug-print-function ${FUNCNAME} $*
433 betelgeuse 1.36 local file=${1:-build.xml}
434     echo "Changing ignoresystemclasses to true for available tasks in ${file}"
435 betelgeuse 1.12 java-ant_xml-rewrite -f "${file}" --change \
436     -e available -a ignoresystemclasses -v "true"
437     }
438    
439     # ------------------------------------------------------------------------------
440     # @public java-ant_xml-rewrite
441     # Run the right xml-rewrite binary with the given arguments
442     # ------------------------------------------------------------------------------
443     java-ant_xml-rewrite() {
444 ali_bush 1.32 local gen2="/usr/bin/xml-rewrite-2.py"
445 ali_bush 1.33 local gen2_1="/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-2.py"
446 ali_bush 1.31 # gen1 is deprecated
447 betelgeuse 1.12 if [[ -x "${gen2}" ]]; then
448 ali_bush 1.32 ${gen2} "${@}" || die "${gen2} failed"
449 ali_bush 1.34 elif [[ -x "${gen2_1}" ]]; then
450 ali_bush 1.35 ${gen2_1} "${@}" || die "${gen2_1} failed"
451 betelgeuse 1.12 else
452     eerror "No binary for rewriting found."
453     eerror "Do you have dev-java/javatoolkit installed?"
454     die "xml-rewrite not found"
455     fi
456     }
457 caster 1.46
458     # ------------------------------------------------------------------------------
459     # @public java-ant_rewrite-bootclasspath
460     #
461     # Adds bootclasspath to javac-like tasks in build.xml filled with jars of a
462     # bootclasspath package of given version.
463     #
464     # Affected by:
465     # JAVA_PKG_BSFIX_TARGET_TAGS - the tags of javac tasks
466     #
467     # @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
468     # of the current JDK
469     # @param $2 - path to desired build.xml file, defaults to 'build.xml'
470     # @param $3 - (optional) what to prepend the bootclasspath with (to override)
471     # @param $4 - (optional) what to append to the bootclasspath
472     # ------------------------------------------------------------------------------
473    
474     java-ant_rewrite-bootclasspath() {
475     local version="${1}"
476     local file="${2-build.xml}"
477     local extra_before="${3}"
478     local extra_after="${4}"
479    
480 caster 1.48 local bcp="$(java-pkg_get-bootclasspath "${version}")"
481    
482 caster 1.46 if [[ -n "${extra_before}" ]]; then
483     bcp="${extra_before}:${bcp}"
484     fi
485     if [[ -n "${extra_after}" ]]; then
486     bcp="${bcp}:${extra_after}"
487     fi
488    
489     java-ant_xml-rewrite -f "${file}" -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
490     -a bootclasspath -v "${bcp}"
491     }

  ViewVC Help
Powered by ViewVC 1.1.20