/[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.11 Revision 1.12
8# and xml-rewrite.py because they were so slow 8# and xml-rewrite.py because they were so slow
9# Petteri Räty (betelgeuse@gentoo.org) 9# Petteri Räty (betelgeuse@gentoo.org)
10# 10#
11# Licensed under the GNU General Public License, v2 11# Licensed under the GNU General Public License, v2
12# 12#
13# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.11 2007/01/06 19:45:27 betelgeuse Exp $ 13# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.12 2007/01/12 14:03:16 betelgeuse Exp $
14 14
15inherit java-utils-2 15inherit java-utils-2
16 16
17# This eclass provides functionality for Java packages which use 17# This eclass provides functionality for Java packages which use
18# ant to build. In particular, it will attempt to fix build.xml files, so that 18# ant to build. In particular, it will attempt to fix build.xml files, so that
243 243
244# ------------------------------------------------------------------------------ 244# ------------------------------------------------------------------------------
245# @public java-ant_rewrite-classpath 245# @public java-ant_rewrite-classpath
246# 246#
247# Adds 'classpath="${gentoo.classpath}"' to specified build file. 247# Adds 'classpath="${gentoo.classpath}"' to specified build file.
248# @param $1 - the file to rewrite (defaults to build.xml)
248# ------------------------------------------------------------------------------ 249# ------------------------------------------------------------------------------
249java-ant_rewrite-classpath() { 250java-ant_rewrite-classpath() {
250 debug-print-function ${FUNCNAME} $* 251 debug-print-function ${FUNCNAME} $*
251 252
252 if [ -z "${1}" ]; then
253 eerror "java-ant_rewrite-classpath needs one argument"
254 die "java-ant_rewrite-classpath needs one argument"
255 fi
256
257 local file="${1}" 253 local file="${1}"
254 [[ -z "${1}" ]] && file=build.xml
255
258 echo "Adding gentoo.classpath to ${file}" 256 echo "Adding gentoo.classpath to ${file}"
259 debug-print "java-ant_rewrite-classpath: ${file}" 257 debug-print "java-ant_rewrite-classpath: ${file}"
260 258
261 cp "${file}" "${file}.orig" || die "failed to copy ${file}" 259 cp "${file}" "${file}.orig" || die "failed to copy ${file}"
262 260
263 chmod u+w "${file}" 261 chmod u+w "${file}"
264 262
265 xml-rewrite.py -f "${file}" --change -e javac -e xjavac -a classpath -v '${gentoo.classpath}' || die "xml-rewrite failed: ${file}" 263 java-ant_xml-rewrite -f "${file}" --change -e javac -e xjavac -a classpath -v '${gentoo.classpath}'
266 264
267 if [[ -n "${JAVA_PKG_DEBUG}" ]]; then 265 if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
268 diff -NurbB "${file}.orig" "${file}" 266 diff -NurbB "${file}.orig" "${file}"
269 fi 267 fi
270} 268}
269
270# ------------------------------------------------------------------------------
271# @public java-ant_ignore-system-classes
272#
273# Makes the available task ignore classes in the system classpath
274# @param $1 - the file to rewrite (defaults to build.xml)
275# ------------------------------------------------------------------------------
276java-ant_ignore-system-classes() {
277 debug-print-function ${FUNCNAME} $*
278 local file="${1}"
279 [[ -z "${1}" ]] && file=build.xml
280 echo "Changing ignoresystemclasses to true for available tasks"
281 java-ant_xml-rewrite -f "${file}" --change \
282 -e available -a ignoresystemclasses -v "true"
283}
284
285# ------------------------------------------------------------------------------
286# @public java-ant_xml-rewrite
287# Run the right xml-rewrite binary with the given arguments
288# ------------------------------------------------------------------------------
289java-ant_xml-rewrite() {
290 local bindir="${ROOT}/usr/bin/"
291 local gen2="${bindir}/xml-rewrite-2.py"
292 local gen1="${bindir}/xml-rewrite.py"
293 if [[ -x "${gen2}" ]]; then
294 ${gen2} "${@}" || die "${gen2} failed"
295 elif [[ -x "${gen1}" ]]; then
296 ${gen1} "${@}" || die "${gen1} failed"
297 else
298 eerror "No binary for rewriting found."
299 eerror "Do you have dev-java/javatoolkit installed?"
300 die "xml-rewrite not found"
301 fi
302}

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20