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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.44

  ViewVC Help
Powered by ViewVC 1.1.20