/[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.37 Revision 1.38
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.37 2008/07/07 16:48:45 betelgeuse Exp $ 17# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.38 2008/07/07 16:54:56 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=""
40# add ant-core into DEPEND, unless disabled 41# add ant-core into DEPEND, unless disabled
41if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then 42if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then
42 JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.7.0" 43 JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.7.0"
43fi 44fi
44 45
48# check that java-pkg_ant-tasks-depend didn't fail 49# check that java-pkg_ant-tasks-depend didn't fail
49if [[ $? != 0 ]]; then 50if [[ $? != 0 ]]; then
50 eerror "${ANT_TASKS_DEPEND}" 51 eerror "${ANT_TASKS_DEPEND}"
51 die "java-pkg_ant-tasks-depend() failed" 52 die "java-pkg_ant-tasks-depend() failed"
52fi 53fi
53
54# We need some tools from javatoolkit. We also need portage 2.1 for phase hooks
55# and ant dependencies constructed above. Python is there for
56# java-ant_remove-taskdefs
57JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} 54JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} ${ANT_TASKS_DEPEND}"
58 ${ANT_TASKS_DEPEND}
59 ${JAVA_PKG_PORTAGE_DEP}
60 >=dev-java/javatoolkit-0.2.0-r1
61 >=dev-lang/python-2.4"
62 55
63# this eclass must be inherited after java-pkg-2 or java-pkg-opt-2 56# this eclass must be inherited after java-pkg-2 or java-pkg-opt-2
64# if it's java-pkg-opt-2, ant dependencies are pulled based on USE flag 57# if it's java-pkg-opt-2, ant dependencies are pulled based on USE flag
65if hasq java-pkg-opt-2 ${INHERITED}; then 58if hasq java-pkg-opt-2 ${INHERITED}; then
66 JAVA_ANT_E_DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_ANT_E_DEPEND} )" 59 JAVA_ANT_E_DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_ANT_E_DEPEND} )"
67elif ! hasq java-pkg-2 ${INHERITED}; then 60elif ! hasq java-pkg-2 ${INHERITED}; then
68 eerror "java-ant-2 eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2" 61 eerror "java-ant-2 eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2"
69fi 62fi
70 63
71DEPEND="${JAVA_ANT_E_DEPEND}" 64# We need some tools from javatoolkit. We also need portage 2.1 for phase hooks
65# and ant dependencies constructed above
66DEPEND=">=dev-java/javatoolkit-0.2.0-r1 ${JAVA_PKG_PORTAGE_DEP} ${JAVA_ANT_E_DEPEND}"
72 67
73# ------------------------------------------------------------------------------ 68# ------------------------------------------------------------------------------
74# @global JAVA_PKG_BSFIX 69# @global JAVA_PKG_BSFIX
75# 70#
76# Should we attempt to 'fix' ant build files to include the source/target 71# Should we attempt to 'fix' ant build files to include the source/target
398 diff -NurbB "${file}.orig" "${file}" 393 diff -NurbB "${file}.orig" "${file}"
399 fi 394 fi
400} 395}
401 396
402# ------------------------------------------------------------------------------ 397# ------------------------------------------------------------------------------
403# @public java-ant_remove-taskdefs
404#
405# Removes taskdef elements from the file
406# @param $1 - the file to rewrite (defaults to build.xml)
407# ------------------------------------------------------------------------------
408java-ant_remove-taskdefs() {
409 debug-print-function ${FUNCNAME} $*
410 local file=${1:-build.xml}
411 echo "Removing taskdefs from ${file}"
412 python <<EOF
413import sys
414from xml.dom.minidom import parse
415dom = parse("${file}")
416for elem in dom.getElementsByTagName('taskdef'):
417 elem.parentNode.removeChild(elem)
418 elem.unlink()
419f = open("${file}", "w")
420dom.writexml(f)
421f.close()
422EOF
423 [[ $? != 0 ]] && die "Removing taskdefs failed"
424}
425
426# ------------------------------------------------------------------------------
427# @public java-ant_ignore-system-classes 398# @public java-ant_ignore-system-classes
428# 399#
429# Makes the available task ignore classes in the system classpath 400# Makes the available task ignore classes in the system classpath
430# @param $1 - the file to rewrite (defaults to build.xml) 401# @param $1 - the file to rewrite (defaults to build.xml)
431# ------------------------------------------------------------------------------ 402# ------------------------------------------------------------------------------

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

  ViewVC Help
Powered by ViewVC 1.1.20