public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-java] RFC: java-ant_remove-taskdefs
@ 2008-03-09 23:05 Petteri Räty
  0 siblings, 0 replies; only message in thread
From: Petteri Räty @ 2008-03-09 23:05 UTC (permalink / raw
  To: Gentoo Java


[-- Attachment #1.1: Type: text/plain, Size: 132 bytes --]

xml-rewrite-N.py only works on attributes so I think it's easiest to 
just have some inline python for this.

Regards,
Petteri

[-- Attachment #1.2: remove-taskdefs.patch --]
[-- Type: text/plain, Size: 1781 bytes --]

Index: java-ant-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v
retrieving revision 1.30
diff -u -r1.30 java-ant-2.eclass
--- java-ant-2.eclass	5 Mar 2008 19:30:29 -0000	1.30
+++ java-ant-2.eclass	9 Mar 2008 23:01:32 -0000
@@ -380,6 +380,31 @@
 }
 
 # ------------------------------------------------------------------------------
+# @public java-ant_remove-taskdefs
+#
+# Removes taskdef elements from the file
+# @param $1 - the file to rewrite (defaults to build.xml)
+# ------------------------------------------------------------------------------
+java-ant_remove-taskdefs() {
+	debug-print-function ${FUNCNAME} $*
+	local file=${1:-build.xml}
+	echo "Removing taskdefs from ${file}"
+	python <<EOF
+import sys
+from xml.dom.minidom import parse
+dom = parse("${file}")
+for elem in dom.getElementsByTagName('taskdef'):
+	elem.parentNode.removeChild(elem)
+	elem.unlink()
+f = open("${file}", "w")
+dom.writexml(f)
+f.close()
+EOF
+	[[ $? != 0 ]] && die "Removing taskdefs failed"
+}
+
+
+# ------------------------------------------------------------------------------
 # @public java-ant_ignore-system-classes
 #
 # Makes the available task ignore classes in the system classpath
@@ -387,9 +412,8 @@
 # ------------------------------------------------------------------------------
 java-ant_ignore-system-classes() {
 	debug-print-function ${FUNCNAME} $*
-	local file="${1}"
-	[[ -z "${1}" ]] && file=build.xml
-	echo "Changing ignoresystemclasses to true for available tasks"
+	local file=${1:-build.xml}
+	echo "Changing ignoresystemclasses to true for available tasks in ${file}"
 	java-ant_xml-rewrite -f "${file}" --change \
 		-e available -a ignoresystemclasses -v "true"
 }

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-09 23:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-09 23:05 [gentoo-java] RFC: java-ant_remove-taskdefs Petteri Räty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox