/[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.49 Revision 1.50
12# and xml-rewrite.py because they were so slow 12# and xml-rewrite.py because they were so slow
13# Petteri Räty (betelgeuse@gentoo.org) 13# Petteri Räty (betelgeuse@gentoo.org)
14# 14#
15# Licensed under the GNU General Public License, v2 15# Licensed under the GNU General Public License, v2
16# 16#
17# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.49 2010/04/29 08:40:29 caster Exp $ 17# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.50 2010/10/17 12:55:00 betelgeuse Exp $
18 18
19inherit java-utils-2 19inherit java-utils-2
20 20
21# This eclass provides functionality for Java packages which use 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 22# ant to build. In particular, it will attempt to fix build.xml files, so that
35# 35#
36# Setting this variable non-empty before inheriting java-ant-2 disables adding 36# Setting this variable non-empty before inheriting java-ant-2 disables adding
37# dev-java/ant-core into DEPEND. 37# dev-java/ant-core into DEPEND.
38 38
39# construct ant-speficic DEPEND 39# construct ant-speficic DEPEND
40JAVA_ANT_E_DEPEND=""
41# add ant-core into DEPEND, unless disabled 40# add ant-core into DEPEND, unless disabled
42if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then 41if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then
43 JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.7.0" 42 JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.7.0"
44fi 43fi
45 44
51 eerror "${ANT_TASKS_DEPEND}" 50 eerror "${ANT_TASKS_DEPEND}"
52 die "java-pkg_ant-tasks-depend() failed" 51 die "java-pkg_ant-tasks-depend() failed"
53fi 52fi
54 53
55# We need some tools from javatoolkit. We also need portage 2.1 for phase hooks 54# We need some tools from javatoolkit. We also need portage 2.1 for phase hooks
56# and ant dependencies constructed above. 55# and ant dependencies constructed above. Python is there for
56# java-ant_remove-taskdefs
57JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} 57JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND}
58 ${ANT_TASKS_DEPEND} 58 ${ANT_TASKS_DEPEND}
59 ${JAVA_PKG_PORTAGE_DEP} 59 ${JAVA_PKG_PORTAGE_DEP}
60 >=dev-java/javatoolkit-0.3.0-r2" 60 >=dev-java/javatoolkit-0.3.0-r2
61 >=dev-lang/python-2.4"
61 62
62# this eclass must be inherited after java-pkg-2 or java-pkg-opt-2 63# 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 it's java-pkg-opt-2, ant dependencies are pulled based on USE flag
64if hasq java-pkg-opt-2 ${INHERITED}; then 65if hasq java-pkg-opt-2 ${INHERITED}; then
65 JAVA_ANT_E_DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_ANT_E_DEPEND} )" 66 JAVA_ANT_E_DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_ANT_E_DEPEND} )"
426 diff -NurbB "${file}.orig" "${file}" 427 diff -NurbB "${file}.orig" "${file}"
427 fi 428 fi
428} 429}
429 430
430# ------------------------------------------------------------------------------ 431# ------------------------------------------------------------------------------
432# @public java-ant_remove-taskdefs
433#
434# Removes taskdef elements from the file
435# @param $1 - the file to rewrite (defaults to build.xml)
436# ------------------------------------------------------------------------------
437java-ant_remove-taskdefs() {
438 debug-print-function ${FUNCNAME} $*
439 local file=${1:-build.xml}
440 echo "Removing taskdefs from ${file}"
441 python <<EOF
442import sys
443from xml.dom.minidom import parse
444dom = parse("${file}")
445for elem in dom.getElementsByTagName('taskdef'):
446 elem.parentNode.removeChild(elem)
447 elem.unlink()
448f = open("${file}", "w")
449dom.writexml(f)
450f.close()
451EOF
452 [[ $? != 0 ]] && die "Removing taskdefs failed"
453}
454
455# ------------------------------------------------------------------------------
431# @public java-ant_ignore-system-classes 456# @public java-ant_ignore-system-classes
432# 457#
433# Makes the available task ignore classes in the system classpath 458# Makes the available task ignore classes in the system classpath
434# @param $1 - the file to rewrite (defaults to build.xml) 459# @param $1 - the file to rewrite (defaults to build.xml)
435# ------------------------------------------------------------------------------ 460# ------------------------------------------------------------------------------

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.20