/[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.36 Revision 1.37
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.36 2008/07/01 19:02:21 betelgeuse Exp $ 17# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.37 2008/07/07 16:48:45 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
49# check that java-pkg_ant-tasks-depend didn't fail 48# check that java-pkg_ant-tasks-depend didn't fail
50if [[ $? != 0 ]]; then 49if [[ $? != 0 ]]; then
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
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
54JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} ${ANT_TASKS_DEPEND}" 57JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND}
58 ${ANT_TASKS_DEPEND}
59 ${JAVA_PKG_PORTAGE_DEP}
60 >=dev-java/javatoolkit-0.2.0-r1
61 >=dev-lang/python-2.4"
55 62
56# 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
57# 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
58if hasq java-pkg-opt-2 ${INHERITED}; then 65if hasq java-pkg-opt-2 ${INHERITED}; then
59 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} )"
60elif ! hasq java-pkg-2 ${INHERITED}; then 67elif ! hasq java-pkg-2 ${INHERITED}; then
61 eerror "java-ant-2 eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2" 68 eerror "java-ant-2 eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2"
62fi 69fi
63 70
64# We need some tools from javatoolkit. We also need portage 2.1 for phase hooks 71DEPEND="${JAVA_ANT_E_DEPEND}"
65# and ant dependencies constructed above
66DEPEND=">=dev-java/javatoolkit-0.2.0-r1 ${JAVA_PKG_PORTAGE_DEP} ${JAVA_ANT_E_DEPEND}"
67 72
68# ------------------------------------------------------------------------------ 73# ------------------------------------------------------------------------------
69# @global JAVA_PKG_BSFIX 74# @global JAVA_PKG_BSFIX
70# 75#
71# Should we attempt to 'fix' ant build files to include the source/target 76# Should we attempt to 'fix' ant build files to include the source/target
393 diff -NurbB "${file}.orig" "${file}" 398 diff -NurbB "${file}.orig" "${file}"
394 fi 399 fi
395} 400}
396 401
397# ------------------------------------------------------------------------------ 402# ------------------------------------------------------------------------------
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# ------------------------------------------------------------------------------
398# @public java-ant_ignore-system-classes 427# @public java-ant_ignore-system-classes
399# 428#
400# Makes the available task ignore classes in the system classpath 429# Makes the available task ignore classes in the system classpath
401# @param $1 - the file to rewrite (defaults to build.xml) 430# @param $1 - the file to rewrite (defaults to build.xml)
402# ------------------------------------------------------------------------------ 431# ------------------------------------------------------------------------------

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

  ViewVC Help
Powered by ViewVC 1.1.20